Une requête :
PREFIX abo: <http://artemisBookstore.com/ontology#>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX dbr: <http://dbpedia.org/resource/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX abr: <http://artemisBookstore.com/abr/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
INSERT {
?a abo:birthState ?birthState.
?birthPlace rdfs:label ?stateLabel.
}
WHERE {
?a a abo:Writer;
foaf:name ?name;
owl:sameAs ?dbpediaResource.
FILTER (regex(str(?dbpediaResource),"dbpedia.org"))
SERVICE <http://dbpedia.org/sparql> {
?dbpediaResource dbo:birthPlace ?birthState .
?birthState rdfs:label ?stateLabel;
a dbo:AdministrativeRegion.
FILTER langMatches( lang(?stateLabel), "EN" )
}
}
on peut vérifier que les insertions se sont bien déroulées avec la requête
PREFIX abo: <http://artemisBookstore.com/ontology#>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX dbr: <http://dbpedia.org/resource/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX abr: <http://artemisBookstore.com/abr/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?a ?name ?birthState ?label where {
?a a abo:Writer;
foaf:name ?name;
abo:birthState ?birthState.
?birthState rdfs:label ?label.
} ORDER BY ?label
qui donne le résultat