Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: first jsonld context #2

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions broker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Context
The [context](https://sedimark.github.io/ontology/broker/jsonld-contexts/sedimark-compound.jsonld) define all
the already discussed property for types :
- [Asset](https://sedimark.github.io/ontology/broker/jsonld-contexts/sedimark-asset.jsonld)
- [DataAsset](https://sedimark.github.io/ontology/broker/jsonld-contexts/sedimark-data-asset.jsonld)
- [AIModelAsset](https://sedimark.github.io/ontology/broker/jsonld-contexts/sedimark-ai-model-asset.jsonld)
- [ServiceAsset](https://sedimark.github.io/ontology/broker/jsonld-contexts/sedimark-service-asset.jsonld)

## Calling the broker with the context
You can use the "Link" header to define the context of your request when calling the NGSILD-Broker.
```
<https://sedimark.github.io/ontology/broker/jsonld-contexts/sedimark-compound.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"
```

An example of asset creation for a broker deployed on "localhost:8080" would be the following :

POST "localhost:8080/ngsi-ld/v1/entities"

body : [example here](https://sedimark.github.io/ontology/broker/payload-example/asset.jsonld)
21 changes: 21 additions & 0 deletions broker/jsonld-contexts/sedimark-ai-model-asset.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"@context": {
"AIModelAsset": "https://sedimark.github.io/ontology#AIModelAsset",
"category": "https://sedimark.github.io/ontology#category",
"purpose": "https://sedimark.github.io/ontology#purpose",
"algorithm": "https://sedimark.github.io/ontology#algorithm",
"serialization": "https://sedimark.github.io/ontology#serialization",
"version": "http://www.w3.org/ns/dcat#version",
"execution": "https://sedimark.github.io/ontology#execution",
"size": "https://sedimark.github.io/ontology#size",
"modified": "https://sedimark.github.io/ontology#modified",
"handleStream": "https://sedimark.github.io/ontology#handleStream",
"inputFormat": "https://sedimark.github.io/ontology#inputFormat",
"inputParameters": "https://sedimark.github.io/ontology#inputParameters",
"outputFormat": "https://sedimark.github.io/ontology#outputFormat",
"outputParameters": "https://sedimark.github.io/ontology#outputParameters",
"hasTrainingDataset": "https://sedimark.github.io/ontology#hasTrainingDataset",
"hasArchitecture": "https://sedimark.github.io/ontology#hasArchitecture",
"datasetProcessing": "https://sedimark.github.io/ontology#datasetProcessing",
}
}
25 changes: 25 additions & 0 deletions broker/jsonld-contexts/sedimark-asset.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"@context": {
"Asset": "https://sedimark.github.io/ontology#Asset",
"title": "http://www.w3.org/ns/dcat#title",
"creator": "http://www.w3.org/ns/dcat#creator",
"description": "http://www.w3.org/ns/dcat#description",
"publisher": "http://www.w3.org/ns/dcat#publisher",
"issued": "http://www.w3.org/ns/dcat#issued",
"modified": "http://www.w3.org/ns/dcat#modified",
"keyword": "http://www.w3.org/ns/dcat#keyword",
"license": "http://purl.org/dc/terms/license",
"spatial": "http://purl.org/dc/terms/spatial",
"wasGeneratedBy": "http://www.w3.org/ns/prov#wasGeneratedBy",
"used": "http://www.w3.org/ns/prov#used",
"startedAtTime": "http://www.w3.org/ns/prov#startedAtTime",
"endedAtTime": "http://www.w3.org/ns/prov#endedAtTime",
"version": "http://www.w3.org/ns/dcat#version",
"endpointURL": "http://www.w3.org/ns/dcat#endpointURL",
"endpointDescription": "http://www.w3.org/ns/dcat#endpointDescription",
"geometry": "http://www.w3.org/ns/locn#geometry",
"image": "https://sedimark.github.io/ontology# image",
"relatedAsset": "https://sedimark.github.io/ontology#relatedAsset",
"processingSteps": "https://sedimark.github.io/ontology#processingSteps"
}
}
9 changes: 9 additions & 0 deletions broker/jsonld-contexts/sedimark-compound.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"@context": [
"https://sedimark.github.io/ontology/broker/jsonld-contexts/sedimark-asset.jsonld",
"https://sedimark.github.io/ontology/broker/jsonld-contexts/sedimark-ai-model-asset.jsonld",
"https://sedimark.github.io/ontology/broker/jsonld-contexts/sedimark-data-asset.jsonld",
"https://sedimark.github.io/ontology/broker/jsonld-contexts/sedimark-service-asset.jsonld",
"https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.8.jsonld"
]
}
12 changes: 12 additions & 0 deletions broker/jsonld-contexts/sedimark-data-asset.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"@context": {
"DataAsset": "https://sedimark.github.io/ontology#DataAsset",
"temporal": "http://www.w3.org/ns/dcat#temporal",
"startDate": "http://www.w3.org/ns/dcat#startDate",
"endDate": "http://www.w3.org/ns/dcat#endDate",
"temporalResolution": "http://www.w3.org/ns/dcat#temporalResolution",
"size": "http://www.w3.org/ns/dcat#size",
"accrualPeriodicity": "http://purl.org/dc/terms/accrualPeriodicity",
"inSeries": "http://www.w3.org/ns/dcat#inSeries"
}
}
10 changes: 10 additions & 0 deletions broker/jsonld-contexts/sedimark-service-asset.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"@context": {
"ServiceAsset": "https://sedimark.github.io/ontology#ServiceAsset",
"endpointURL": "http://www.w3.org/ns/dcat#endpointURL",
"endpointDescription": "http://www.w3.org/ns/dcat#endpointDescription",
"servesDataset": "http://www.w3.org/ns/dcat#servesDataset",
"serviceConfig": "https://sedimark.github.io/ontology#serviceConfig",

}
}
78 changes: 78 additions & 0 deletions broker/payload-example/asset.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"id": "urn:ngsi-ld:Asset:MyAssetId",
"type": "Asset",
"title": {
"type": "Property",
"value": "my Title"
},
"creator": {
"type": "Relationship",
"value": "id:of:the:creator"
},
"description": {
"type": "Property",
"value": "my Description"
},
"publisher": {
"type": "Relationship",
"value": "id:of:the:publisher"
},
"issued": {
"type": "Property",
"value": "2024-09-01T11:00:00.000Z"
},
"modified": {
"type": "Property",
"value": "2024-09-01T11:00:00.000Z"
},
"keyword": {
"type": "Property",
"value": ["Tag1", "Tag2"]
},
"license": {
"type": "Property",
"value": "https://creativecommons.org/licenses/by-nd/4.0/"
},
"spatial": {
"type": "Property",
"value": "https://sws.geonames.org/6299418/"
},
"startedAtTime": {
"type": "Property",
"value": "2024-01-01T01:00:00.000Z"
},
"endedAtTime": {
"type": "Property",
"value": "2024-12-31T23:59:59.000Z"
},
"version": {
"type": "Property",
"value": "v1.1"
},
"endpointURL": {
"type": "Property",
"value": "https://my.endpoint/url"
},
"endpointDescription": {
"type": "GeoProperty",
"value": "this is what my endpoint do"
},
"geometry": {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"geometry" property could be name "location" as "location" is already defined in the NGSILD core context.

"type": "Property",
"value": "myValue"
},
"image": {
"type": "Property",
"value": "https://image.com/my/image"
},
"location": {
"type": "GeoProperty",
"value": {
"type": "Point",
"coordinates": [
1.5,
1.5
]
}
}
}