IS4
IS4

Reputation: 13217

Marker for an end of description in an RDF stream

Imagine a service that produces an infinite stream of descriptions of natural numbers (could be some log messages or other endless collection of events):

<0> a ex:Number ;
  ex:isEven true .

<1> a ex:Number .

<2> a ex:Number ;
  ex:isEven true .

<3> a ex:Number .

# And so on

The problem is turning this sequence of triples into another sequence, for example in JSON, XML or HTML, that lists the numbers in order. The issue is that not every property may appear in the description of a number, of example ex:isEven could be omitted, so I cannot simply wait for it to appear in the results (as it may never appear). It would also be unreliable to see if the subject of triples changes, as an equally valid format would be:

<0> a ex:Number .
<1> a ex:Number .
<0> ex:isEven true .

<2> a ex:Number .
<3> a ex:Number .
<2> ex:isEven true .

# And so on

Is there a standard mechanism (with HTTP, RDF/XML etc.) for specifying that some node is "closed" i.e. that it cannot for example appear as a subject in any following triple? This would make sure that I do not have to rely on heuristics to see if I the information I have about a resource is complete.

Something like this:

<0> a ex:Number ;
  ex:isEven true .
@done <0> .

<1> a ex:Number .
@done <1> .

One possible method is to use blank nodes, which don't have to be assigned an identifier in RDF/XML or Turtle:

[ a ex:Number ;
  rdf:value 0 ;
  ex:isEven true ] .

[ a ex:Number ;
  rdf:value 1 ] .

This is fine, but what if URI nodes are to be used instead?

Upvotes: 0

Views: 31

Answers (1)

Jeen Broekstra
Jeen Broekstra

Reputation: 22052

There is, to the best of my knowledge, no such mechanism (certainly not anything standardized, and I haven't seen such a thing in any custom tools either to be honest).

Your options are to either make sure that the source emits the sequence in the expected order, or to have your sequence convertor buffer (up to some sensible "it probably won't come after I've waited this long") out-of-sequence items.

Upvotes: 2

Related Questions