Search code examples
schema.orgjson-ldtemperature

How to describe the temperature with Schema.org?


I want to use Schema.org (with JSON-LD) to label the value in the temperature sensor / to describe the temperature attribute (unit).

I can not find an explanation of the temperature at Schema.org. I get the sensor value through MQTT, here is the data output by MQTT.

{
  "@context": "http://example/temperature.jsonld",
  "_UTC_timestamp": "2017-11-18 08:56:51",
  "temperature": 25.12
}

 

<script type="application/ld+json"> 
"@context": {
  "Thing": "@type",
  "CreativeWork": "@subtype",
  "Thing": [{
      "name": "temperature",
      "@type": "number",
      "@value": "CreativeWork"
      "minimum": 0,
      "maximum": 80,
      "description": "a physical quantity that expresses the subjective perceptions of hot and cold",
      "url": "https://en.wikipedia.org/wiki/Temperature",
      "unit": "Celsius",
      CreativeWork[{
          "name": "measure temperature",
          "description": "Get the sensor temperature value" ,
          "Celsius" "https://en.wikipedia.org/wiki/Celsius"
          "link": [{
              "href": "http://iwilr3-3.campus.fhludwigshafen.de/iotsemantic/tinkerforge/temperature.jsonld"
            }
          ]
        }
      ]
    }
  ]
}
</script>

Solution

  • first, write out your statements (triples) in turtle format

    @Dataset name              text
             dateCreated       @DateTime
             about             @Thing
             variableMeasured  @PropertyValue
    
    @Thing   name              "sample from a sensor"
             mainEntityOfPage  @CreativeWork
    
    @CreativeWork name         sample
                  description  text about sampling
    
    @PropertyValue value           @Number
                   unitText        temperature
                   valueReference  @PropertyValue
    
    @PropertyValue unitCode  http://dbpedia.org/page/Celsius
                   unitText  celsius
    

    then you compose the statements as a graph

    Here is your @Graph of the @Types and their properties

    {
    "@graph": [
        {
        "@type": "Dataset",
        "@id": "DFI-1",
        "name": "label you use for the Dataset",
        "dateCreated": "2017-11-19T:04:30:40+06:00",
        "about":
            {
            "@type": "Thing",
            "@id": "Thing-1"
            },
        "variableMeasured":
            {
            "@type": "PropertyValue",
            "@id": "PV-1"
            }
        },
        {
        "@type": "Thing",
        "@id": "Thing-1",
        "name": "sample from a sensor",
        "mainEntityOfPage":
            {
            "@type": "CreativeWork",
            "@id": "CW-1"
            }
        },
        {
        "@type": "CreativeWork",
        "@id": "CW-1",
        "name": "label you use for the creative work to describe Thing-1",
        "description": "Thing-1 documentation"
        },
        {
        "@type": "PropertyValue",
        "@id": "PV-1",
        "name": "temperature",
        "value": "10",
        "valueReference": 
            {
            "@type": "PropertyValue",
            "@id": "PV-2"
            }
        },
        {
        "@type": "PropertyValue",
        "@id": "PV-2",
        "unitCode": "http://dbpedia.org/page/Celsius",
        "unitText": "celsius"
        }
    ],
    "@context": "http://schema.org/"
    }
    

    Check it here GSDTT