Replies: 4 comments 1 reply
-
|
Ok here is my take on the subject. For me the main use case is the user facing applications. A typical scenario is that the user selects their preferred languages in the app settings. These preferences are communicated to the LinkML runtime. Also, we still using unchanged existing LinkML schemas with regular string type for string that is mapped to appropriate type in the application language for example This is how the loader will work:
Here is the code with an example, test case and modifications to the Pydantic RDF loader, this is just a proposal / experiment that probably needs lot more work. Something to keep the discussion going and to solve my immediate problem: |
Beta Was this translation helpful? Give feedback.
-
|
And this is how it would look for developer. Note that the 'Grass' is returned when user first preference is Turkish, because dataset does not have Turkish lang strings, but it does return 'Pflanze' when first preferred language is German |
Beta Was this translation helpful? Give feedback.
-
|
@satra - this is related to our use of multi-language in reproschema, so you can take a look, when you're back |
Beta Was this translation helpful? Give feedback.
-
|
I'll look forward to the finalized guidance for LinkML use of rdf:langString . This isn't quite on-topic to JSON-LD, but I'll note that to enable an application such as our DataHarmonizer to access multilingual versions of a LinkML schema itself for display in interface help, labels, descriptions, picklists, we've used the LinkML "extension" to add a mirror language locale overlay of the original (english) LinkML schema like so: If the community moved to documentiong data or linkml component locales using some rdf:langString, then we could compile this extension locale view for each JSON-LD content locale item; or conversely take the extension locales and build JSON-LD content locale items out them. This keeps multilingual content management of schemas REALLY simple BTW. In DataHarmonizer (upcoming release) a separate multilingual editor layer manages this hierarchy of text by enabling language versions for every pertinent textual field of original schema (only locale:fr is shown above). Essentially for an available language that user chooses, the entire interface is converted to say french simply by overlaying the french text onto the english schema above. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
JSON-LD has already tackled the problem of mapping between tree structures and language-aware RDF. There are 3 idioms
JSON-LD Idioms
1 Language in Context
{ "@context": { "title": "http://schema.org/name", "@language": "en" }, "@id": "http://example.org/book1", "title": "War and Peace" }==>
2 Language-tagged string objects
{ "@context": { "title": { "@id": "http://schema.org/name", "@container": "@language" } }, "@id": "http://example.org/book1", "title": { "en": "War and Peace", "fr": "Guerre et Paix", "ru": "ΠΠΎΠΉΠ½Π° ΠΈ ΠΌΠΈΡ" } }==>
3. Explicit value objects instance
{ "@context": { "@vocab": "http://schema.org/" }, "@id": "http://example.org/book3", "title_values": [ { "@value": "Don Quixote", "@language": "en" }, { "@value": "Don Quijote", "@language": "es" } ] }==>
Note there is no 4th idiom that allows you to write
"hello@en:"and have it be treated as a language tagMapping to LinkML
3 Explicit value objects instance
Some schemas do have explicit value objects instances, e.g. reproNim
https://github.com/ReproNim/reproschema/blob/ac35394773e66e2aab8a3d26e4acce1fabb1ce63/linkml-schema/reproschema.yaml#L493-L497
https://github.com/ReproNim/reproschema/blob/ac35394773e66e2aab8a3d26e4acce1fabb1ce63/linkml-schema/reproschema.yaml#L187-L197
it uses the convention of using rdf:langString as the class_uri, which is a good one:
However, the linkml core does not know of this convention. Also we need a convention to map each of the slots to
@languageand@valueLinkML requirement:
2 Language-tagged string objects
Requirements are the same as for (3), use standard linkml mechanisms to map to dicts
1 Language in Context
Conceptually simple. However, there is no direct analog of
@context.Proposal
Provide a general purpose way to map LinkML slots to JSON-LD
@tags, at schema time, and at run time.For 1:
Consideration: any_of ranges
It's common in rdf docs (and JSON-LD serializations) for the value for the same property to be a mix of simple strings and langStrings. In this case standard any_of ranges can be introduced by the schema author.
Consideration: Dynamic injection
A variant of 1, where the interpretation of an atomic string is interpreted at runtime
Consideration: Multilingual schemas
In LinkML, schemas are data that instantiate the linkml metamodel, so any solution that works for data should work for
alternative proposals considered
Mapping types to rdf:langString
https://github.com/orgs/linkml/discussions/2199
This is a good proposal but linkml types are primitive and for cases 2 and 3, the representation at the tree level has to be an object (unless we go with 4, which is not a json-ld idiom)
Beta Was this translation helpful? Give feedback.
All reactions