Table des matières

Sites/Données

Un exemple de page DBPedia (live) concernant l'Italie

Eurostat linked data

Linked NUTS

RAMON Eurostat's Metadata Server

Le site utilisé – sans SPARQL

http://estatwrap.ontologycentral.com/

http://estatwrap.ontologycentral.com/table_of_contents.html

Un jeu de données de test

http://www.lespetitescases.net/ou-s-amuser-avec-sparql

Un point d'accès: http://wifo5-03.informatik.uni-mannheim.de/eurostat/


PREFIX countries: <http://wifo5-04.informatik.uni-mannheim.de/eurostat/resource/countries/>
SELECT * WHERE {
countries:Deutschland ?p ?o
}
SELECT DISTINCT ?property ?hasValue ?isValueOf
WHERE {
  { <http://wifo5-04.informatik.uni-mannheim.de/eurostat/resource/countries/Deutschland> ?property ?hasValue }
  UNION
  { ?isValueOf ?property <http://wifo5-04.informatik.uni-mannheim.de/eurostat/resource/countries/Deutschland> }
}
ORDER BY (!BOUND(?hasValue)) ?property ?hasValue ?isValueOf
PREFIX countries: <http://wifo5-04.informatik.uni-mannheim.de/eurostat/resource/countries/>
SELECT DISTINCT ?name ?geocodeProvince ?parentCountryGeocode ?populationTotal WHERE {
?s rdf:type eurostat:regions.
?s eurostat:name ?name.
?s eurostat:geocode  ?geocodeProvince.
?s eurostat:population_total ?populationTotal.
?s eurostat:parentcountry ?parentCountry.
?parentCountry eurostat:geocode ?parentCountryGeocode
}
ORDER BY ?parentCountryGeocode ?name
PREFIX countries: <http://wifo5-04.informatik.uni-mannheim.de/eurostat/resource/countries/>
SELECT 
# MAX(?s) (count(*) as ?nombre) ?geocodeProvince

DISTINCT (MIN(?s) as ?identifiant)  (GROUP_CONCAT(?name ; separator="|") as ?concatName) ?geocodeProvince (MIN(?parentCountryGeocode) as ?siglePays) (MIN(?populationTotal) as ?population) (count(*) as ?nombre)

WHERE {
?s rdf:type eurostat:regions.
?s eurostat:name ?name.
?s eurostat:geocode  ?geocodeProvince.
?s eurostat:population_total ?populationTotal.
?s eurostat:parentcountry ?parentCountry.
?parentCountry eurostat:geocode ?parentCountryGeocode
}
GROUP BY ?geocodeProvince
ORDER BY ?parentCountryGeocode ?name ?geocodeProvince

Requêtes dans Fuseki

PREFIX  dc:   <http://purl.org/dc/elements/1.1/>
PREFIX  rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX  meg:  <http://mon_espace.org/graph/>
PREFIX  apf:  <http://jena.hpl.hp.com/ARQ/property#>
PREFIX  eus:  <http://ec.europa.eu/eurostat/ramon/ontologies/geographic.rdf#>
PREFIX  xsd:  <http://www.w3.org/2001/XMLSchema#>
PREFIX  owl:  <http://www.w3.org/2002/07/owl#>
PREFIX  rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX  fn:   <http://www.w3.org/2005/xpath-functions#>
PREFIX  eu_man: <http://wifo5-04.informatik.uni-mannheim.de/eurostat/resource/eurostat/>

SELECT  ?country
WHERE
  { SERVICE <http://wifo5-04.informatik.uni-mannheim.de/eurostat/sparql>
      { ?country rdf:type eu_man:countries }
  }
LIMIT   5
PREFIX...

SELECT  ?country ?sameAs
WHERE
  { SERVICE <http://wifo5-04.informatik.uni-mannheim.de/eurostat/sparql>
      { ?country rdf:type eu_man:countries
        OPTIONAL
          { ?country owl:sameAs ?sameAs
            FILTER contains(xsd:string(?sameAs), "dbpedia")
          }
      }
  }
LIMIT   10
PREFIX ...
SELECT  ?country ?label ?sameAs
WHERE
  { SERVICE <http://wifo5-04.informatik.uni-mannheim.de/eurostat/sparql>
      { ?country rdf:type eu_man:countries.
?country rdfs:label ?label
        OPTIONAL
          { ?country owl:sameAs ?sameAs
            FILTER contains(xsd:string(?sameAs), "dbpedia")
          }
      }
  }
  
PREFIX...
CONSTRUCT 
  { ?country rdfs:label ?label .
    ?country owl:sameAs ?sameAs .}
WHERE
  { SERVICE <http://wifo5-04.informatik.uni-mannheim.de/eurostat/sparql>
      { ?country rdf:type eu_man:countries .
        ?country rdfs:label ?label
        OPTIONAL
          { ?country owl:sameAs ?sameAs
            FILTER contains(xsd:string(?sameAs), "dbpedia")
          }
      }
  }
PREFIX...

INSERT {
  GRAPH meg:countries_20141014 {
    ?country rdfs:label ?label .
    ?country owl:sameAs ?sameAs .
  }
}
WHERE
  { SERVICE <http://wifo5-04.informatik.uni-mannheim.de/eurostat/sparql>
      { ?country rdf:type eu_man:countries .
        ?country rdfs:label ?label
        OPTIONAL
          { ?country owl:sameAs ?sameAs
            FILTER contains(xsd:string(?sameAs), "dbpedia")
          }
      }
  }
PREFIX...

SELECT  *
WHERE
  { GRAPH <http://mon_espace.org/graph/countries_20141014>
      { ?s ?p ?o }
  }
  

Vider un graphe sous Fuseki

ATTENTION : la base est ainsi vidée

DELETE 
WHERE  {?s ?p ?o}

Vérifier qu'elle est vide : 
SELECT * 
WHERE {?s ?p ?o}

Avec graphe

DELETE WHERE 
{
  GRAPH ?g {
    ?s ?p ?o .
  }
}

Vérifier que le graphe est vide :

SELECT  *
WHERE
  { GRAPH ?g
      { ?s ?p ?o }
  }