oeg-upm / wot-hive

The WoT Hive an implementation of a WoT Directory described in the W3C WoT Discovery standard
Apache License 2.0
13 stars 7 forks source link

Get Thing from Thing Directory #13

Closed Serge3006 closed 2 years ago

Serge3006 commented 2 years ago

When we apply the following query:

curl http://localhost:9000/api/things/urn:dev:testId10

We get the following error:

{ "code": "WOT-DIR-P", "description": "TD with the given id not found", "detail": "directory.exceptions.ThingNotFoundException: Requested Thing not found" }

AndreaCimminoArriaga commented 2 years ago

Please could you provide the TD as well?

Salva5297 commented 2 years ago

When we make a PUT operation into the Wot-Hive storing a specific TD we cannot retrieve that TD by the ID. The example TD is the following:

{
  "@context": [
    "https://www.w3.org/2019/wot/td/v1", 
    {
      "beo": "https://pi.pauwel.be/voc/buildingelement#", 
      "bot": "https://w3id.org/bot#", 
      "brick": "https://brickschema.org/schema/1.1/Brick#", 
      "om": "http://openmetrics.eu/openmetrics#", 
      "props": "https://w3id.org/props#", 
      "rdfs": "http://www.w3.org/2000/01/rdf-schema#", 
      "xsd": "http://www.w3.org/2001/XMLSchema#"
    }
  ], 
  "@id": "data.cogito.iot.linkeddata.es/thing/cogito1212", 
  "@type": [
    "bot:Building", 
    "brick:Building"
  ], 
  "description": "A building element.", 
  "properties": {
    "IfcFile": {
      "forms": [
        {
          "href": "https://example_uri.com/files/cogito1212",
          "type": "multipart-form/data"
        }
      ]
    }, 
    "RDFUri": {
      "forms": [
        {
          "href": "https://openmetrics.eu/openmetrics#Building_120",
          "type": "text/turle"
        }
      ]
    }
  }, 
  "security": [
    "no_sec"
  ], 
  "securityDefinitions": {
    "no_sec": {
      "scheme": "nosec"
    }
  }, 
  "title": "cogito1212"
}
AndreaCimminoArriaga commented 2 years ago

When I register this TD I get a json payload with the error, that boils down to following response:

[...] Not a valid (absolute) IRI: /data.cogito.iot.linkeddata.es/thing/cogito1212 [line 1]\"}"

You are using as id a relative IRI data.cogito.iot.linkeddata.es/thing/cogito1212 that is now allowed. Using an absolute IRI the Wot Hive works properly, e.g., http://data.cogito.iot.linkeddata.es/thing/cogito1212.

Once the ID of the Thing is fixed the TD can be easily retrieved using the id with a GET, in this case http://localhost:9000/api/things/urn:dev:testId10