1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
from SPARQLWrapper import SPARQLWrapper, JSON
sparql = SPARQLWrapper("http://agrovoc.uniroma2.it:3030/agrovoc/sparql")
query = """
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?conceptAGROVOC ?conceptGEMET ?label
WHERE {
?conceptAGROVOC rdf:type skos:Concept ;
skos:prefLabel ?label;
skos:inScheme <http://voc.landportal.info/landterms> .
FILTER (lang(?label) = 'en')
SERVICE <http://semantic.eea.europa.eu/sparql> {
?conceptGEMET skos:prefLabel ?label ;
skos:inScheme <http://www.eionet.europa.eu/gemet/gemetThesaurus> .
}
}
"""
sparql.setQuery(query)
sparql.setReturnFormat(JSON)
results = sparql.query().print_results()
|