This is the description of a simple "supermarket" NGSI-LD Data Model consisting of 4 entities:
Further human-readable information about each of the entities defined for this tutorial can be found by clicking through the links.
@context
for the Supermarket
The full tutorial NGSI-LD @context
is publicly available at:
https://fiware.github.io/tutorials.Step-by-Step/tutorials-context.jsonld
A snippet of the @context
and @graph
can be seen below (scroll to see more detail):
{
"@context": {
"type": "@type",
"id": "@id",
"schema": "https://schema.org/",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"fiware": "https://uri.fiware.org/ns/data-models#",
"tutorial": "https://fiware.github.io/tutorials.Step-by-Step/schema/",
"Building": "fiware:Building",
"Product": "tutorial:Product",
"Shelf": "tutorial:Shelf",
"StockOrder": "tutorial:StockOrder",
"Person": "schema:Person",
"address": "schema:address",
"category": "fiware:category",
"containedInPlace": "fiware:containedInPlace",
"dataProvider": "fiware:dataProvider",
"description": "fiware:description",
"floorsAboveGround": "fiware:floorsAboveGround",
"floorsBelowGround": "fiware:floorsBelowGround",
"owner": {
"@id": "fiware:owner",
"@type": "@id"
},
"occupier": {
"@id": "fiware:occupier",
"@type": "@id"
},
"refMap": "fiware:refMap",
"source": "fiware:source",
"installedBy": {
"@id": "tutorial:installedBy",
"@type": "@id"
},
"locatedIn": {
"@id": "tutorial:locatedIn",
"@type": "@id"
},
"maxCapacity": {
"@id": "tutorial:maxCapacity",
"@type": "xsd:integer"
},
"statusOfWork": "tutorial:statusOfWork",
"stocks": {
"@id": "tutorial:stocks",
"@type": "@id"
},
"currency": {
"@id": "tutorial:currency",
"@type": "xsd:string"
},
"price": {
"@id": "tutorial:price",
"@type": "xsd:decimal"
},
"size": {
"@id": "tutorial:size",
"@type": "xsd:string"
},
"furniture": {
"@id": "tutorial:furniture",
"@type": "@id"
},
"verified": {
"@id": "tutorial:verified",
"@type": "xsd:boolean"
},
"requestedFor": {
"@id": "tutorial:requestedFor",
"@type": "@id"
},
"requestedBy": {
"@id": "tutorial:requestedBy",
"@type": "@id"
},
"orderedProduct": {
"@id": "tutorial:orderedProduct",
"@type": "@id"
},
"orderDate": {
"@id": "tutorial:orderDate",
"@type": "https://uri.etsi.org/ngsi-ld/DateTime"
},
"stockCount": {
"@id": "tutorial:stockCount",
"@type": "xsd:integer"
},
"numberOfItems": {
"@id": "tutorial:numberOfItems",
"@type": "xsd:integer"
}
},
"@graph": [
{
"@id": "tutorial:Product",
"@type": "rdfs:Class",
"rdfs:comment": "Product is something sold in a Store.",
"rdfs:label": "Product",
"rdfs:subClassOf": {
"@id": "http://schema.org/Thing"
}
},
{
"@id": "tutorial:Shelf",
"@type": "rdfs:Class",
"rdfs:comment": "A Shelf is a unit of Store Furniture",
"rdfs:label": "Shelf",
"rdfs:subClassOf": {
"@id": "http://schema.org/Thing"
}
},
{
"@id": "tutorial:StockOrder",
"@type": "rdfs:Class",
"rdfs:comment": "StockOrder an entry in a list of items sold in one or more stores",
"rdfs:label": "StockOrder",
"rdfs:subClassOf": {
"@id": "http://schema.org/Intangible"
}
},
{
"@id": "schema:Person",
"@type": "rdfs:Class",
"http://purl.org/dc/terms/source": {
"@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_rNews"
},
"http://www.w3.org/2002/07/owl#equivalentClass": {
"@id": "http://xmlns.com/foaf/0.1/Person"
},
"rdfs:comment": "A person (alive, dead, undead, or fictional).",
"rdfs:label": "Person",
"rdfs:subClassOf": {
"@id": "http://schema.org/Thing"
}
},
{
"@id": "tutoral:requestedBy",
"@type": "https://uri.etsi.org/ngsi-ld/Relationship",
"schema:domainIncludes": [
{
"@id": "tutorial:Shelf"
},
{
"@id": "tutorial:StockOrder"
}
],
"schema:rangeIncludes": [
{
"@id": "schema:Person"
}
],
"rdfs:comment": "Object requested by person.",
"rdfs:label": "requestedBy"
},
{
"@id": "tutoral:installedBy",
"@type": "https://uri.etsi.org/ngsi-ld/Relationship",
"schema:domainIncludes": [
{
"@id": "tutorial:Shelf"
}
],
"schema:rangeIncludes": [
{
"@id": "schema:Person"
}
],
"rdfs:comment": "Person who installs an Object",
"rdfs:label": "installedBy"
},
{
"@id": "tutorial:furniture",
"@type": "https://uri.etsi.org/ngsi-ld/Relationship",
"schema:domainIncludes": [
{
"@id": "fiware:Building"
}
],
"schema:rangeIncludes": [
{
"@id": "tutorial:Shelf"
}
],
"rdfs:comment": "Units found within a Building",
"rdfs:label": "furniture"
},
{
"@id": "tutorial:locatedIn",
"@type": "https://uri.etsi.org/ngsi-ld/Relationship",
"schema:domainIncludes": [
{
"@id": "tutorial:Shelf"
}
],
"schema:rangeIncludes": [
{
"@id": "fiware:Building"
}
],
"rdfs:comment": "Building in which an item is found",
"rdfs:label": "locatedIn"
},
{
"@id": "tutorial:stocks",
"@type": "https://uri.etsi.org/ngsi-ld/Relationship",
"schema:domainIncludes": [
{
"@id": "tutorial:Shelf"
}
],
"schema:rangeIncludes": [
{
"@id": "tutorial:Product"
}
],
"rdfs:comment": "The product found on a shelf",
"rdfs:label": "stocks"
},
{
"@id": "tutorial:requestedFor",
"@type": "https://uri.etsi.org/ngsi-ld/Relationship",
"schema:domainIncludes": [
{
"@id": "tutorial:StockOrder"
}
],
"schema:rangeIncludes": [
{
"@id": "fiware:Building"
}
],
"rdfs:comment": "Store for which an item is requested",
"rdfs:label": "requestedFor"
},
{
"@id": "tutorial:orderedProduct",
"@type": "https://uri.etsi.org/ngsi-ld/Relationship",
"schema:domainIncludes": [
{
"@id": "tutorial:StockOrder"
}
],
"schema:rangeIncludes": [
{
"@id": "tutorial:Product"
}
],
"rdfs:comment": "The Product ordered for a store",
"rdfs:label": "orderedProduct"
}
]
}
@context
- syntax tokens and keywords As defined in the JSON-LD 1.0 specification, JSON-LD specifies a number of syntax tokens and keywords that used in NGSI-LD. To facilitate the understanding of the tutorial NGSI-LD data model, the main keywords are listed below:
@context
@id
@value
@type
(typed values)@vocab
@type
with a common prefix
IRI.@graph
Note that all keys, keywords, and values in JSON-LD and NSGI-LD are case-sensitive.
The
NGSI-LD specification states that NGSI-LD is based on JSON-LD,
a JSON-based format to serialize Linked Data. The @context
in JSON-LD is used
to map terms provided as strings to concepts specified as URIs. The Core NGSI-LD (JSON-LD)
@context
is defined as a JSON-LD @context
which contains:
All NGSI-LD compliant implementations support the use of the Core @context
, which is implicitly
present when processing or generating context information. However, when rendering NGSI-LD Elements,
the Core @context
should always be explicitly referenced, so that, if needed, JSON-LD processors
can properly expand the resulting JSON-LD documents provided by API implementations.
The full core NGSI-LD @context
is publicly available at:
http://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld