factsmission / dcat-ap-ch-shacl

SHACL shapes for the ECH-0200 standard
Other
1 stars 5 forks source link

sh:datatype instead of sh:class for schema:URL #11

Open SvenLieber opened 4 years ago

SvenLieber commented 4 years ago

I think the lines 227 and 363 of the SHACL shape are incorrect.

According to the shape how it is now the following data would be valid:

@prefix ex: <https://example.org/ns#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix schema: <https://schema.org/> .

ex:myDataset a dct:Dataset ;
  schema:image ex:imageURL .

ex:imageURL a schema:URL .

However, according to schema.org schema:URL is a datatype hence data using it should look like this:

@prefix ex: <https://example.org/ns#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix schema: <https://schema.org/> .

ex:myDataset a dct:Dataset ;
  schema:image "http://imageURL.com"^^schema:URL .

Thus the shape should state the constraint sh:datatype instead of sh:class in the mentioned lines.

retog commented 3 years ago

Hi @SvenLieber , sorry for the late reply. https://schema.org/image accepts as value both schema:URL and schema:ImageObject. The latter would be a (potentially) name resource, I believe this to be the better approach as it allows the image to be the subject of additional triples.

@prefix ex: <https://example.org/ns#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix schema: <https://schema.org/> .

ex:myDataset a dct:Dataset ;
  schema:image ex:imageURL .

ex:imageURL schema:caption "An awesome image"@en.
SvenLieber commented 3 years ago

Hi @retog thanks for your reply. Indeed, the use of schema:ImageObject allows to add more provenance information. But in case a data portal uses the schema:URL variant (or both) the snippet below would be compliant to the intended meaning of schema.org.

However, I also just saw now on a more detailed look that in your readme you actually mention that schema:URL is used as a class instead of a datatype because of the underlying eCH-0200 specification. Sorry, I didn't see that remark when opening the issue. Thus, feel free to close the issue :-)

  sh:property [
      sh:path schema:image ;
      sh:maxCount 3 ;
      sh:severity sh:Violation ;
      sh:or (
            [
                sh:datatype schema:URL ;
            ]
            [
                sh:class schema:ImageObject ;
            ]
        )
    ] ;