Skip to content

Commit

Permalink
Made 1.8 the default core context
Browse files Browse the repository at this point in the history
  • Loading branch information
kzangeli committed Jan 10, 2025
1 parent 1cc913f commit 9091c82
Show file tree
Hide file tree
Showing 228 changed files with 975 additions and 923 deletions.
1 change: 1 addition & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
## New Features:
#1707: Support for local=true in the type discovery endpoints (GET /ngsi-ld/v1/types[/{typeName}]
#XXXX: Support for local=true in the ATTRIBUTE discovery endpoints (GET /ngsi-ld/v1/attributes}]
#XXXX: Made 1.8 the default core context

## Notes
1 change: 1 addition & 0 deletions src/app/orionld/orionld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,7 @@ static char* coreContextUrlSetup(const char* version)
else if (strcmp(version, "v1.5") == 0) return ORIONLD_CORE_CONTEXT_URL_V1_5;
else if (strcmp(version, "v1.6") == 0) return ORIONLD_CORE_CONTEXT_URL_V1_6;
else if (strcmp(version, "v1.7") == 0) return ORIONLD_CORE_CONTEXT_URL_V1_7;
else if (strcmp(version, "v1.8") == 0) return ORIONLD_CORE_CONTEXT_URL_V1_8;

return NULL;
}
Expand Down
14 changes: 14 additions & 0 deletions src/lib/orionld/context/orionldContextHashTablesFill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ bool orionldContextHashTablesFill(OrionldContext* contextP, KjNode* keyValueTree

for (KjNode* kvP = keyValueTree->value.firstChildP; kvP != NULL; kvP = kvP->next)
{
//
// Two new fields, neither String nor Object were introduced in the Core Context version 1.8
//
if (strcmp(kvP->name, "@version") == 0)
{
// FIXME: Keep the JSON-LD version ?
continue;
}
else if (strcmp(kvP->name, "@protected") == 0)
{
// FIXME: Keep the JSON-LD protection bool ?
continue;
}

OrionldContextItem* hiP = (OrionldContextItem*) kaAlloc(&kalloc, sizeof(OrionldContextItem));

hiP->name = kaStrdup(&kalloc, kvP->name);
Expand Down
3 changes: 3 additions & 0 deletions src/lib/orionld/context/orionldContextItemExpand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ char* orionldContextItemExpand
if (orionldCoreContextP != NULL)
contextItemP = orionldContextItemLookup(orionldCoreContextP, shortName, NULL);

if (contextItemP != NULL)
LM_T(LmtExpand, ("Found '%s' in the core context (%s)", shortName, orionldCoreContextP->url));

// 2. Lookup in given context (unless it's the Core Context)
if ((contextItemP == NULL) && (contextP != orionldCoreContextP))
contextItemP = orionldContextItemLookup(contextP, shortName, NULL);
Expand Down
3 changes: 2 additions & 1 deletion src/lib/orionld/context/orionldCoreContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ extern "C"
#define ORIONLD_CORE_CONTEXT_URL_V1_5 (char*) "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.5.jsonld"
#define ORIONLD_CORE_CONTEXT_URL_V1_6 (char*) "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.6.jsonld"
#define ORIONLD_CORE_CONTEXT_URL_V1_7 (char*) "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld"
#define ORIONLD_CORE_CONTEXT_URL_DEFAULT (char*) "v1.6"
#define ORIONLD_CORE_CONTEXT_URL_V1_8 (char*) "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.8.jsonld"
#define ORIONLD_CORE_CONTEXT_URL_DEFAULT (char*) "v1.8"



Expand Down
7 changes: 0 additions & 7 deletions src/lib/orionld/legacyDriver/kjTreeToContextAttribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ static bool specialCompoundCheck(const char* attrName, KjNode* compoundValueP)
KjNode* valueNodeP = NULL;
KjNode* otherNodeP = NULL;

LM_W(("Attr name: '%s'", attrName));

for (KjNode* nodeP = compoundValueP->value.firstChildP; nodeP != NULL; nodeP = nodeP->next)
{
if (nodeP->name[0] == '@')
Expand Down Expand Up @@ -112,7 +110,6 @@ static bool specialCompoundCheck(const char* attrName, KjNode* compoundValueP)
if (dateTimeFromString(valueNodeP->value.s, errorString, sizeof(errorString)) < 0)
{
orionldError(OrionldBadRequestData, "DateTime value of @value/@type compound must be a valid ISO8601", errorString, 400);
LM_W(("Attr name: '%s'", attrName));
pdAttribute(attrName);
return false;
}
Expand Down Expand Up @@ -162,7 +159,6 @@ static bool attributeValueSet(ContextAttribute* caP, KjNode* valueP)

if (valueP->type == KjObject)
{
LM_W(("Attr name: '%s'", caP->name.c_str()));
if (specialCompoundCheck(caP->name.c_str(), valueP) == false)
return false;
}
Expand Down Expand Up @@ -207,8 +203,6 @@ bool kjTreeToContextAttribute(OrionldContext* contextP, KjNode* kNodeP, ContextA
caP->name = attributeName;
*detailP = (char*) "unknown error";

LM_W(("attributeName: '%s'", caP->name.c_str()));

if (contextP == NULL)
contextP = orionldCoreContextP;

Expand Down Expand Up @@ -641,7 +635,6 @@ bool kjTreeToContextAttribute(OrionldContext* contextP, KjNode* kNodeP, ContextA
}
else
{
LM_W(("Calling attributeValueSet for attribute '%s'", caP->name.c_str()));
if (attributeValueSet(caP, valueP) == false)
{
// attributeValueSet calls orionldError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ HTTP/1.1 200 OK
Content-Length: 265
Content-Type: application/json
Date: REGEX(.*)
Link: <https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.6.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"
Link: <https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-contextREGEX(.*)

[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Attribute Addition

--SHELL-INIT--
dbInit orionld
dbInit CB
orionldStart CB

Expand All @@ -49,8 +50,7 @@ payload='{
"maxCapacity": {"type": "Property","value": 50},
"name": {"type": "Property","value": "Corner Unit"},
"@context": [
"https://fiware.github.io/tutorials.Step-by-Step/tutorials-context.jsonld",
"https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld"
"https://fiware.github.io/tutorials.Step-by-Step/tutorials-context.jsonld"
]
}'
orionCurl --url /ngsi-ld/v1/entities --payload "$payload" -H "Content-Type: application/ld+json" --linkHeaderFix
Expand Down Expand Up @@ -85,8 +85,7 @@ payload='{
}
},
"@context": [
"https://fiware.github.io/tutorials.Step-by-Step/tutorials-context.jsonld",
"https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld"
"https://fiware.github.io/tutorials.Step-by-Step/tutorials-context.jsonld"
]
}'
orionCurl --url /ngsi-ld/v1/entities/urn:ngsi-ld:Shelf:unit001/attrs --payload "$payload" -H "Content-Type: application/ld+json" --linkHeaderFix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ HTTP/1.1 200 OK
Content-Length: 305
Content-Type: application/json
Date: REGEX(.*)
Link: <https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.6.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"
Link: <https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-contextREGEX(.*)

{
"CPU": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ MongoDB server version: REGEX(.*)
"metadata" : [ ],
"blacklist" : false,
"name" : "Test subscription 01",
"ldContext" : "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.6.jsonld",
"ldContext" : "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-contextREGEX(.*)",
"createdAt" : REGEX(\d+\.\d+),
"modifiedAt" : REGEX(\d+\.\d+),
"conditions" : [
Expand Down
Loading

0 comments on commit 9091c82

Please sign in to comment.