vaimee / SEPA-js

A js client library for SPARQL Event Processing Architecture
https://site.unibo.it/wot/en
2 stars 2 forks source link

JSAP parsing error #5

Open lroffia opened 6 years ago

lroffia commented 6 years ago

Exception

Uncaught SyntaxError: Unexpected token w in JSON at position 1004
at JSON.parse ()
at new Jsap (sepa.js:52)
at onLoad (app.html:97)
at onload (app.html:72)

Validated with: https://jsonformatter.curiousconcept.com/

The JSAP works fine with the Java APIs.

Here the JSAP:

{
    "host": "mml.arces.unibo.it",
    "sparql11protocol": {
        "protocol": "http",
        "port": 8000,
        "query": {
            "path": "/query",
            "method": "POST",
            "format": "JSON"
        },
        "update": {
            "path": "/update",
            "method": "POST",
            "format": "JSON"
        }
    },
    "sparql11seprotocol": {
        "protocol": "ws",
        "availableProtocols": {
            "ws": {
                "port": 9000,
                "path": "/subscribe"
            },
            "wss": {
                "port": 9443,
                "path": "/subscribe"
            }
        }
    },
    "graphs": {
        "default-graph-uri": "http://default",
        "named-graph-uri": "http://default",
        "using-graph-uri": "http://default",
        "using-named-graph-uri": "http://default"
    },
    "namespaces": {
        "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
        "rdfs": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
        "sosa": "http://www.w3.org/ns/sosa/",
        "qudt-1-1": "http://qudt.org/1.1/schema/qudt#",
        "qudt-unit-1-1": "http://qudt.org/1.1/vocab/unit#",
        "arces-monitor": "http://wot.arces.unibo.it/monitor#",
        "mqtt": "http://wot.arces.unibo.it/mqtt#"
    },
    "extended": {
        "simulate": false,
        "mqtt": {
            "url": "giove.arces.unibo.it",
            "port": 52877,
            "topics": ["#"],
            "ssl": false
        },
        "regexTopics": {
            "pepoli:6lowpan:network": [".[|].ID:.(\\w+).[|].(Temperature)[:].(?<value>\\d+.\\d++).[|].\\w+[:].\\d+.\\d++.[|].\\w+[:].\\d+.\\d+\n", ".[|].ID:.(\\w+).[|].\\w+[:].\\d+.\\d++.[|].(Humidity)[:].(?<value>\\d+.\\d++).[|].\\w+[:].\\d+.\\d+\n", ".[|].ID:.(\\w+).[|].\\w+[:].\\d+.\\d++.[|].\\w+[:].\\d+.\\d++.[|].(Pressure)[:].(?<value>\\d+.\\d+)\n"]
        },
        "jsonTopics": {
            "ground/lora/moisture": {
                "id": "nodeId",
                "value": "moistureValue"
            }
        },
        "semantic-mappings": {
            "pepoli/6lowpan/network/NODO1/Temperature": {
                "observation": "arces-monitor:Pepoli-6lowpan-Nodo1-Temperature",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Star",
                "comment": "Temperatura sala server Viale Pepoli (rete 6LowPan)",
                "label": "Temperatura sala server Viale Pepoli"
            },
            "pepoli/6lowpan/network/NODO1/Humidity": {
                "observation": "arces-monitor:Pepoli-6lowpan-Nodo1-Humidity",
                "unit": "qudt-unit-1-1:Percent",
                "location": "arces-monitor:Star",
                "comment": "Umidità sala server Viale Pepoli (rete 6LowPan)",
                "label": "Umidità sala server Viale Pepoli"
            },
            "pepoli/6lowpan/network/NODO1/Pressure": {
                "observation": "arces-monitor:Pepoli-6lowpan-Nodo1-Pressure",
                "unit": "qudt-unit-1-1:Millibar",
                "location": "arces-monitor:Star",
                "comment": "Pressione atmosferica sala server Viale Pepoli (rete 6LowPan)",
                "label": "Pressione atmosferica sala server Viale Pepoli"
            },
            "pepoli/6lowpan/network/NODO2/Temperature": {
                "observation": "arces-monitor:Pepoli-6lowpan-Nodo2-Temperature",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Star",
                "comment": "Temperatura ufficio Luca Perilli (rete 6LowPan)",
                "label": "Temperatura ufficio Luca Perilli"
            },
            "pepoli/6lowpan/network/NODO2/Humidity": {
                "observation": "arces-monitor:Pepoli-6lowpan-Nodo2-Humidity",
                "unit": "qudt-unit-1-1:Percent",
                "location": "arces-monitor:Star",
                "comment": "Umidità ufficio SLuca Perilli (rete 6LowPan)",
                "label": "Umidità ufficio Luca Perilli"
            },
            "pepoli/6lowpan/network/NODO2/Pressure": {
                "observation": "arces-monitor:Pepoli-6lowpan-Nodo2-Pressure",
                "unit": "qudt-unit-1-1:Millibar",
                "location": "arces-monitor:Star",
                "comment": "Pressione atmosferica ufficio SLuca Perilli (rete 6LowPan)",
                "label": "Pressione atmosferica sala server Viale Pepoli"
            },
            "pepoli/6lowpan/network/NODO3/Temperature": {
                "observation": "arces-monitor:Pepoli-6lowpan-Nodo3-Temperature",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Star",
                "comment": "Temperatura Blue Hall (rete 6LowPan)",
                "label": "Temperatura Blue Hall"
            },
            "pepoli/6lowpan/network/NODO3/Humidity": {
                "observation": "arces-monitor:Pepoli-6lowpan-Nodo3-Humidity",
                "unit": "qudt-unit-1-1:Percent",
                "location": "arces-monitor:Star",
                "comment": "Umidità Blue Hall (rete 6LowPan)",
                "label": "Umidità Blue Hall"
            },
            "pepoli/6lowpan/network/NODO3/Pressure": {
                "observation": "arces-monitor:Pepoli-6lowpan-Nodo3-Pressure",
                "unit": "qudt-unit-1-1:Millibar",
                "location": "arces-monitor:Star",
                "comment": "Pressione atmosferica Blue Hall (rete 6LowPan)",
                "label": "Pressione atmosferica Blue Hall"
            },
            "ground/lora/moisture/device1": {
                "observation": "arces-monitor:ground-lora-moisture-device1",
                "unit": "qudt-unit-1-1:Percent",
                "location": "arces-monitor:Star",
                "comment": "Umidità giardino 1 (rete LoRa)",
                "label": "Umidità giardino"
            },
            "ground/lora/moisture/device2": {
                "observation": "arces-monitor:ground-lora-moisture-device2",
                "unit": "qudt-unit-1-1:Percent",
                "location": "arces-monitor:Star",
                "comment": "Umidità giardino 2 (rete LoRa)",
                "label": "Umidità giardino"
            },
            "arces/servers/ares/ercole/cpu/core-20/temperature": {
                "observation": "arces-monitor:ServerErcoleCore20",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Ares",
                "comment": "Temperatura Server ERCOLE Core 20",
                "label": "Temperatura Server ERCOLE Core 20"
            },
            "arces/servers/ares/ercole/cpu/core-19/temperature": {
                "observation": "arces-monitor:ServerErcoleCore19",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Ares",
                "comment": "Temperatura Server ERCOLE Core 19",
                "label": "Temperatura Server ERCOLE Core 19"
            },
            "arces/servers/ares/ercole/cpu/core-18/temperature": {
                "observation": "arces-monitor:ServerErcoleCore18",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Ares",
                "comment": "Temperatura Server ERCOLE Core 18",
                "label": "Temperatura Server ERCOLE Core 18"
            },
            "arces/servers/ares/ercole/cpu/core-17/temperature": {
                "observation": "arces-monitor:ServerErcoleCore17",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Ares",
                "comment": "Temperatura Server ERCOLE Core 17",
                "label": "Temperatura Server ERCOLE Core 17"
            },
            "arces/servers/ares/ercole/cpu/core-16/temperature": {
                "observation": "arces-monitor:ServerErcoleCore16",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Ares",
                "comment": "Temperatura Server ERCOLE Core 16",
                "label": "Temperatura Server ERCOLE Core 16"
            },
            "arces/servers/ares/ercole/cpu/core-15/temperature": {
                "observation": "arces-monitor:ServerErcoleCore15",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Ares",
                "comment": "Temperatura Server ERCOLE Core 15",
                "label": "Temperatura Server ERCOLE Core 15"
            },
            "arces/servers/ares/ercole/cpu/core-14/temperature": {
                "observation": "arces-monitor:ServerErcoleCore14",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Ares",
                "comment": "Temperatura Server ERCOLE Core 14",
                "label": "Temperatura Server ERCOLE Core 14"
            },
            "arces/servers/ares/ercole/cpu/core-13/temperature": {
                "observation": "arces-monitor:ServerErcoleCore13",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Ares",
                "comment": "Temperatura Server ERCOLE Core 13",
                "label": "Temperatura Server ERCOLE Core 13"
            },
            "arces/servers/ares/ercole/cpu/core-12/temperature": {
                "observation": "arces-monitor:ServerErcoleCore12",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Ares",
                "comment": "Temperatura Server ERCOLE Core 12",
                "label": "Temperatura Server ERCOLE Core 12"
            },
            "arces/servers/ares/ercole/cpu/core-11/temperature": {
                "observation": "arces-monitor:ServerErcoleCore11",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Ares",
                "comment": "Temperatura Server ERCOLE Core 11",
                "label": "Temperatura Server ERCOLE Core 11"
            },
            "arces/servers/ares/ercole/cpu/core-10/temperature": {
                "observation": "arces-monitor:ServerErcoleCore10",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Ares",
                "comment": "Temperatura Server ERCOLE Core 10",
                "label": "Temperatura Server ERCOLE Core 10"
            },
            "arces/servers/ares/ercole/cpu/core-9/temperature": {
                "observation": "arces-monitor:ServerErcoleCore9",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Ares",
                "comment": "Temperatura Server ERCOLE Core 9",
                "label": "Temperatura Server ERCOLE Core 9"
            },
            "arces/servers/ares/ercole/cpu/core-8/temperature": {
                "observation": "arces-monitor:ServerErcoleCore8",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Ares",
                "comment": "Temperatura Server ERCOLE Core 8",
                "label": "Temperatura Server ERCOLE Core 8"
            },
            "arces/servers/ares/ercole/cpu/core-7/temperature": {
                "observation": "arces-monitor:ServerErcoleCore7",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Ares",
                "comment": "Temperatura Server ERCOLE Core 7",
                "label": "Temperatura Server ERCOLE Core 7"
            },
            "arces/servers/ares/ercole/cpu/core-6/temperature": {
                "observation": "arces-monitor:ServerErcoleCore6",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Ares",
                "comment": "Temperatura Server ERCOLE Core 6",
                "label": "Temperatura Server ERCOLE Core 6"
            },
            "arces/servers/ares/ercole/cpu/core-5/temperature": {
                "observation": "arces-monitor:ServerErcoleCore5",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Ares",
                "comment": "Temperatura Server ERCOLE Core 5",
                "label": "Temperatura Server ERCOLE Core 5"
            },
            "arces/servers/ares/ercole/cpu/core-4/temperature": {
                "observation": "arces-monitor:ServerErcoleCore4",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Ares",
                "comment": "Temperatura Server ERCOLE Core 4",
                "label": "Temperatura Server ERCOLE Core 4"
            },
            "arces/servers/ares/ercole/cpu/core-3/temperature": {
                "observation": "arces-monitor:ServerErcoleCore3",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Ares",
                "comment": "Temperatura Server ERCOLE Core 3",
                "label": "Temperatura Server ERCOLE Core 3"
            },
            "arces/servers/ares/ercole/cpu/core-2/temperature": {
                "observation": "arces-monitor:ServerErcoleCore2",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Ares",
                "comment": "Temperatura Server ERCOLE Core 2",
                "label": "Temperatura Server ERCOLE Core 2"
            },
            "arces/servers/ares/ercole/cpu/core-1/temperature": {
                "observation": "arces-monitor:ServerErcoleCore1",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Ares",
                "comment": "Temperatura Server ERCOLE Core 1",
                "label": "Temperatura Server ERCOLE Core 1"
            },
            "arces/servers/mars/mml/cpu/core-6/temperature": {
                "observation": "arces-monitor:ServerMml6",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Mars",
                "comment": "Temperatura Server MML Core 6",
                "label": "Temperatura Server MML Core 6"
            },
            "arces/servers/mars/mml/cpu/core-5/temperature": {
                "observation": "arces-monitor:ServerMml5",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Mars",
                "comment": "Temperatura Server MML Core 5",
                "label": "Temperatura Server MML Core 5"
            },
            "arces/servers/mars/mml/cpu/core-4/temperature": {
                "observation": "arces-monitor:ServerMml4",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Mars",
                "comment": "Temperatura Server MML Core 4",
                "label": "Temperatura Server MML Core 4"
            },
            "arces/servers/mars/mml/cpu/core-3/temperature": {
                "observation": "arces-monitor:ServerMml3",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Mars",
                "comment": "Temperatura Server MML Core 3",
                "label": "Temperatura Server MML Core 3"
            },
            "arces/servers/mars/mml/cpu/core-2/temperature": {
                "observation": "arces-monitor:ServerMml2",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Mars",
                "comment": "Temperatura Server MML Core 2",
                "label": "Temperatura Server MML Core 2"
            },
            "arces/servers/mars/mml/cpu/core-1/temperature": {
                "observation": "arces-monitor:ServerMml1",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Mars",
                "comment": "Temperatura Server MML Core 1",
                "label": "Temperatura Server MML Core 1"
            },
            "arces/servers/mars/giove/cpu/core-6/temperature": {
                "observation": "arces-monitor:ServerGiove6",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Mars",
                "comment": "Temperatura Server GIOVE Core 6",
                "label": "Temperatura Server GIOVE Core 6"
            },
            "arces/servers/mars/giove/cpu/core-5/temperature": {
                "observation": "arces-monitor:ServerGiove5",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Mars",
                "comment": "Temperatura Server GIOVE Core 5",
                "label": "Temperatura Server GIOVE Core 5"
            },
            "arces/servers/mars/giove/cpu/core-4/temperature": {
                "observation": "arces-monitor:ServerGiove4",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Mars",
                "comment": "Temperatura Server GIOVE Core 4",
                "label": "Temperatura Server GIOVE Core 4"
            },
            "arces/servers/mars/giove/cpu/core-3/temperature": {
                "observation": "arces-monitor:ServerGiove3",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Mars",
                "comment": "Temperatura Server GIOVE Core 3",
                "label": "Temperatura Server GIOVE Core 3"
            },
            "arces/servers/mars/giove/cpu/core-2/temperature": {
                "observation": "arces-monitor:ServerGiove2",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Mars",
                "comment": "Temperatura Server GIOVE Core 2",
                "label": "Temperatura Server GIOVE Core 2"
            },
            "arces/servers/mars/giove/cpu/core-1/temperature": {
                "observation": "arces-monitor:ServerGiove1",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Mars",
                "comment": "Temperatura Server GIOVE Core 1",
                "label": "Temperatura Server GIOVE Core 1"
            },
            "arces/servers/mars/mml/hd/sda/temperature": {
                "observation": "arces-monitor:ServerMmlHDDSda",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Mars",
                "comment": "Temperatura Server MML HDD SDA",
                "label": "Temperatura Server MML HDD SDA"
            },
            "arces/servers/mars/mml/hd/sdb/temperature": {
                "observation": "arces-monitor:ServerMmlHDDSdb",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Mars",
                "comment": "Temperatura Server MML HDD SDB",
                "label": "Temperatura Server MML HDD SDB"
            },
            "arces/servers/mars/giove/hd/sda/temperature": {
                "observation": "arces-monitor:ServerGioveHDDSda",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Mars",
                "comment": "Temperatura Server GIOVE HDD SDA",
                "label": "Temperatura Server GIOVE HDD SDA"
            },
            "arces/servers/mars/giove/hd/sdb/temperature": {
                "observation": "arces-monitor:ServerGioveHDDSdb",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Mars",
                "comment": "Temperatura Server GIOVE HDD SDB",
                "label": "Temperatura Server GIOVE HDD SDB"
            },
            "arces/servers/mars/giove/hd/sdc/temperature": {
                "observation": "arces-monitor:ServerGioveHDDSdc",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Mars",
                "comment": "Temperatura Server GIOVE HDD SDC",
                "label": "Temperatura Server GIOVE HDD SDC"
            },
            "arces/servers/mars/giove/hd/sdd/temperature": {
                "observation": "arces-monitor:ServerGioveHDDSdd",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Mars",
                "comment": "Temperatura Server GIOVE HDD SDD",
                "label": "Temperatura Server GIOVE HDD SDD"
            },
            "arces/servers/mars/giove/hd/sdf/temperature": {
                "observation": "arces-monitor:ServerGioveHDDSdf",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Mars",
                "comment": "Temperatura Server GIOVE HDD SDF",
                "label": "Temperatura Server GIOVE HDD SDF"
            },
            "arces/servers/mars/giove/hd/sdg/temperature": {
                "observation": "arces-monitor:ServerGioveHDDSdg",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Mars",
                "comment": "Temperatura Server GIOVE HDD SDG",
                "label": "Temperatura Server GIOVE HDD SDG"
            },
            "arces/servers/mars/giove/hd/sdh/temperature": {
                "observation": "arces-monitor:ServerGioveHDDSdh",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Mars",
                "comment": "Temperatura Server GIOVE HDD SDH",
                "label": "Temperatura Server GIOVE HDD SDH"
            },
            "arces/servers/mars/marsamba/hd/sda/temperature": {
                "observation": "arces-monitor:ServerSambaHDDSda",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Mars",
                "comment": "Temperatura Server SAMBA HDD SDA",
                "label": "Temperatura Server SAMBA HDD SDA"
            },
            "arces/servers/mars/marsamba/hd/sdb/temperature": {
                "observation": "arces-monitor:ServerSambaHDDSdb",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Mars",
                "comment": "Temperatura Server SAMBA HDD SDB",
                "label": "Temperatura Server SAMBA HDD SDB"
            },
            "arces/servers/ares/ercole/hd/sda/temperature": {
                "observation": "arces-monitor:ServerErcoleHDDSda",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Ares",
                "comment": "Temperatura Server ERCOLE HDD SDA",
                "label": "Temperatura Server ERCOLE HDD SDA"
            },
            "arces/servers/ares/ercole/hd/sdb/temperature": {
                "observation": "arces-monitor:ServerErcoleHDDSdb",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Ares",
                "comment": "Temperatura Server ERCOLE HDD SDB",
                "label": "Temperatura Server ERCOLE HDD SDB"
            },
            "5CCF7F15676D/temperature": {
                "observation": "arces-monitor:5CCF7F15676D-temperature",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Mars",
                "comment": "Temperatura zona rack sala server Toffano",
                "label": "Temperatura zona rack"
            },
            "5CCF7F15676D/humidity": {
                "observation": "arces-monitor:5CCF7F15676D-humidity",
                "unit": "qudt-unit-1-1:Percent",
                "location": "arces-monitor:Mars",
                "comment": "Umidità zona rack sala server Toffano",
                "label": "Umidità zona rack"
            },
            "5CCF7F1B599E/temperature": {
                "observation": "arces-monitor:5CCF7F1B599E-temperature",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Mars",
                "comment": "Temperatura zona finestra sala server Toffano",
                "label": "Temperatura zona finestra"
            },
            "5CCF7F1B599E/humidity": {
                "observation": "arces-monitor:5CCF7F1B599E-humidity",
                "unit": "qudt-unit-1-1:Percent",
                "location": "arces-monitor:Mars",
                "comment": "Umidità zona finestra sala server Toffano",
                "label": "Umidità zona finestra"
            },
            "5CCF7F151DC9/temperature": {
                "observation": "arces-monitor:5CCF7F151DC9-temperature",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Mars",
                "comment": "Temperatura esterna sala server Toffano",
                "label": "Temperatura esterna"
            },
            "5CCF7F1B58AC/temperature": {
                "observation": "arces-monitor:5CCF7F1B58AC-temperature",
                "unit": "qudt-unit-1-1:DegreeCelsius",
                "location": "arces-monitor:Star",
                "comment": "Temperatura zona rack sala server Pepoli",
                "label": "Temperatura zona rack"
            },
            "5CCF7F1B58AC/humidity": {
                "observation": "arces-monitor:5CCF7F1B58AC-humidity",
                "unit": "qudt-unit-1-1:Percent",
                "location": "arces-monitor:Star",
                "comment": "Umidità zona rack sala server Pepoli",
                "label": "Umidità zona rack"
            }
        }
    },
    "updates": {
        "MQTT_MESSAGE": {
            "sparql": "DELETE {?node mqtt:hasValue ?oldValue } INSERT {?node rdf:type mqtt:Node ; mqtt:hasValue ?value ; mqtt:hasTopic ?topic ; mqtt:hasBroker ?broker } WHERE { {BIND(IRI(CONCAT(\"http://wot.arces.unibo.it/mqtt#Node-\",STRUUID())) AS ?node) . FILTER NOT EXISTS {?nodeOld rdf:type mqtt:Node ; mqtt:hasTopic ?topic ; mqtt:hasBroker ?broker } } UNION { ?node mqtt:hasTopic ?topic ; mqtt:hasBroker ?broker ; mqtt:hasValue ?oldValue ; rdf:type mqtt:Node } }",
            "forcedBindings": {
                "value": {
                    "type": "literal",
                    "value": ""
                },
                "topic": {
                    "type": "literal",
                    "value": ""
                },
                "broker": {
                    "type": "literal",
                    "value": ""
                }
            }
        },
        "ADD_OBSERVATION": {
            "sparql": "DELETE {?quantity qudt-1-1:numericValue ?value} WHERE {?observation rdf:type sosa:Observation ; sosa:hasResult ?quantity. ?quantity qudt-1-1:numericValue ?value}; DELETE {?observation rdf:type sosa:Observation ; rdfs:label ?X ; sosa:hasFeatureOfInterest ?locati ; sosa:hasResult ?quantityOLD . ?quantityOLD rdf:type qudt-1-1:QuantityValue ; qudt-1-1:unit ?unitOLD} WHERE {?observation rdf:type sosa:Observation ; rdfs:label ?labelOLD ; sosa:hasFeatureOfInterest ?locationOLD ; sosa:hasResult ?quantityOLD . ?quantityOLD rdf:type qudt-1-1:QuantityValue ; qudt-1-1:unit ?unitOLD};INSERT {?observation rdf:type sosa:Observation ; rdfs:label ?label ; rdfs:comment ?comment ; sosa:hasFeatureOfInterest ?location ; arces-monitor:hasMqttTopic ?topic ; sosa:hasResult ?quantity . ?quantity rdf:type qudt-1-1:QuantityValue ; qudt-1-1:unit ?unit} WHERE {BIND(IRI(CONCAT(\"http://wot.arces.unibo.it/monitor#QuantityValue-\",STRUUID())) AS ?quantity)}",
            "forcedBindings": {
                "observation": {
                    "type": "uri",
                    "value": ""
                },
                "comment": {
                    "type": "literal",
                    "value": ""
                },
                "label": {
                    "type": "literal",
                    "value": ""
                },
                "location": {
                    "type": "uri",
                    "value": ""
                },
                "topic": {
                    "type": "literal",
                    "value": ""
                },
                "unit": {
                    "type": "uri",
                    "value": ""
                }
            }
        },
        "UPDATE_OBSERVATION_VALUE": {
            "sparql": "DELETE {?quantity qudt-1-1:numericValue ?oldValue} INSERT {?quantity qudt-1-1:numericValue ?value} WHERE {?observation rdf:type sosa:Observation ; sosa:hasResult ?quantity . OPTIONAL {?quantity qudt-1-1:numericValue ?oldValue}}",
            "forcedBindings": {
                "observation": {
                    "type": "uri",
                    "value": ""
                },
                "value": {
                    "type": "literal",
                    "value": ""
                }
            }
        }
    },
    "queries": {
        "OBSERVATIONS_TOPICS": {
            "sparql": "SELECT ?observation ?topic WHERE {?observation rdf:type sosa:Observation ; arces-monitor:hasMqttTopic ?topic}"
        },
        "OBSERVATIONS": {
            "sparql": " SELECT ?observation ?location ?label ?value ?unit WHERE {?observation rdf:type sosa:Observation ; rdfs:label ?label ; sosa:hasFeatureOfInterest ?location ; sosa:hasResult ?quantity . ?quantity rdf:type qudt-1-1:QuantityValue ; qudt-1-1:unit ?unit ;  qudt-1-1:numericValue ?value}"
        },
        "OBSERVATIONS_BY_LOCATION": {
            "sparql": " SELECT ?label ?value ?unit WHERE { ?observation sosa:hasFeatureOfInterest ?location ; rdf:type sosa:Observation ; rdfs:label ?label ; sosa:hasResult ?quantity . ?quantity rdf:type qudt-1-1:QuantityValue ; qudt-1-1:unit ?unit ;  qudt-1-1:numericValue ?value}",
            "forcedBindings": {
                "location": {
                    "type": "uri",
                    "value": ""
                }
            }
        },
        "OBSERVATIONS_BY_UNIT": {
            "sparql": " SELECT ?location ?label ?value WHERE {?observation rdf:type sosa:Observation ; rdfs:label ?label ; sosa:hasFeatureOfInterest ?location ; sosa:hasResult ?quantity . ?quantity rdf:type qudt-1-1:QuantityValue ; qudt-1-1:unit ?unit ;  qudt-1-1:numericValue ?value}",
            "forcedBindings": {
                "unit": {
                    "type": "uri",
                    "value": ""
                }
            }
        },
        "ALL_VALUES": {
            "sparql": " SELECT ?location ?label ?value ?unit WHERE {?observation rdf:type sosa:Observation ; rdfs:label ?label ; sosa:hasFeatureOfInterest ?location ; sosa:hasResult ?quantity . ?quantity rdf:type qudt-1-1:QuantityValue ; qudt-1-1:unit ?unit ;  qudt-1-1:numericValue ?value}",
            "forcedBindings": {
                "observation": {
                    "type": "uri",
                    "value": ""
                }
            }
        },
        "COUNT_TOPICS": {
            "sparql": "SELECT (COUNT(?topic) AS ?topics) WHERE {?node rdf:type mqtt:Node ; mqtt:hasTopic ?topic}"
        },
        "TOPIC": {
            "sparql": "SELECT ?topic WHERE {?node rdf:type mqtt:Node ; mqtt:hasTopic ?topic}"
        },
        "VALUE": {
            "sparql": "SELECT ?value WHERE {?node rdf:type mqtt:Node ; mqtt:hasTopic ?topic; mqtt:hasValue ?value}",
            "forcedBindings": {
                "topic": {
                    "type": "literal",
                    "value": ""
                }
            }
        },
        "NODE": {
            "sparql": "SELECT ?topic ?value WHERE {?node rdf:type mqtt:Node ; mqtt:hasValue ?value ; mqtt:hasTopic ?topic}"
        }
    }
}
lroffia commented 6 years ago

