Last active
May 8, 2018 12:53
-
-
Save wsalesky/0c80c9a9754cbba9a915d317e2bbfa3e to your computer and use it in GitHub Desktop.
SPARQL query to get citations and related subjects for Syriaca.org data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |
prefix lawd: <http://lawd.info/ontology/> | |
prefix skos: <http://www.w3.org/2004/02/skos/core#> | |
prefix dcterms: <http://purl.org/dc/terms/> | |
SELECT ?uri (SAMPLE(?l) AS ?label) (SAMPLE(?uriSubject) AS ?subjects) (SAMPLE(?uriCitations) AS ?citations) | |
{ | |
?uri rdfs:label ?l | |
FILTER (?uri IN ( <http://syriaca.org/person/782>,<http://syriaca.org/person/552>,<http://syriaca.org/person/684>,<http://syriaca.org/person/492>)). | |
FILTER ( langMatches(lang(?l), 'en')). | |
OPTIONAL{ | |
{SELECT ?uri ( count(?s) as ?uriSubject ) { ?s dcterms:relation ?uri } GROUP BY ?uri } } | |
OPTIONAL{ | |
{SELECT ?uri ( count(?o) as ?uriCitations ) { ?uri lawd:hasCitation ?o | |
OPTIONAL{ ?uri skos:closeMatch ?o.} | |
} GROUP BY ?uri } | |
} | |
} | |
GROUP BY ?uri |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment