Skip to content

Competency question tests

The following competency question tests are based on the use cases of RDF-STaX. The tests are implemented as SPARQL queries and are used in Continuous Integration (CI) to test the RDF-STaX ontology whenever any change to it is made. The following list is generated automatically based on the tests defined in the main RDF-STaX repository. The tests are run on the OWL 2 Full version of the ontology, which includes all metadata and alignments to external ontologies.

These tests can also be used as examples of what can be done with the RDF-STaX ontology.

The documentation for creating new tests is available here.

Use case 1

Annotating published datasets and streams. In this use case, RDF-STaX's stream types are used as metadata of published RDF datasets or streams, for example on the Internet. This published metadata is intended for the various users to understand the content of the stream. The usage manual has several examples for this type of usage.

Test CQ1.1 (definition)

Question: What are the names and descriptions of all RDF stream types?

Expectation: there are 10 query results

SPARQL query of the test
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX stax: <https://w3id.org/stax/ontology#>

SELECT * WHERE {
    ?streamType a/rdfs:subClassOf* stax:RdfStreamType ;
        skos:prefLabel ?label ;
        skos:note ?note .
}

Test CQ1.2 (definition)

Question: What is the definition for each stream type?

Expectation: there are 10 query results

SPARQL query of the test
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX stax: <https://w3id.org/stax/ontology#>

SELECT * WHERE {
    ?streamType a/rdfs:subClassOf* stax:RdfStreamType ;
        skos:definition ?definition .
}

Test CQ1.3 (definition)

Question: What is the type of element of each concrete stream type? Provide additional references to external sources for each element type, if available.

Expectation: there are 7 query results

SPARQL query of the test
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX stax: <https://w3id.org/stax/ontology#>

SELECT * WHERE {
    ?streamType a stax:ConcreteRdfStreamType ;
        stax:hasElementType ?elementType .

    OPTIONAL {
        ?elementType skos:relatedMatch ?reference .
    }
}

Test CQ1.4 (definition)

Question: How can each of the concrete stream types be used? Provide a link to one example for each.

Expectation: there are 7 query results

SPARQL query of the test
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX stax: <https://w3id.org/stax/ontology#>

SELECT ?streamType (SAMPLE(?example) as ?anyExample) WHERE {
    ?streamType a stax:ConcreteRdfStreamType ;
        skos:example ?example .
}
GROUP BY ?streamType

Test CQ1.5 (definition)

Question: What are the corresponding terms from other ontologies to those defined in the RDF-STaX ontology?

Expectation: there are 6 query results

SPARQL query of the test
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX stax: <https://w3id.org/stax/ontology#>

SELECT * WHERE {
    ?staxTerm skos:relatedMatch ?externalTerm .
}

Use case 2

Embedding metadata in RDF streams. This use case is focused on stream type metadata, with the goal of enabling streaming tool interoperability. For example, a consumer of the stream can check the type of the stream and decide whether it can consume it or not (and if any additional conversions are required).

Test CQ2.1 (definition)

Question: Which concrete stream types can be viewed as generalizations of other stream types?

Expectation: there are 4 query results

SPARQL query of the test
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX stax: <https://w3id.org/stax/ontology#>

SELECT * WHERE {
    ?broaderStreamType a stax:ConcreteRdfStreamType ;
        skos:narrower+ ?narrowerStreamType .
}

Test CQ2.2 (definition)

Question: Which concrete stream types can be trivially extended (by assuming the default graph) into other stream types?

Expectation: there are 3 query results

SPARQL query of the test
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX stax: <https://w3id.org/stax/ontology#>

SELECT * WHERE {
    ?baseStreamType a stax:ConcreteRdfStreamType ;
        # No need for using a "skos:broader*/" path here, as the reasoner will infer 
        # the needed stax:canBeTriviallyExtendedInto statements automatically.
        stax:canBeTriviallyExtendedInto ?extendedStreamType .
}

Test CQ2.3 (definition)

Question: Which concrete stream types can be flattened into other stream types?

Expectation: there are 5 query results

SPARQL query of the test
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX stax: <https://w3id.org/stax/ontology#>

SELECT * WHERE {
    ?baseStreamType a stax:ConcreteRdfStreamType ;
        # No need for using a "skos:broader*/" path here, as the reasoner will infer 
        # the needed stax:canBeFlattenedInto statements automatically.
        stax:canBeFlattenedInto ?flattenedStreamType .
}

Test CQ2.4 (definition)

Question: Which concrete stream types can be grouped to obtain other stream types?

Expectation: there are 2 query results

SPARQL query of the test
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX stax: <https://w3id.org/stax/ontology#>

SELECT * WHERE {
    ?baseStreamType a stax:ConcreteRdfStreamType ;
        # No need for using a "skos:broader*/" path here, as the reasoner will infer 
        # the needed stax:canBeGroupedInto statements automatically.
        stax:canBeGroupedInto ?groupedStreamType .
}

Use case 3

Analyzing the state of the art of RDF streaming. This use case is realized with RDF-STaX's Nanopublication mechanism, which allows anyone to publish statements like "paper/software X uses stream type Y". The collection of such published nanopublications can then be later used to derive insights about the state of the art (SOTA) of RDF streaming. RDF-STaX can also be used in SOTA investigations outside the context of Nanopublications.

Test CQ3.1 (definition)

Question: What are the taxonomical parents of each stream type, listed in order?

Expectation: there are 10 query results

SPARQL query of the test
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX stax: <https://w3id.org/stax/ontology#>

SELECT ?label (GROUP_CONCAT(?broader; SEPARATOR=", ") as ?parents) WHERE {
    ?streamType a/rdfs:subClassOf* stax:RdfStreamType ;
        skos:prefLabel ?label .

    OPTIONAL {
        ?streamType skos:broader+ [ skos:prefLabel ?broader ] .
    }
}
GROUP BY ?streamType ?label

Test CQ3.2 (definition)

Question: Is there any stream type that is a taxonomical parent or child of itself?

Expectation: query results are empty

SPARQL query of the test
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX stax: <https://w3id.org/stax/ontology#>

SELECT * WHERE {
    {
        ?streamType skos:broader+ ?streamType .
    }
    UNION
    {
        ?streamType skos:narrower+ ?streamType .
    }
}

Test CQ3.3 (definition)

Question: Which conversions between concrete stream types cannot be done in any trivial way (grouping, flattening, extending)? Allow for multiple trivial transformations in series and take into account the taxonomical structure.

Expectation: there are 25 query results

SPARQL query of the test
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX stax: <https://w3id.org/stax/ontology#>

SELECT ?fromStreamType ?toStreamType WHERE {
    ?toStreamType a stax:ConcreteRdfStreamType .
    ?fromStreamType a stax:ConcreteRdfStreamType

    MINUS {
        ?fromStreamType
            (skos:broader*/(stax:canBeFlattenedInto|stax:canBeGroupedInto|stax:canBeTriviallyExtendedInto)?)+
            ?toStreamType .
    }
}