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

oneOf types and value enumerations #86

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

timothee-haudebourg
Copy link
Collaborator

@timothee-haudebourg timothee-haudebourg commented Dec 1, 2022

Introduces value enumerations, a new enumeration layout for oneOf types that defines a surjection from the layout domain to the type domain.

For instance:

type T = { "Foo" => Foo, "Bar" => Bar }

This TreeLDR model defines

  • the type { Foo, Bar } containing the two instances Foo and Bar.
  • the layout { "Foo", "Bar" } containing the two string values "Foo" and "Bar".

Wildcard item.

type T = { "Foo" => Foo, "Bar" => Bar, * : tldr:String => rdfs:Class }

This TreeLDR model defines

  • the type rdfs:Class that includes the two members Foo and Bar.
  • the layout tldr:String with two outstanding values "Foo" and "Bar".

Advantages for the LD context generation.

For now the expected value of "@type" terms and the name of type scoped contexts is ill defined. By default type scoped contexts are not generated. It is enabled by the "hacky" --rdf-type-to-layout-name that allow the context generator to use layout names as term for type scoped contexts, even though it is not specified in the model.

Using value enumerations we could generate type scoped contexts consistently with the model definiton. For intstance:

layout Foo for T {
  rdf:type as "@type": required multiple &rdfs:Class,
  ex:prop: xsd:integer
}

would not generate a type scoped context since the IRI of T is expected for as "@type". However:

layout Foo for T {
  rdf:type as "@type": required multiple { "TermForFoo" => T, * : tldr:String => rdfs:Class },
  ex:prop: xsd:integer
}

would generate a type scoped context under the "TermForFoo" term like so:

{
  "TermForFoo": {
    "@id": "https://example.com/T",
    "@context": {
      "prop": "https://example.com/prop"
    }
  }
}

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

Successfully merging this pull request may close these issues.

None yet

1 participant