1

I want to know how to use NSGI-LD to upload an image even though these static files are not stored in Orion Context Broker or Mongo. I want to know if there is a way to configure the NSGI-LD to forward the images to AWS S3 Buck or another location?

0

1 Answer 1

2

As you correctly identified, binary files are not a good candidate for context data, and should not be held directly within a context broker. The usual paradigm would be as follows:

Imagine you have a number plate reader library linked to Kurento and wish to store the images of vehicles as they pass. In this case the event from the media stream should cause two separate actions:

  • Upload the raw image to a storage server
  • Upsert the context data to the context broker including an attribute holding the URI of the stored image.

Doing things this way means you can confirm that the image is safely stored, and then send the following:

{
    "vehicle_registration_number": {
        "type": "Property",
        "value": "X123RPD"
    },
    "image_download": {
        "type": "Property",
        "value": "http://example.com/url/to/image"
    }
}

The alternative would be to simply include some link back to the source file somehow as metadata:

{
    "vehicle_registration_number": {
        "type": "Property",
        "value": "X123RPD",
        "origin": {
            "type": "Property",
            "value": "file://localimage"
        }
    }
}

Then if you have a registration on vehicle_registration_number which somehow links back to the server with the original file, it could upload the image after the context broker has been updated (and then do another upsert)

Option one is simpler. Option two would make more sense if the registration is narrower. For example, only upload images of VRNs for cars whose speed attribute is greater than 70 km/h.

Ontologically you could say that Device has a relationship to a Photograph which would mean that Device could have an additional latestRecord attribute:

{
    "latestRecord": {
        "type": "Relationship",
        "object": "urn:ngsi-ld:CatalogueRecordDCAT-AP:0001"
    },
}

And and create a separate entity holding the details of the Photograph itself using a standard data model such as CatalogueRecordDCAT-AP which is defined here. Attributes such as source and sourceMetadata help define the location of the raw file.

{  
  "id": "urn:ngsi-ld:CatalogueRecordDCAT-AP:0001",  
  "type": "CatalogueRecordDCAT-AP",  
  "dateCreated": "2020-11-02T21:25:54Z",  
  "dateModified": "2021-07-02T18:37:55Z",    
  "description": "Speeding Ticket",  
  "dataProvider": "European open data portal",   
  "location": {  
    "type": "Point",  
    "coordinates": [  
      36.633152,  
      -85.183315  
    ]  
  },  
  "address": {  
    "streetAddress": "2, rue Mercier",  
    "addressLocality": "Luxembourg",  
    "addressRegion": "Luxembourg",  
    "addressCountry": "Luxembourg",  
    "postalCode": "2985",  
    "postOfficeBoxNumber": ""  
  },  
  "areaServed": "European Union and beyond",  
  "primaryTopic": "Public administration",  
  "modificationDate": "2021-07-02T18:37:55Z",  
  "applicationProfile": "DCAT Application profile for data portals in Europe",  
  "changeType": "First version",  
  "source": "http://example.com/url/to/image"
  "sourceMetadata": {"type" :"jpeg", "height" : 100, "width": 100},    
  "@context": [  
    "https://smartdatamodels.org/context.jsonld"  
  ]  
}


Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.