Skip to content

Commit

Permalink
Update context for Expansion/compaction example.
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-fox committed Jan 29, 2024
1 parent 0c6051f commit 3ce4c78
Show file tree
Hide file tree
Showing 3 changed files with 344 additions and 165 deletions.
4 changes: 4 additions & 0 deletions context-provider/controllers/ngsi-ld/amending-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,16 @@ function translateRequest(req, res) {
// Having received a response, the payload is expanded using
// the core context - this forces all attribute ids to be
// URIs

delete cbResponse['@context'];
debug('received: ' + JSON.stringify(cbResponse))
cbResponse['@context'] = coreContext;
const expanded = await jsonld.expand(cbResponse);
// The payload is then compacted using the "japanese" context
// This maps the URIs to short attribute names.
const compacted = await jsonld.compact(expanded, japaneseContext);
delete compacted['@context'];
debug('compacted: ' + JSON.stringify(compacted))
return res.send(compacted);
})
.catch(function (err) {
Expand Down
39 changes: 30 additions & 9 deletions context-provider/controllers/ngsi-ld/jsonld-context/japanese.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,46 @@
{
"@context": {

"core": "https://uri.etsi.org/ngsi-ld/",
"core": "https://uri.etsi.org/ngsi-ld/",
"geojson": "https://purl.org/geojson/vocab#",
"schema": "https://schema.org/",
"fiware": "https://uri.fiware.org/ns/data-models#",
"openstreetmap": "https://wiki.openstreetmap.org/wiki/Tag:building%3D",

"値": "core:hasValue",
"語彙": {
"@id": "core:hasVocab",
"@type": "@vocab"
},


"オブジェクト": "core:hasObject",
"座標": "core:coordinates",
"場所": "core:location",
"名前": "core:name",
"名前": "schema:name",
"グロッサリープロパティ": "core:VocabularyProperty",
"プロパティ": "core:Property",
"リレーションシップ": "core:Relationship",
"ジオプロパティ": "core:GeoProperty",
"場": "geojson:Point",
"タイプ": "@type",
"識別子": "@id",

"座標": {
"@container": "@list",
"@id": "geojson:coordinates"
},


"コマーシャル": "commercial",
"オフィス": "office",
"インダストリアル": "industrial",
"リテール": "retail",
"レジデンシャル": "residential",
"住所": "core:default-context/住所",

"ビル": "fiware:Building",
"カテゴリー": "fiware:category",
"コマーシャル": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dcommercial",
"オフィス": "https://wiki.openstreetmap.org/wiki/Tag:building%3Doffice",
"インダストリアル": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dindustrial",
"リテール": "https://wiki.openstreetmap.org/wiki/Tag:building%3D:retail",
"レジデンシャル": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dresidential",

"住所": "schema:address",
"種類": "core:default-context/種類",
"検証済み": "core:default-context/検証済み",
"家具": "core:default-context/家具",
Expand Down
Loading

0 comments on commit 3ce4c78

Please sign in to comment.