Skip to content

Instantly share code, notes, and snippets.

@mommi84
Last active January 20, 2018 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mommi84/e7e3fda02eeb4e4d6d3dcb725afcd190 to your computer and use it in GitHub Desktop.
Save mommi84/e7e3fda02eeb4e4d6d3dcb725afcd190 to your computer and use it in GitHub Desktop.
SPARQL-based similarity search – Top entities of type X which share characteristics with Y
SELECT ?s (count(?o) AS ?c) {
{
<Y> ?p ?o .
?s ?p ?o ; a <X>
} UNION {
?o ?p <Y> , ?s .
?s a <X>
}
} GROUP BY ?s ORDER BY DESC(?c) LIMIT 11