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

Proposal: prefix declarations in Jelly-RDF #12

Closed
4 tasks done
Ostrzyciel opened this issue Nov 22, 2024 · 2 comments · Fixed by #13
Closed
4 tasks done

Proposal: prefix declarations in Jelly-RDF #12

Ostrzyciel opened this issue Nov 22, 2024 · 2 comments · Fixed by #13
Assignees
Labels
new protocol feature Discussion about a new feature in the Jelly protocol

Comments

@Ostrzyciel
Copy link
Member

Ostrzyciel commented Nov 22, 2024

Many RDF serialization formats (e.g., Turtle, RDF/XML, some binary formats) have a way to preserve named prefix declarations. For example, in Turtle:

PREFIX stax: <https://w3id.org/stax/ontology#>

This is currently not possible in Jelly-RDF. Although we do have the prefix lookup table, this is not the same thing as a prefix declaration. Prefixes in the lookup table are arbitrary and only are there to improve the compression ratio, they also don't have names.

This proposal is to introduce such a functionality to Jelly-RDF.

Scope:

  • Add a new RdfStreamRow type: RdfPrefixDeclaration
  • To make this as frugal as possible, the prefix declarations should reuse our existing infrastructure for encoding IRIs. So, I think it would make sense for this message to have two fields:
    • name – string, short name of the prefix. This probably SHOULD correspond to the PN_PREFIX production in Turtle (colon not included!).
    • valueRdfIri message
      • 0-compression may be used here – this part of spec needs to be updated

Implementation:

  • Extend rdf.proto with the new message. Implement RdfNamespaceDeclaration #13
  • Update the specification to include the new message. Spec: version 1.1 draft (RdfNamespaceDeclaration) jelly-rdf.github.io#23
  • Make a new Jelly release – 1.1, binary version 2.
  • Implement this in Jelly-JVM, but keep the feature disabled by default (see compat notes below).
  • Compatibility:
    • Jelly-JVM will throw an exception when it encounters an unknown row type, so we cannot pretend this is the same version as 1.0. It will also by default not parse Jelly files with versions higher than the supported one.
    • This feature is very "optional" and will have a very slight negative impact on performance, so it should be always disabled by default. When it's disabled, we can label the file as written with Jelly 1.0.
    • Because we will disable this by default, but allow parsing both Jelly 1.0 and 1.1, this will create a soft grace period for consumers to be updated to the new version of the protocol.
    • This note about compatibility (i.e., 1.1 without prefix declarations = 1.0) should be included in the spec as the recommended behavior.

Motivation and related issues:

@Ostrzyciel Ostrzyciel added the new protocol feature Discussion about a new feature in the Jelly protocol label Nov 22, 2024
@Ostrzyciel
Copy link
Member Author

Maybe call this "namespace declarations" instead, to avoid confusion with the prefix lookup table. The "namespace" terminology is already used by RDF4J and rdflib (but not Jena), so it would make sense.

@Ostrzyciel Ostrzyciel self-assigned this Dec 19, 2024
Ostrzyciel added a commit that referenced this issue Dec 19, 2024
@Ostrzyciel Ostrzyciel linked a pull request Dec 19, 2024 that will close this issue
Ostrzyciel added a commit that referenced this issue Dec 19, 2024
* Implement RdfNamespaceDeclaration

Issue: #12
@Ostrzyciel Ostrzyciel reopened this Dec 19, 2024
Ostrzyciel added a commit to Jelly-RDF/jelly-rdf.github.io that referenced this issue Dec 20, 2024
Ostrzyciel added a commit to Jelly-RDF/jelly-jvm that referenced this issue Dec 21, 2024
Implementation of the new Jelly 1.1.0 feature, namespace declarations: Jelly-RDF/jelly-protobuf#12

Implemented: core API, Jena & RDF4J implementation, Jena RIOT & RDF4J Rio integrations, integration tests.

Not implemented: Pekko Streams API. This can be tackled in a separate PR.
@Ostrzyciel
Copy link
Member Author

All done, shipped in Jelly-JVM 2.4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new protocol feature Discussion about a new feature in the Jelly protocol
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant