Search code examples
treevisualizationontologyprotege

steps or code for ontology visualization to get clear numbers by class on a tree or a bar chart


I am looking for steps or code for ontology visualization to get clear numbers for individuals by each class on a tree or a bar chart. I can convert the ontology file into another format such as xml. Just need help for how to do, many thanks!

It can be an expandable tree, or a bar chart, showing the numbers or percentages for each class or subclass.


Solution

  • What you can do is write a SPARQL aggregation query that will give you, for each type present in your dataset, the number of individuals. Turning this table into a chart can be done using a number of things, such as a spreadsheet software.

    SELECT ?type (COUNT(DISTINCT ?individual) AS ?count) WHERE {
      ?individual rdf:type ?type
    }
    GROUP BY ?type
    ORDER BY DESC(?count)