From fe3b1ee29c9e2ca771fc76b8d95fa0a16df0c8ca Mon Sep 17 00:00:00 2001 From: Ostrzyciel Date: Thu, 19 Dec 2024 11:30:03 +0100 Subject: [PATCH 1/2] Implement RdfNamespaceDeclaration Issue: #12 --- rdf.proto | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/rdf.proto b/rdf.proto index 1f43836..7902a1e 100644 --- a/rdf.proto +++ b/rdf.proto @@ -2,8 +2,8 @@ syntax = "proto3"; package eu.ostrzyciel.jelly.core.proto.v1; // Jelly RDF serialization with Protocol Buffers. -// Specification document: https://w3id.org/jelly/1.0.0/specification/serialization -// Protocol version: 1.0.0 +// Specification document: https://w3id.org/jelly/1.1.0/specification/serialization +// Protocol version: 1.1.0-alpha.1 // RDF IRIs // The IRIs are reconstructed by the consumer using the prefix and name @@ -192,6 +192,25 @@ message RdfGraphStart { message RdfGraphEnd { } +// Explicit namespace declaration +// +// This does not correspond to any construct in the RDF Abstract Syntax. +// Rather, it is a hint to the consumer that the given IRI prefix (namespace) +// may be associated with a shorter name, like in Turtle syntax: +// PREFIX ex: +// +// These short names (here "ex:") are NOT used in the RDF statement encoding. +// This is a purely cosmetic feature useful in cases where you want to +// preserve the namespace declarations from the original RDF document. +// These declarations have nothing in common with the prefix lookup table. +message RdfNamespaceDeclaration { + // Short name of the namespace (e.g., "ex") + // Do NOT include the colon. + string name = 1; + // IRI of the namespace (e.g., "http://example.org/") + RdfIri value = 2; +} + // Entry in the name lookup table message RdfNameEntry { // 1-based identifier @@ -204,6 +223,11 @@ message RdfNameEntry { } // Entry in the prefix lookup table +// +// Note: the prefixes in the lookup table can be arbitrary strings, and are +// NOT meant to be user-facing. They are only used for IRI compression. +// To transmit user-facing namespace declarations for cosmetic purposes, use +// RdfNamespaceDeclaration. message RdfPrefixEntry { // 1-based identifier // If id=0, it should be interpreted as previous_id + 1. @@ -247,6 +271,7 @@ message RdfStreamOptions { LogicalStreamType logical_type = 14; // Protocol version (required) // For Jelly 1.0.x value must be 1. + // For Jelly 1.1.x value must be 2. // For custom extensions, the value must be 10000 or higher. uint32 version = 15; } @@ -331,6 +356,8 @@ message RdfStreamRow { // Signals the consumer that the transmitted graph is complete. // Only valid in streams of physical type GRAPHS. RdfGraphEnd graph_end = 5; + // Explicit namespace declaration. + RdfNamespaceDeclaration namespace = 6; // Entry in the name lookup table. RdfNameEntry name = 9; // Entry in the prefix lookup table. From 82c6de51907fef2362531b54dd052a232afa649b Mon Sep 17 00:00:00 2001 From: Ostrzyciel Date: Thu, 19 Dec 2024 11:33:21 +0100 Subject: [PATCH 2/2] Fix linter errors --- CONTRIBUTING.md | 2 ++ rdf.proto | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6d0209e..bcf2c00 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1 +1,3 @@ +# Contributing + **Please see the [contribution guide on the Jelly website](https://w3id.org/jelly/dev/contributing/).** Thanks! diff --git a/rdf.proto b/rdf.proto index 7902a1e..beb8c25 100644 --- a/rdf.proto +++ b/rdf.proto @@ -2,7 +2,8 @@ syntax = "proto3"; package eu.ostrzyciel.jelly.core.proto.v1; // Jelly RDF serialization with Protocol Buffers. -// Specification document: https://w3id.org/jelly/1.1.0/specification/serialization +// Specification document: +// https://w3id.org/jelly/1.1.0/specification/serialization // Protocol version: 1.1.0-alpha.1 // RDF IRIs