Skip to content

Commit

Permalink
Implement RdfNamespaceDeclaration
Browse files Browse the repository at this point in the history
Issue: #12
  • Loading branch information
Ostrzyciel committed Dec 19, 2024
1 parent b9d9cbf commit fe3b1ee
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions rdf.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: <http://example.org/>
//
// 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
Expand All @@ -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.
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit fe3b1ee

Please sign in to comment.