iNikkz
iNikkz

Reputation: 3819

Getting super and sub classes of Dbpedia Ontology

I am trying to get the hierarchy of super and subclass of dbpedia ontolgy.

Sparql query:

SELECT DISTINCT ?superclass ?subclass 
 WHERE 
   {
     ?subclass                a  owl:Class    .
     ?subclass  rdfs:subClassOf  ?superclass
   } 
ORDER BY  ?superclass ?subclass

It gives me all classes. But when I am trying to get the counts of entity inside classes. Some classes have entity while some don't have.

Sparql query to get the count of entity inside classes.

Getting Entities:

SELECT DISTINCT ?label AS ?label 
                 ?name AS ?name 
                 ?link AS ?link
  WHERE
    {
                 ?link  rdf:type    <http://www.wikidata.org/entity/Q12136>  .
      OPTIONAL { ?link  foaf:name   ?name                                    }
      OPTIONAL { ?link  rdfs:label  ?label                                   }
          FILTER( lang(?label) = "en" )
    }

Not getting Entities:

SELECT DISTINCT ?label AS ?label
                 ?name AS ?name 
                 ?link AS ?link
 WHERE
   {
                ?link  rdf:type    <http://www.wikidata.org/entity/Q18553493> .
     OPTIONAL { ?link  foaf:name   ?name                                      }
     OPTIONAL { ?link  rdfs:label  ?label                                     }
          FILTER(lang(?label) = "en" )
   }

Why some classes don't have entities? Or Am I doing something wrong? Any help please?

Upvotes: 2

Views: 664

Answers (1)

UninformedUser
UninformedUser

Reputation: 8465

First of all, you are talking about classes and not ontologies. I don't know why you think that entities are instances of ontologies, especially when you're talking about individuals/instances/resources.

Second, why shouldn't there be classes that do not have instances yet?

Upvotes: 1

Related Questions