Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigating rdfs:subClassOf hierarchies to find individuals #494

Closed
prashydee opened this issue May 2, 2023 · 2 comments
Closed

Navigating rdfs:subClassOf hierarchies to find individuals #494

prashydee opened this issue May 2, 2023 · 2 comments

Comments

@prashydee
Copy link

prashydee commented May 2, 2023

Hi @tfrancart,

I would like to be able to use subClassOf hierarchies to drill-down through classes before retrieving the corresponding individuals. The tree-selector seems to be tuned for skos:narrower / skos:broader trees. Could this also work for rdfs:subClassOf hierarchies? Ideally this would be nice to achieve in the selection of the starting class too. Is this yet possible?

Kind Regards, Prashant

@Marie-Sparna
Copy link
Contributor

Hello Prashant,

as we understand your issue, we have two different subjects :

  1. It isn't possible for the moment being to drill-down through classes from the selection of the starting class (even if we've already an issue about it here cf Ability to display a hierarchy of classes and propertis (2 levels) #351).

  2. But still possible to tune the tree-selector following your structure. You'll find a few indications to do so in the documentation here : https://docs.sparnatural.eu/OWL-based-configuration-datasources.html#your-own-sparql-query-tree. Not sure it matches your need, but do tell us !

Best, Marie

@tfrancart
Copy link
Contributor

TreeWidget can be used to display taxonomy of classes using these datasources:

:tree_root_personClass rdf:type owl:NamedIndividual ,
                                   <http://data.sparna.fr/ontologies/sparnatural-config-datasources#SparqlTreeRootDatasource> ;
                          <http://data.sparna.fr/ontologies/sparnatural-config-datasources#queryString> """PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?uri ?label ?hasChildren
WHERE {
  VALUES ?uri {$domain}
  ?uri rdfs:label ?label .
  FILTER(lang(?label) = '' || lang(?label) = $lang)
  BIND(true AS ?hasChildren)
}""" .

:tree_children_subClassOf rdf:type owl:NamedIndividual ,
                                   <http://data.sparna.fr/ontologies/sparnatural-config-datasources#SparqlTreeRootDatasource> ;
                          <http://data.sparna.fr/ontologies/sparnatural-config-datasources#queryString> """PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>                          
SELECT DISTINCT ?uri ?label ?hasChildren
WHERE {
  ?uri rdfs:subClassOf $node .
  ?uri rdfs:label ?label .  
  FILTER(lang(?label) = '' || lang(?label) = $lang)
  OPTIONAL {
       ?uri ^rdfs:subClassOf ?children .
  }
  BIND(IF(bound(?children),true,false) AS ?hasChildren)
}""" .

this works nice on DBPedia:

image

I will see if I integrate these datasources in the set of datasources provided out of the box by Sparnatural.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants