Skip to content

How to use RDF-STaX?

RDF stream type usage is often a subjective matter, so RDF-STaX provides facilities for making subjective assertions about RDF stream types. For example: I see this resource as an RDF graph stream, because (...), as opposed to strict, universal classification. The types in RDF-STaX are semantically related, allowing you to reason about them.

The assertions can be made by anyone, anywhere. You can use RDF-STaX to annotate published streams, datasets, research papers, software, and more.

Annotating RDF stream types

Making a statement about something's RDF stream type is very straightforward. For example, to say that <> is an RDF graph stream, you would use the stax:RdfStreamTypeUsage class:

@prefix stax: <> .

_:usage a stax:RdfStreamTypeUsage ;
    stax:hasStreamType stax:graphStream ;
    stax:isUsageOf <> .

It is recommended (but not required) to have one stax:RdfStreamTypeUsage instance per annotated resource and per RDF stream type. This makes it easier to find all the annotations for a given resource or stream type.

You can also make the statement in reverse, by annotating the resource itself. This can be especially useful when annotating RDF streams on the Web or in a dataset. The following three examples illustrate combining RDF-STaX with other vocabularies for describing datasets and streams (VoCaLS, VoID, DCAT, LDES). RDF-STaX here plays the role of a bridge between the different ontologies, providing a way to describe stream types in a universal manner.

Example: VoCaLS RDFStream (click to expand)

To annotate a vocals:RDFStream from the VoCaLS Vocabulary:

@prefix stax: <> .
@prefix vocals: <> .

_:stream a vocals:RDFStream ;
    # ... other properties of the stream ...
    stax:hasStreamTypeUsage [
        a stax:RdfStreamTypeUsage ;
        stax:hasStreamType stax:graphStream
    ] .

VoCaLS defines vocals:RDFStream as "a stream composed of RDF data elements, i.e. RDF graphs and/or triples". Instances of this class can be thus annotated as RDF graph stream or flat RDF triple streams.

Example: VoID Dataset (click to expand)

To annotate a void:Dataset from the VoID Vocabulary:

@prefix stax: <> .
@prefix void: <> .

_:dataset a void:Dataset ;
    # ... other properties of the dataset ...
    stax:hasStreamTypeUsage [
        a stax:RdfStreamTypeUsage ;
        stax:hasStreamType stax:flatTripleStream
    ] .

In VoID, void:Dataset refers to a set of triples, which can be viewed as a flat RDF triple stream.

Example: DCAT Distribution (click to expand)

In DCAT, a dataset may have multiple representations (dcat:Distribution). Thus, tou may want to annotate the distribution, not the dataset itself:

@prefix dcat: <> .
@prefix stax: <> .

_:dataset a dcat:Dataset ;
    # ... other properties of the dataset ...
    dcat:distribution [
        a dcat:Distribution ;
        # ... other properties of the distribution ...
        stax:hasStreamTypeUsage [
            a stax:RdfStreamTypeUsage ;
            stax:hasStreamType stax:datasetStream
    ] .

Of course, annotating the dataset itself also makes sense, if you want to make a statement about the dataset as a whole.

In DCAT, all RDF stream types from RDF-STaX are applicable, depending on the content of the dataset.

Example: LDES EventStream (click to expand)

In Linked Data Event Streams (LDES) the ldes:EventStream is a collection of stream elements – sets of RDF triples. Each element is identified with its subject node. Therefore, instances of this class can be annotated in RDF-STaX as RDF subject graph streams.

@prefix ldes: <> .
@prefix stax: <> .

_:stream a ldes:EventStream ;
    # ... other properties of the stream ...
    stax:hasStreamTypeUsage [
        a stax:RdfStreamTypeUsage ;
        stax:hasStreamType stax:subjectGraphStream
    ] .

Adding more information

The stax:RdfStreamTypeUsage instance is a good place to put additional information about the usage, such as a textual explanation, the source of the information, or the author of the statement. For example:

@prefix cito: <> .
@prefix dcterms: <> .
@prefix rdfs: <> .
@prefix stax: <> .

_:usage a stax:RdfStreamTypeUsage ;
    rdfs:comment "The authors state that for their proposed system, 'the streaming element (i.e. a single message) (...) is a set of triples'. Therefore, internally it uses an RDF graph stream."@en ;
    stax:hasStreamType stax:graphStream ;
    stax:isUsageOf <> ;
    cito:citesAsEvidence <> ;
    dcterms:creator <> .

You can use whatever properties you like, however, the following are recommended:

  • CiTO ontology for typing the citations.
  • DCMI Metadata Terms for the statement author information.
  • rdfs:comment for the textual explanation.
  • For statement creators, we recommend using ORCID.
  • For research works, we recommend using DOI.

These rich annotations are used in RDF-STaX nanopublications.

Making RDF stream type usage nanopublications

This subjective style of RDF-STaX meshes very well with the idea of nanopublications, small snippets of scientific knowledge. See the documentation page on nanopublications for more information on how to find, use, and create them.

Using semantic relations from the ontology

The ontology includes several semantic relations between the RDF stream types. You can use them to reason about the types – for example can stream of type X be flattened into type Y?

  • skos:broader and skos:narrower – properties indicating sub- and super-types of streams.
  • stax:canBeFlattenedInto – property indicating that a stream of type X can be flattened into a stream of type Y. For example, a stax:graphStream can be flattened into a stax:flatTripleStream.
  • stax:canBeGroupedInto – property indicating that a stream of type X can be grouped into a stream of type Y. For example, a stax:flatQuadStream can be grouped into a stax:datasetStream.
  • stax:canBeTriviallyExtendedInto – property indicating that a stream of type X can be trivially turned into a stream of type Y, by explicitly adding the graph component (default graph). For example, a stax:flatTripleStream can be trivially extended into a stax:flatQuadStream.

These semantic relations are used in RiverBench to validate the stream type annotations.

Example SPARQL queries

The competency question tests provide examples of SPARQL queries that can be used with the RDF-STaX ontology.

See also