KnowWhereGraph / KWG-SHACL

This is the repository of SHACL shapes development/research for KWG.
1 stars 1 forks source link

SHACL in GraphDB does not recognize the property shape we wrote! #8

Open zhurui0509 opened 2 years ago

zhurui0509 commented 2 years ago

Even though we tested the property shape in https://shacl.org/playground/, when upload the property shape to GraphDB, we encounter errors:

http://stko-kwg.geog.ucsb.ed/sosa-shacl/observedPropertyRangeConstraint is a sh:PropertyShape without a sh:path!

I then tried to add sh:path to the shape like:

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix sosa: <http://www.w3.org/ns/sosa/> .
@prefix sosa-shacl: <http://stko-kwg.geog.ucsb.ed/sosa-shacl/> .
@prefix time: <http://www.w3.org/2006/time#> .

### Shapes for property sosa:observedProperty
sosa-shacl:observedPropertyDomainConstraint 
    a sh:PropertyShape ;
    sh:targetSubjectsOf sosa:observedProperty ;
        sh:path sosa:observedProperty ;
    rdfs:comment "We restrict the domain of sosa:observedProperty to sosa:Observation" ;
    sh:class    sosa:Observation .

And use it on sample data:

@prefix ex: <http://example.org/ns#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <http://schema.org/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix sosa-shacl: <http://stko-kwg.geog.ucsb.ed/sosa-shacl/> .
@prefix sosa: <http://www.w3.org/ns/sosa/> .

ex:obs1 a sosa:Observation ;
       sosa:observedProperty ex:obsprop1 .

ex:sensor2 a sosa:Sensor ;
     sosa:observedProperty ex:obsprop2 .

It will show that obs1 violates the shape (for both shacl playground and GraphDB), even though it should not. So I assume it means the shape is incorrect.

Any help on it would be appreciated!

zhurui0509 commented 2 years ago

Tested it in PySHACL, same error. Check https://github.com/KnowWhereGraph/KWG-SHACL/blob/main/test/pySHACL_test.ipynb.

It means that our property shape is invalid!

cogan-shimizu commented 2 years ago

Do all property shapes fail in this manner?

zhurui0509 commented 2 years ago

Yes. Tested on madeBySensor as well. Same error.