sparna-git / Sparnatural

Sparnatural : Typescript visual SPARQL query builder for knowledge graphs, configurable with SHACL
http://sparnatural.eu
GNU Lesser General Public License v3.0
206 stars 34 forks source link

SHACL config: property paths and blank nodes #603

Closed CFGrote closed 2 weeks ago

CFGrote commented 3 weeks ago

In the wake of #602, I now observe the following behaviour:

My shacl config;

...

shapes:SO_0000316 rdf:type owl:NamedIndividual ,
    sh:NodeShape ;
    rdfs:label "CDS"@en ;
    rdfs:comment "Coding DNA Sequence"@en ;
    sh:property shapes:SIO_001166 ;                      # annotation
    sh:targetClass <http://purl.obolibrary.org/obo/SO_0000316> ;
    volipi:iconName "fa-solid fa-dna" .

shapes:SIO_001166
    sh:name      "annotation"@en ;
    sh:node       shapes:Go_term ;
    sh:path      (<http://semanticscience.org/resource/SIO_001166> <http://www.w3.org/ns/hydra/core#member>) .

shapes:GO_term rdf:type sh:NodeShape , owl:NamedIndividual ;
    sh:name "Go annotation" ;
    sh:nodeKind sh:Literal ; 
    volipi:iconName "fa-solid fa-gopuram" ;
    sh:property shapes:name , shapes:data_2091 , shapes:IAO_0000115 .

shapes:name
    sh:maxCount  1 ;
    sh:minCount  1 ;
    sh:name      "name"@en ;
    sh:path      <https://schema.org/name> .

shapes:data_2091
    sh:maxCount  1 ;
    sh:minCount  1 ;
    sh:name      "ID"@en ;
    sh:path      <http://edamontology.org/data_2091> .

shapes:IAO_0000115
    sh:name "definition"@en ;
    sh:path obo:IAO_0000115 .

Explanation:

Property shape shapes:SIO_001166 relates NodeShape shapes:SO_0000316 to NodeShape shapes:GO_term via a two part property path. The sh:targetClass of shapes:GO_term is undefined (actually a BlankNode).

The problem is that the generated sparql query contains a ?GO_term rdf:type shapes:GO_term . clause, which is not matched in the queried graph since the targeted object is a BN. Previously, I was able to fix this kind of problem through the nodeKind sh:Literal property on the NodeShape. Am I doing it wrong here or is it a problem related to the multipart property path?

Screenshot: image

Removing line 5 from the query then produces the expected results: image

tfrancart commented 3 weeks ago

I confirm the issue. Nothing to do with the property path. Something weird is going on with n3store, maybe a dependency upgrade issue.

tfrancart commented 3 weeks ago

The config is buggy. You have

shapes:SIO_001166
    sh:name      "annotation"@en ;
    sh:node       shapes:Go_term ;

(lowercase "o" in "Go_term")

but you have

shapes:GO_term rdf:type sh:NodeShape , owl:NamedIndividual ;

(uppercase "O" in GO_term)

CFGrote commented 2 weeks ago

Thanks for catching @tfrancart . That seems to solve it.