Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable the use of lang tags for langString #382

Open
Tracked by #384
VladimirAlexiev opened this issue Mar 11, 2024 · 3 comments
Open
Tracked by #384

enable the use of lang tags for langString #382

VladimirAlexiev opened this issue Mar 11, 2024 · 3 comments
Labels
RDF impact to RDF

Comments

@VladimirAlexiev
Copy link

VladimirAlexiev commented Mar 11, 2024

Similar to #284, both XML and RDF have a special means for attaching a lang tag; xml:lang and @lang.

In JSONLD, this is expressed as @value, @language and there are special ways to express a fixed lang tag, or organize JSON payload by lang (@collection: @language).
Doing it with a separate field is non-idiomatic use.

The types aas:LangStringPreferredNameTypeIec61360, aas:LangStringTextType are parasitic and useless:

  • there is already rdf:langString,
  • the distinction between the two types is already expressed by the incoming property

Instead of this:

  <https://admin-shell.io/aas/3/0/Referable/displayName> [
        rdf:type aas:LangStringNameType ;
        <https://admin-shell.io/aas/3/0/AbstractLangString/language> "de-CH"^^xs:string ;
        <https://admin-shell.io/aas/3/0/AbstractLangString/text> "something_1e73716d"^^xs:string ;
    ] ;
 <https://admin-shell.io/aas/3/0/DataSpecificationIec61360/preferredName> [
      rdf:type aas:LangStringPreferredNameTypeIec61360 ;
      <https://admin-shell.io/aas/3/0/AbstractLangString/language> "en-UK"^^xs:string ;
      <https://admin-shell.io/aas/3/0/AbstractLangString/text> "Something random in English 5b15c20d"^^xs:string ;
  ] ;

we want this:

  <https://admin-shell.io/aas/3/0/Referable/displayName>  "something_1e73716d"@de-CH;
  <https://admin-shell.io/aas/3/0/DataSpecificationIec61360/preferredName> "Something random in English 5b15c20d"@en-UK;
@BirgitBoss BirgitBoss added the RDF impact to RDF label Apr 20, 2024
@BirgitBoss
Copy link
Collaborator

How would you express the length restrictions for these two types?

@mhrimaz
Copy link
Contributor

mhrimaz commented Apr 21, 2024

aas:LangStringPreferredNameTypeIec61360, aas:LangStringTextType are not the source of issue in my opinion. The issue is that we introduce language attribute which is unnecessary. Of course, as I can already guess, this is because of schema generator.
In addition, when we incorporate @VladimirAlexiev suggestion, we can also leverage built-in language restrictions of SHACL like sh:languageIn

so instead of this:

  <https://admin-shell.io/aas/3/0/Referable/displayName> [
        rdf:type aas:LangStringNameType ;
        <https://admin-shell.io/aas/3/0/AbstractLangString/language> "de-CH"^^xs:string ;
        <https://admin-shell.io/aas/3/0/AbstractLangString/text> "something_1e73716d"^^xs:string ;
    ] ;
 <https://admin-shell.io/aas/3/0/DataSpecificationIec61360/preferredName> [
      rdf:type aas:LangStringPreferredNameTypeIec61360 ;
      <https://admin-shell.io/aas/3/0/AbstractLangString/language> "en-UK"^^xs:string ;
      <https://admin-shell.io/aas/3/0/AbstractLangString/text> "Something random in English 5b15c20d"^^xs:string ;
  ] ;

We can have the following:

  <https://admin-shell.io/aas/3/0/Referable/displayName> [
        rdf:type aas:LangStringNameType ;
        <https://admin-shell.io/aas/3/0/AbstractLangString/text> "something_1e73716d"@de-CH;
    ] ;
 <https://admin-shell.io/aas/3/0/DataSpecificationIec61360/preferredName> [
      rdf:type aas:LangStringPreferredNameTypeIec61360 ;
      <https://admin-shell.io/aas/3/0/AbstractLangString/text> "Something random in English 5b15c20d"@en-UK ;
  ] ;

For sure, having different types like aas:LangStringPreferredNameTypeIec61360, aas:LangStringTextType are only because of length restriction. So same as how we do it now with SHACL, even if we remove them, we can for sure still express such length constraints. So what is suggested by @VladimirAlexiev actually goes one step further and makes it even simpler.

@VladimirAlexiev
Copy link
Author

@BirgitBoss (cc @mhrimaz)
We don't need a parasitic node that only holds a langString, because the class of that node doesn't say anything more than the incoming property.

How would you express the length restrictions for these two types?

Easily, we can specify that in the prop shape.
You can search for these constructs in the Validation book https://book.validatingrdf.com/bookHtml011.html#sec142 :

aas-sh:SomeNodeShape # for each class that has these props:
  sh:property aas-sh:DisplayNameShape, aash-sh:PreferredNameShape.

aas-sh:DisplayNameShape a sh:PropertyShape;
  sh:path aas-ref:displayName; # or following the suggestion to reduce to just one namespace: aas:displayName
  sh:datatype rdf:langString;
  sh:maxLength 10.

aash-sh:PreferredNameShape a sh:PropertyShape;
  sh:path aas-ref:preferredName;
  sh:datatype rdf:langString;
  sh:maxLength 20.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RDF impact to RDF
Projects
None yet
Development

No branches or pull requests

3 participants