Lets say there is a RDF DB of people and each of these people has many triples defining this person's friends (so many of 'person' x:hasFriend 'otherPerson'
). How can I find people who have the most similar friends? I'm a novice at SPARQL and this seems like a really complex query.
Basically, the results would be a list of people starting from the ones with the most similar friends list (to the person specified in the query) and then going down the list to the people with the least similar friends list.
So lets say I search this query for person1
, the results would be something like:
person2
- 300 of the same friendsperson30
- 245 of the same friendsperson18
- 16 of the same friends
etc.
If you adapt the approach in my answer to How to find similar content using SPARQL (of which this might be considered a duplicate), you'd end up with something like:
If you really want to, you can use a reverse property path to make the query pattern a little shorter: