neuroshapes icon indicating copy to clipboard operation
neuroshapes copied to clipboard

Wrong way to specify or clause

Open umbreak opened this issue 7 years ago • 1 comments

In this line and this other the or clause is wrongly defined and it wouldn't validate against the SHACL schema.

Also happening in this schema.

From the SHACL spec:

When the or target different properties:

ex:OrConstraintExampleShape
	a sh:NodeShape ;
	sh:targetNode ex:Bob ;
	sh:or (
		[
			sh:path ex:firstName ;
			sh:minCount 1 ;
		]
		[
			sh:path ex:givenName ;
			sh:minCount 1 ;
		]
	) .

When it target different values of the same property:

ex:PersonAddressShape
	a sh:NodeShape ;
	sh:targetClass ex:Person ;
	sh:property [
		sh:path ex:address ;
		sh:or (
			[
				sh:datatype xsd:string ;
			]
			[
				sh:class ex:Address ;
			]
		)
	] .

umbreak avatar Aug 13 '18 08:08 umbreak

Hi, Thank you for looking at this. I'll use json-ld serialization to illustrate the issue you mentioned. The following payload is not correct as the 'or' clause is embedded in a sh:property:

{
          "property": [
            {
              "or": [
                {
                  "path": "schema:propertyID",
                  ...
                },
                {
                  "path": "schema:name",
                  ...
                }
              ]
            }
          ]
}

The correct shape for the 'or' clause is:


            {
              "or": [
                {
                  "path": "schema:propertyID",
                  ...
                },
                {
                  "path": "schema:name",
                  ...
                }
              ]
            }

MFSY avatar Aug 13 '18 13:08 MFSY