-
Notifications
You must be signed in to change notification settings - Fork 8
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
YAML-LD IRI tags #79
Comments
I fully support the proposal to have a tag for IRIs.
|
We would need to define it. IIUC,
IIRC, that page defines "Language-Independent Types" using the
Section 5.5 on Converting a YAML scalar indicates using the Core Schema. Again, no discussion – as yet – of local tags.
YAML tags already use an expression for URIs, although possibly not completely compatible, and with implementation issues for things like '#'. For dealing with values with the proposed node-tag
|
@gkellogg I think the problem is not "local vs global" tags. %TAG ! tag:yaml.org,2002:
---
name: !str Gregg Kellogg
float: !float 1.235609853907835079889067406870964870956870967908
date: !timestamp 2022-08-08 I think the problem is that parsers don't know about our desired/intended tags, such as |
Yes, but the purpose of this tool does seem to be converting YAML to JSON, which, of course, is limited to JSON datatypes. The Extended Internal Representation, which might contain IRIs, but also RDF literals with datatypes, is outside of the JSON data model, thus the need to either map it to something that extends that data model, or encodes the values using something like JSON-LD value objects. Leveraging a tool such as https://onlineyamltools.com/convert-yaml-to-json might not be directly useful for doing this, but lower-level tools, such as https://github.com/yaml/libyaml can use non-default tags.
There are parsers (many flawed) that can represent arbitrary scalars with node tags outside of the default set, otherwise, what would be the value in YAML allowing the use of We have the YAML-LD-JSON profile specifically for dealing with these standard types, the purpose of the extended profile is to allow for more use of YAML features, and likely limits the use of off-the-shelf tools – specifically those intended for transforming straight to JSON. Otherwise, do you have thoughts on what an extend profile might do beyond the straight JSON transliteration case? |
This comment was marked as resolved.
This comment was marked as resolved.
@gkellogg I completely agree with you: we shouldn't be straight-jacketed into a particular parser. Our extended profile should demand a more powerful parser that allows custom tags. This YAML '@context': {id: '@id', knows: '@id'}
id: gkellogg
knows: vladimir
alsoKnows: !id anatoly
birthDate: !xsd!date 1960-01-01 should be converted to this JSON "@context": {"id": "@id", "knows": "@id"},
"id": "gkellogg",
"knows": "vladimir",
"alsoKnows": {"@type": "@id", "@value": "anatoly"},
"birthDate": {"@type": "xsd:date", "@value": "1960-01-01"} |
The so-called "extended" profile of YAML-LD makes use of YAML's tag mechanism to cause values to be interpreted as RDF literals with a datatype coming from the expanded tag (or language, through restricted use of the
i18n
namespace). This is particularly useful for environments where fetching a remote context remains an issue. What this doesn't provide for is a way to natively represent IRIs and Blank Nodes. Currently, this requires using a new node object:If "homepage" were defined with
"@type": "@id"
in a term definition, the indirection through a node object isn't required.As IRIs don't have their own datatypes, the use of the YAML node tag mechanism, where the tag is a URI becomes semantically problematic, but YAML allow the use of local tags, and we could consider defining such a tag to be interpreted by YAML-LD processors (operating in extended mode). For example:
This would cause a YAML-LD processor to interpret values tagged with the
!id
local tag to be interpreted as either an IRI or blank node, similar to how values of the@id
key in JSON-LD are interpreted, but avoids the indirection through a node object by extending the internal representation to be able to represent IRIs and Blank Nodes as scalar values, in addition to RDF literals, strings, numbers, boolean and null.The text was updated successfully, but these errors were encountered: