Giter VIP home page Giter VIP logo

Comments (2)

jason-fox avatar jason-fox commented on June 3, 2024
  1. The devices don't start sending any readings until something is done on the farm. Start by raising the temperature of the barn.

  2. Retrieve an Animal entity from Scorpio as follows:

curl -L -X GET 'http://localhost:9090/ngsi-ld/v1/entities/urn:ngsi-ld:Animal:cow001' \
-H 'NGSILD-Tenant: openiot' \
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"'

An updating cow entity will include an observedAt as shown.

"heartRate": {
        "type": "Property",
        "value": 50,
        "observedAt": "2022-10-11T17:39:44.311Z",
        "unitCode": "5K",
        "providedBy": {
            "type": "Relationship",
            "object": "urn:ngsi-ld:Device:cow001"
        }
    }
  1. To make a temporal query on Scorpio make a GET request on /ngsi-ld/v1/temporal/entities/urn:ngsi-ld:Animal:cow001:
curl -L -X GET 'http://localhost:9090/ngsi-ld/v1/temporal/entities/urn:ngsi-ld:Animal:cow001?lastN=5' \
-H 'NGSILD-Tenant: openiot' \
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"'

The response will look like:

Response
{
    "id": "urn:ngsi-ld:Animal:cow001",
    "type": "Animal",
    "heartRate": [
        {
            "type": "Property",
            "value": 51,
            "instanceId": "urn:ngsi-ld:47cb7978-85de-48aa-8f6b-5bcf0a3deabb",
            "observedAt": "2022-10-11T17:37:04.092Z",
            "unitCode": "5K",
            "providedBy": {
                "type": "Relationship",
                "object": "urn:ngsi-ld:Device:cow001"
            }
        },
        {
            "type": "Property",
            "value": 51,
            "instanceId": "urn:ngsi-ld:aa1161e9-cc3a-494b-9170-fe2b137928b4",
            "observedAt": "2022-10-11T17:36:58.905Z",
            "unitCode": "5K",
            "providedBy": {
                "type": "Relationship",
                "object": "urn:ngsi-ld:Device:cow001"
            }
        },
        {
            "type": "Property",
            "value": 51,
            "instanceId": "urn:ngsi-ld:500e0110-71e6-47e3-81f8-ab3b750254c0",
            "observedAt": "2022-10-11T17:36:54.187Z",
            "unitCode": "5K",
            "providedBy": {
                "type": "Relationship",
                "object": "urn:ngsi-ld:Device:cow001"
            }
        },
        {
            "type": "Property",
            "value": 51,
            "instanceId": "urn:ngsi-ld:5495a31b-c565-4a79-99a8-2023477cd02f",
            "observedAt": "2022-10-11T17:36:48.810Z",
            "unitCode": "5K",
            "providedBy": {
                "type": "Relationship",
                "object": "urn:ngsi-ld:Device:cow001"
            }
        },
        {
            "type": "Property",
            "value": 52,
            "instanceId": "urn:ngsi-ld:4b1eb4ec-45a5-4f5b-b35e-874d2d88b1de",
            "observedAt": "2022-10-11T17:36:43.837Z",
            "unitCode": "5K",
            "providedBy": {
                "type": "Relationship",
                "object": "urn:ngsi-ld:Device:cow001"
            }
        }
    ],
    "phenologicalCondition": {
        "type": "Property",
        "value": "maleAdult",
        "instanceId": "urn:ngsi-ld:90a3dc75-b727-4dad-bcf7-d15f1858e3e0"
    },
    "reproductiveCondition": {
        "type": "Property",
        "value": "active",
        "instanceId": "urn:ngsi-ld:f27a8e6e-9061-4cc9-b81b-94d64a5f0dcd"
    },
    "location": [
        {
            "type": "GeoProperty",
            "value": {
                "type": "Point",
                "coordinates": [
                    13.413,
                    52.468
                ]
            },
            "instanceId": "urn:ngsi-ld:3b0c1255-21f9-4405-bcb0-c39d6758679f",
            "observedAt": "2022-10-11T17:37:04.092Z",
            "providedBy": {
                "type": "Relationship",
                "object": "urn:ngsi-ld:Device:cow001"
            }
        },
        {
            "type": "GeoProperty",
            "value": {
                "type": "Point",
                "coordinates": [
                    13.412,
                    52.468
                ]
            },
            "instanceId": "urn:ngsi-ld:33730055-dd73-461a-b613-26884c75c743",
            "observedAt": "2022-10-11T17:36:58.905Z",
            "providedBy": {
                "type": "Relationship",
                "object": "urn:ngsi-ld:Device:cow001"
            }
        },
        {
            "type": "GeoProperty",
            "value": {
                "type": "Point",
                "coordinates": [
                    13.413,
                    52.469
                ]
            },
            "instanceId": "urn:ngsi-ld:847ef0fe-62eb-46c7-b1c5-a3f3ef20daff",
            "observedAt": "2022-10-11T17:36:54.187Z",
            "providedBy": {
                "type": "Relationship",
                "object": "urn:ngsi-ld:Device:cow001"
            }
        },
        {
            "type": "GeoProperty",
            "value": {
                "type": "Point",
                "coordinates": [
                    13.413,
                    52.47
                ]
            },
            "instanceId": "urn:ngsi-ld:bac48abb-44c2-46f3-9112-12214a44c386",
            "observedAt": "2022-10-11T17:36:48.810Z",
            "providedBy": {
                "type": "Relationship",
                "object": "urn:ngsi-ld:Device:cow001"
            }
        },
        {
            "type": "GeoProperty",
            "value": {
                "type": "Point",
                "coordinates": [
                    13.414,
                    52.469
                ]
            },
            "instanceId": "urn:ngsi-ld:3ca06710-a720-414e-a57b-5ac2cd11aae8",
            "observedAt": "2022-10-11T17:36:43.837Z",
            "providedBy": {
                "type": "Relationship",
                "object": "urn:ngsi-ld:Device:cow001"
            }
        }
    ],
    "name": {
        "type": "Property",
        "value": "Beany",
        "instanceId": "urn:ngsi-ld:611ddbd0-cc6a-40e2-b680-51e747ffce9d"
    },
    "legalID": {
        "type": "Property",
        "value": "M-bull001-Beany",
        "instanceId": "urn:ngsi-ld:3f2bac48-f368-4f31-8129-ce5dcee69f8f"
    },
    "sex": {
        "type": "Property",
        "value": "male",
        "instanceId": "urn:ngsi-ld:40c58217-dfa9-4e2b-8cc5-e0f98945dc3a"
    },
    "species": {
        "type": "Property",
        "value": "dairy cattle",
        "instanceId": "urn:ngsi-ld:eff2e7cb-478c-41fc-84f0-a77fff4558de"
    }
}

The difference between Scorpio and Orion+Mintaka is that because Scorpio integrates the temporal interface, the temporal interface can be found under the same URL path and on the same port. Whereas for Orion+Mintaka they are different paths and different ports.

Scorpio

  • <scorpio>:<scorpio-port>/ngsi-ld/v1/entities/urn:ngsi-ld:Animal:cow001
  • <scorpio>:<scorpio-port>/ngsi-ld/v1/temporal/entities/urn:ngsi-ld:Animal:cow001

Orion-LD + Mintaka

  • <orion>:<orion-port>/ngsi-ld/v1/entities/urn:ngsi-ld:Animal:cow001
  • <mintaka>:<mintaka-port>//temporal/entities/urn:ngsi-ld:Animal:cow001

from tutorials.short-term-history.

IngMiad avatar IngMiad commented on June 3, 2024

Hi Jason,

thank you for the support. Yes you are right, the problem seem have to be the different URLs at REST IF. Using your suggested queries with integrated temporal IF works.

Greetings!

from tutorials.short-term-history.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.