Skip to content

Lessons of using sh:or  #10

Description

@zhurui0509

There are several ways of using sh:or in our shapes, the main two are:

sh:or (
		sh:property [
		    rdfs:comment "An Observation has to have at least one phenomenon time or result time."@en ;
			sh:path sosa:phenomenonTime ;
	 	sh:minCount 1 ; 
			] 

		sh:property [
		    rdfs:comment "An Observation has to have at least one phenomenon time or result time."@en ;
			sh:path sosa:resultTime ;
		 	sh:minCount 1 ;
			]	 
	) ;
     sh:or  (    
		    [
			sh:path sosa:phenomenonTime ;
		 	sh:minCount 1 ;
			] 
			[
			sh:path sosa:resultTime ;
			sh:minCount 1 ;
			] 		   
	 ) ;

I believe the correct way is 2 based on SHACL documentation. I tested it both using (1). GraphDB, (2). SHACL Playground, and (3). pyshacl. the 2 works for both (1) and (2). It does not work for pyshacl (i.e., need to have both, so it is like sh:and) probably because their implementation is not correct (has to deeply check and create an issue for them if so).

The 1 is also tested on (1), (2), and (3), none works.

So I removed sh:or from ObservationConstraint, and updated a TimeConstraint.ttl (for the sake of adding a rdfs:comment). It can then be applied to both Observation and ObservationCollection.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions