Esraa Ali
Esraa Ali

Reputation: 13

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').  
}

Upvotes: 1

Views: 1617

Answers (2)

user1163441
user1163441

Reputation: 89

Following sparql query will display all the properties and values of the resource Suez.

select distinct ?property ?value{
  dbr:Suez ?property ?value
}

SPARQL Results

You can compare the results of above query with the actual resource properties available via any web browser using the link Suez.

Please note as follows about the results of above query:

  1. A property with multiple values will be displayed multiple times. For example the property 'dct:subject' has eight different values and hence will be displayed eight times in the result.

  2. "dbo:abstract" will be displayed multiple times in the result for abstract in different languages.

Hope it helps.

Cheers, Ambi.

Upvotes: 0

Joshua Taylor
Joshua Taylor

Reputation: 85813

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

Upvotes: 3

Related Questions