Created
February 7, 2012 12:59
-
-
Save mhawksey/1759562 to your computer and use it in GitHub Desktop.
Example SPARQL query for PROD
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
library(SPARQL) | |
library(sp) | |
d <- SPARQL(url='http://api.talis.com/stores/jisc-prod-dev1/services/sparql', | |
query='PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | |
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |
PREFIX owl: <http://www.w3.org/2002/07/owl#> | |
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> | |
PREFIX foaf: <http://xmlns.com/foaf/0.1/> | |
PREFIX jisc: <http://www.rkbexplorer.com/ontologies/jisc#> | |
PREFIX doap: <http://usefulinc.com/ns/doap#> | |
PREFIX prod: <http://prod.cetis.ac.uk/vocab/> | |
PREFIX mu: <http://www.jiscmu.ac.uk/schema/muweb/> | |
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> | |
PREFIX dc: <http://purl.org/dc/elements/1.1/> | |
SELECT DISTINCT ?projectID ?Project ?Project_Name ?Programme ?Strand ?Lead_Inst_ID ?Lead_Inst xsd:float(?lat) xsd:float(?long) ?Desc | |
WHERE { | |
?projectID a doap:Project . | |
OPTIONAL { ?projectID prod:programme ?Programme } . | |
OPTIONAL { ?projectID prod:strand ?Strand } . | |
OPTIONAL { ?projectID jisc:short-name ?Project } . | |
OPTIONAL { ?projectID doap:name ?Project_Name } . | |
?projectID doap:vendor ?Lead_Inst_ID . | |
?Lead_Inst_ID rdfs:label ?Lead_Inst . | |
OPTIONAL { | |
?Lead_Inst_ID owl:sameAs ?fbID . | |
?muID owl:sameAs ?fbID . | |
?muID geo:lat ?lat . | |
?muID geo:long ?long . | |
} | |
OPTIONAL { | |
?projectID doap:shortdesc ?Desc . | |
} | |
} ', | |
ns=c('rdf','<http://www.w3.org/1999/02/22-rdf-syntax-ns#>', | |
'rdfs','<http://www.w3.org/2000/01/rdf-schema#>', | |
'owl','<http://www.w3.org/2002/07/owl#>', | |
'xsd','<http://www.w3.org/2001/XMLSchema#>', | |
'foaf','<http://xmlns.com/foaf/0.1/>', | |
'jisc','<http://www.rkbexplorer.com/ontologies/jisc#>', | |
'doap','<http://usefulinc.com/ns/doap#>', | |
'prod','<http://prod.cetis.ac.uk/vocab/>', | |
'mu','<http://www.jiscmu.ac.uk/schema/muweb/>', | |
'geo','<http://www.w3.org/2003/01/geo/wgs84_pos#>', | |
'dc','<http://purl.org/dc/elements/1.1/>'),format="xml", lossy=F) | |
prod <- as.data.frame(d$results) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment