Search code examples
sparqljenadbpedia

Is there a way to get the 'is skos:broader of' of an entity from DBPedia using SPARQL?


Basically, I'm trying to get the 'subclasses' of this entity. For example:

DBpedia Egyptian film actors

I tried using --

select ?p1 where {
   <http://dbpedia.org/resource/Category:Norwegian_silent_film_actors> skos:narrower ?p1 .
}

-- and --

select ?p1 where {
   <http://dbpedia.org/resource/Category:Norwegian_silent_film_actors> rdfs:subclass ?p1 .
}

-- but since that's not actually its predicate, it doesn't work. Both actually return just the entity itself if a * is added after the predicate.

Is there any way of getting those objects?


Solution

  • It's important to remember that is skos:broader of relations are inverse skos:broader relations -- which imply but do not necessarily indicate the presence of skos:narrower statements. DBpedia doesn't have every explicit statement that might be inferred from what's there, and inference rules are not active by default.

    You can use the explicit statements that do exist with queries like this, which uses the property path + for one-or-more skos:broader relationships --

    select ?p1 
    where 
      {
        ?p1  
           skos:broader+
             <http://dbpedia.org/resource/Category:Norwegian_silent_film_actors> 
      }
    

    -- or this, which uses the property path ^ to reverse the relationship --

    select ?p1 
    where 
      {
        <http://dbpedia.org/resource/Category:Norwegian_silent_film_actors>
           ^skos:broader*
              ?p1
      }
    

    This is a place where inference rules might well be brought to bear. Unfortunately, there are no predefined inference rules relating skos:broader and skos:narrower, and this public endpoint does not accept ad-hoc rule additions. You could create some on a personal endpoint, whether pre-built and pre-populated with DBpedia in the cloud or otherwise.