DBPedia SPARQL query should return results, but empty

I want to get all pages with the specified category and the specified key. My request:

PREFIX dbpedia: <http://dbpedia.org/> PREFIX dbpedia2: <http://dbpedia.org/property/> PREFIX dbpedia-owl: <http://dbpedia.org/ontology/> PREFIX dcterms: <http://dublincore.org/2010/10/11/dcterms.rdf#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> PREFIX grs: <http://www.georss.org/georss/point> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?page ?cat ?key ?value (lang(?value) as ?language) WHERE { ?page dcterms:subject ?cat . ?page ?key ?value . FILTER( regex(?cat, "category:Amusement_parks_in_the_Netherlands") && ?key = foaf:depiction ) } 

But it returns null results. See Here: SNORQL Query

It should at least return this page: http://dbpedia.org/page/Duinrell (because it meets the criteria).

Any ideas?

+4
source share
1 answer

There are several things in your request. First of all, do not use regex when comparing URIs. Instead:

 regex(?cat, "category:Amusement_parks_in_the_Netherlands") 

using:

 ?cat = <http://dbpedia.org/resource/category:Amusement_parks_in_the_Netherlands> 

Second: your namespace prefix for the dublin kernel seems wrong. You request the dcterms:subject property, and in your request, the dcterms prefix maps to the namespace http://dublincore.org/2010/10/11/dcterms.rdf# . However, the actual property in DBPedia is http://purl.org/dc/terms/subject , so your namespace prefix should display instead of http://purl.org/dc/terms/ .

+6
source

Source: https://habr.com/ru/post/1392202/


All Articles