Skip to content

Latest commit

 

History

History
52 lines (35 loc) · 1.56 KB

best-practice.md

File metadata and controls

52 lines (35 loc) · 1.56 KB

RDF Cube Schema

Best Practice

Null/Empty values

In RDF Cube Schema, all dimensions are mandatory for a cube. If a value could not be measured, it should be expressed as such.

There is no generic "built-in" way to solve this in RDF. For some numeric datatypes, XML and thus RDF defines "not a number" (NaN) as a value. According to the specs, this is only valid for xsd:float and xsd:double and not for xsd:decimal and xsd:integer.

To provide a generic solution that works for all number and IRIs, RDF Cube Schema provides cube:Undefined. The following example shows how to use it in cube:Observation and in the attached shape:

# NamedNode Dimensions

<observation1> a cube:Observation;
  ex:namedNodeDimension cube:Undefined;

<observation2> a cube:Observation;
  ex:namedNodeDimension ex:realValue1;

<observation3> a cube:Observation;
  ex:namedNodeDimension ex:realValue2;
  
## Snippet for for the according shape:

[
    sh:path ex:namedNodeDimension;
    sh:nodeKind sh:IRI;
    sh:in(cube:Undefined, ex:realValue1, ex:realValue2)
]


# Literals Dimensions

<observation2> a cube:Observation;
  ex:literalDimension ""^^cube:Undefined.

## Snippet for for the according shape:

[
    sh:path ex:literalDimension;
    sh:nodeKind sh:Literal;
    sh:or([
        sh:datatype xsd:string
    ], [
        sh:datatype cube:Undefined
    ])
]

If it is necessary to state why the value is cube:Undefined, annotations should be used.