Loading the JSAP via AJAX is fine:

<script type="text/javascript"> window.addEvent("domready", function() { var ajaxRequest = new Request({ url : "mqtt.jsap", onSuccess : function(jsap) { subscribe2(jsap,"OBSERVATIONS"); } }).send(); }); </script>

Using a variable to store the JSAP causes the error:

<script> function onLoad() { subscribe2(jsap,"OBSERVATIONS"); } var jsap = '...' </script>

relu91 commented 6 years ago

It's quite strange, cause it's parsed by native javascript call JSON.parse.

How do you call the constructor? How JSPA is stored?

lroffia commented 6 years ago

It is not related to the JSAP api. It depends on how the jsap is specified (as variable or file)

relu91 commented 6 years ago

Did you store the string with backticks?

Have a look here

lroffia commented 6 years ago

Just tried. It still fails.

Il giorno 04 mag 2018, alle ore 12:40, Cristiano Aguzzi notifications@github.com ha scritto:

Did you store the string with backticks?

Have a look here https://stackoverflow.com/questions/805107/creating-multiline-strings-in-javascript?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/arces-wot/SEPA-js/issues/5#issuecomment-386564194, or mute the thread https://github.com/notifications/unsubscribe-auth/AOgdcZgB4oUYM0IoxjzsjhvjrMxKbl2Lks5tvDA4gaJpZM4TyaUu.