Re: uniqueLang and minCount

Hi!

Each skos:Concept must have:
   1) at least 1 skos:prefLabel
   2) max 1 skos:prefLabel per language
   3) max 1 skos:prefLabel without language tag

Each skos:prefLabel is either of type xsd:string or rdf:langString .

---->

:shape
    a sh:NodeShape ;
    sh:targetClass skos:Concept ;
    sh:property [
       sh:path skos:prefLabel ;
       sh:minCount 1 ;
       sh:uniqueLang true ;
       sh:qualifiedMaxCount 1 ;
       sh:qualifiedValueShape [ sh:datatype xsd:string ]
    ] .

:prefLabelShape
    a sh:NodeShape ;
    sh:targetObjectsOf skos:prefLabel ;
    sh:or (
       [ sh:datatype xsd:string ]
       [ sh:datatype rdf:langString ]
    ) .


br, simon

---
DDipl.-Ing. Simon Steyskal
Institute for Information Business, WU Vienna

www: http://www.steyskal.info/  twitter: @simonsteys

Am 2017-06-01 00:53, schrieb Florian Kleedorfer:
> Hi,
> 
> Thanks for this riddle - I'm new to SHACL and it got me curious. Two
> tricks: 1. without language, the value is sh:datatype xsd:string. 2.
> You are not restricting ALL values with a property shape, only SOME
> values with one shape and SOME with another, so you can't use sh:and
> (or sh:or or sh:xone), you have to use the sh:qualifiedValueShape
> feature.
> 
> Took me some time to figure that out because I tried with
> sh:or/and/xone. I did not find the definition of sh:or/and/xone in the
> spec too helpful. It says 'sh:or specifies the condition that each
> value node conforms to at least one of the provided shapes.' But I
> would have been much faster solving this if it had sad 'sh:or
> specifies the condition that the set of all value nodes conforms to at
> least one of the provided shapes'
> 
> Anyway, here's the shape graph:
> 
> @prefix skos:   <http://www.w3.org/2004/02/skos/core#> .
> @prefix sh:  <http://www.w3.org/ns/shacl#> .
> @prefix xsd:    <http://www.w3.org/2001/XMLSchema#> .
> @prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
> @prefix :       <http://example.com/ex#> .
> 
> :shape
>         a sh:NodeShape ;
>         sh:targetNode :target;
>         sh:property [
>             sh:path  skos:prefLabel ;
>             sh:qualifiedValueShapesDisjoint true ;
>             sh:qualifiedMaxCount 1 ;
>             sh:qualifiedValueShape [ sh:datatype xsd:string ]
>         ];
>         sh:property [
>             sh:path skos:prefLabel ;
>             sh:qualifiedValueShapesDisjoint true ;
>             sh:uniqueLang true ;
>             sh:qualifiedValueShape [ sh:datatype rdf:langString ]
>         ].
> 
> data graph:
> 
> @prefix skos:   <http://www.w3.org/2004/02/skos/core#> .
> @prefix sh:  <http://www.w3.org/ns/shacl#> .
> @prefix xsd:    <http://www.w3.org/2001/XMLSchema#> .
> @prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
> @prefix :       <http://example.com/ex#> .
> 
> :target
>     skos:prefLabel             "Tree" ;
>     skos:prefLabel             "Arbre"@fr ;
>     skos:prefLabel             "Tree"@en ;
>     skos:prefLabel             "Baum"@de.
> 
> HTH,
> Florian
> 
> Am 2017-05-31 21:32, schrieb Håvard Mikkelsen Ottestad:
>> Hi,
>> 
>> I’m trying to make shapes for DCAT and one of things I have run into
>> is trying to force things to have skos:prefLabel such that:
>> 
>>   * There is max one per language
>>  * And max one without language
>> 
>> I can solve the first one with sh:uniqueLang, but how do I solve the
>> second?
>> 
>> Regards,
>> 
>> Håvard M. Ottestad

Received on Thursday, 1 June 2017 05:41:31 UTC