Question

I'm trying to run a SPARQL query on a local ontology using Fuseki, but I'm unable to get any results. My ontology contains a list of countries like this:

###  http://localhost:2020/country/6

<http://localhost:2020/country/6> rdf:type <http://localhost:2020/vocab/country> , owl:NamedIndividual ;
rdfs:label "country #6" ;
<http://localhost:2020/vocab/country_id> 6 ;
<http://localhost:2020/vocab/country_name_nl> "Nederland" ;                              
<http://localhost:2020/vocab/country_code> "nl" .

And properties are like this one:

###  http://localhost:2020/vocab/country_code

<http://localhost:2020/vocab/country_code> rdfs:label "country code" .

The test query I'm trying to run is:

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?name WHERE {?name rdfs:type <http://localhost:2020/vocab/country>} LIMIT 50

Why doesn't this give me a list of countries? I'm getting an empty "name" column instead

Was it helpful?

Solution

Silly mistake, 'type' is rdf and not rdfs... Works like a charm now!

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?name WHERE {?name rdf:type <http://localhost:2020/vocab/country>} LIMIT 50
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top