Created
April 19, 2013 07:38
-
-
Save gromgull/5418745 to your computer and use it in GitHub Desktop.
rdflib sparql example
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
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