102
Copyright © 2015 Open Geospatial Consortium.
The E and optional sign are followed by one or more digits. Infinity and NaN are not permitted remember that “null” is allowed. There are not theoretical limitations on
number figures BUT two limits can be assumed: for floating point numbers, many software follow IEEE 754-2008 binary64 double precision numbers. In addition, for
integers numbers, it is not recommendable to go beyond the range [–253+1, 253– 1].
11.2.3 Simple data types in JSON-LD
JSON-LD syntax associates simple types to simple data types in the xsd namespace. It explicitly mentions xsd:string that is the default value, xsd:double or as xsd:integer for
numbers, and xsd:boolean for the true or false values.
Even if it is not mentioned explicitly. Other types xsd can be used, and in particular, xsd:dateTime and xsd:duration are mentioned in implementations of schema.org
https:github.comjson-ldjson-ld.orgblobmastercontextsperson.jsonld and are recommended here. This way, data types in UML can be easily mapped to this xsd types.
11.2.4 Identifiers, URLs and URI in JSON-LD
“id” is a reserved type for URI’s and URL’s and all URI’s and URL’s should use this type.
11.2.5 Declaration of simple data types
In the “context” section you should define the data types of all properties that are going to be used. To do that, we associate a key in the JSON file to a property name in the data
model and to a simple data type like this:
context: { xsd: http:www.w3.org2001XMLSchema,
onlineResource: { id: ows:onlineResource, type: id}
date: { id: ows:publication, type: xsd:dateTime}
}
A list of equivalence between the UML simple types and the xsd time could be useful here. It will look very similar to the one we use in the UML XML conversions.
11.3 Rules for complex data types
Complex data types are defined with namespaces. Each namespace has a URI and an abbreviation. In JSON-LD, and abbreviated namespace is defined as a synonymous of a
URI namespace in a context section like this:
Copyright © 2015 Open Geospatial Consortium.
103
context: { ows: http:www.opengis.netows2.0,
}
Having a namespace for our own types and id’s is also useful
context: { ows: http:www.opengis.netows2.0,
mythings: http:www.someserver.orgmythings1.0, }
Ending the namespace with a”” is useful because the namespace string is ready to be concatenated with any property name, class name, or data type name.
We assume that all datatypes in this namespace are well defined in this namespace.
11.3.1 Listing you property names
In the “context” section you should list all property names that are going to be used. To do that, we associate a key in the JSON file to a property name in the UML data model
like this note that no mention of the data types or classes is done here:
context: { ows: http:www.opengis.netows2.0,
serviceIdentification: ows:serviceIdentification, serviceProvider: ows:serviceProvider,
operationsMetadata: ows:operationsMetadata }
11.3.2 Declaring complex data types
The declaration of simple data types is done in a context section. The declaration of a complex data type is done directly in the object instances using the reserved property
name “type”. Types can contain the abbreviated namespace. In addition, each object needs an id to make the transition to RDF easy. To do that we will use the reserved key
“id”. This way, all complex type objects will start with this two keys:
{ id: mythings:Demo1,
type: ows:ServiceMetadata, ...
}