Skip to content

Instantly share code, notes, and snippets.

@gromgull
Created April 19, 2013 07:38
Show Gist options
  • Save gromgull/5418745 to your computer and use it in GitHub Desktop.
Save gromgull/5418745 to your computer and use it in GitHub Desktop.
rdflib sparql example
from rdflib import Graph
g = Graph()
g.parse('http://datahub.io/dataset/semanticquran');
query = """
SELECT ?preposition sample(?verseTextAr) WHERE {
?word gold:PartOfSpeechProperty olia-ar:Preposition;
skos:prefLabel ?preposition;
dcterms:isPart ?verse.
?verse a qvoc:Verse;
skos:prefLabel ?verseTextAr.
} GROUP BY ?preposition
"""
for row in g.query(query):
print row
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment