Search code examples
sparqlsemantic-webdbpedia

Retrieving ALL DBpedia Resource properties


I am using this SPARQL query to retrieve all properties for a resource, for example the resource is http://dbpedia.org/resource/Suez this query doesn't retrieve all properties in http://dbpedia.org/page/Suez, I understand that the page is different than the resource.

How can I retrieve all properties in the html page ??

Here is my query without the prefixes:

SELECT DISTINCT ?property ?Label  
WHERE 
{ 
    { 
      <http://dbpedia.org/resource/Suez> ?property ?o .
    } union 
    {
       ?o ?property  <http://dbpedia.org/resource/Suez>  
    } 
    ?property rdfs:label ?Label.  
    FILTER (lang(?Label) = 'en').  
}

Solution

  • You didn't mention which properties you're not seeing, but you're requiring that each of the properties actually has a value for rdfs:label, and not all of them do. For instance, this query returns 16 results:

    select distinct ?property {
      { dbr:Suez ?property ?o }
      union
      { ?s ?property dbr:Suez }
    
      filter not exists { ?property rdfs:label ?label }
    }
    

    SPARQL results

    You'd need to update your query to check whether the properties have a label, and then take the English label if it has one:

    select distinct ?property ?label {
      { dbr:Suez ?property ?o }
      union
      { ?s ?property dbr:Suez }
    
      optional { 
        ?property rdfs:label ?label .
        filter langMatches(lang(?label), 'en')
      }
    }
    

    SPARQL results