ISSUE-137: Proposal to add sh:langShape

I was given the task of writing up sh:langShape today. I already did a 
few months back:

https://lists.w3.org/Archives/Public/public-data-shapes-wg/2016Mar/0262.html

 From the list of requirements at

https://www.w3.org/2014/data-shapes/wiki/Proposals#ISSUE-137_Missing_constraint_for_language_tag

  * In SKOS, there can be only one prefLabel per language tag

Already exists: sh:uniqueLang true

  * Constrain the valid language tags to a provided set, e.g. (@en, @de,
    @fr)

See my email, sh:langShape [ sh:in ( "en" "de" "fr" ) ]

  * Require that all literals have/do not have a language tag

Already exists: sh:datatype rdf:langString

  * Require that a particular property have a set of literals, one each
    language tag, e.g. "there must be 3 instances of dct:abstract; the
    values must be literals; there must be one literal for each valid
    language code (@en, @de, @fr)"

Can be expressed through a combination of sh:minCount = 3, sh:maxCount = 
3, sh:uniqueLang. (What are "instances of dct:abstract"?)

  * Check that the language tag is 2-letter | 3-letter | does/does not
    have hyphens

sh:langShape [ sh:minLength 2 ; sh:maxLength 2 ; or: sh:pattern "... 
regex ..." ]

  * Check that the 2 or 3-letter tag is valid


Assuming that the list of valid tags is stored somewhere, e.g. in an 
rdf:List iso:ValidLanguages:

sh:langShape [ sh:in iso:ValidLanguages ]

I don't think maintaining such a list ourselves is within the scope of 
the WG, yet it could be expressed in the Core language.


PROPOSAL: Add sh:langShape as outlined. Meaning: if a value node has a 
language tag then the string of the language tag itself needs to have 
the given sh:Shape.


Holger

Received on Friday, 9 September 2016 00:59:26 UTC