Didn't see any way to convert titanium-Dataset to jena-Dataset. -----Ursprüngliche Nachricht----- Von: Andy Seaborne <[email protected]> Gesendet: Sonntag, 25. Juli 2021 18:58 An: [email protected] Betreff: Re: AW: AW: AW: Storing ThingDescription in Dataset
On 25/07/2021 12:47, Philipp Leeb wrote: > Doesn't work either. What doesn't work? > Is there any other way of how to add my TD in JSOn-LD into my dataset? Produce RDF - for JSON-LD 1.1, find a tool to convert it to any other RDF syntax. The JSON-LD playground will do that. If it can do file to file, any implementation language will do. Exec a process to do the conversion. Or http://rdf.greggkellogg.net/distiller which offers conversion as a service. ---- There is a JIRA waiting for a contribution: https://issues.apache.org/jira/browse/JENA-1948 Andy > > -----Ursprüngliche Nachricht----- > Von: Andy Seaborne <[email protected]> > Gesendet: Sonntag, 25. Juli 2021 13:17 > An: [email protected] > Betreff: Re: AW: AW: Storing ThingDescription in Dataset > > Jena prints an error. > > 2:12:36 ERROR riot :: invalid term definition: 1.1 > > > The playgound says it's JSON-LD 1.1 which is not (yet) supported by > jsonld-java/jsonld-java/. I don't know if it is really using any 1.1 features > but the @context requires it. > > Try > https://github.com/filip26/titanium-json-ld > (I've not used it) > > to convert to RDF and read the RDF. > > Andy > > On 25/07/2021 12:00, Philipp Leeb wrote: >> Hi Andy, >> >> this is the JSON-LD: >> {"id":"urn:dev:ops:32473-wotdirectory-1234","title":"Directory >> Service","properties":{"Temperature":{"description":"Temperature","fo >> r >> ms":[{"href":"http://localhost:8082/urn:dev:ops:32473-wotdirectory-12 >> 3 >> 4/properties/Temperature","op":["readproperty"],"contentType":"applic >> a >> tion/json","htv:methodName":"GET"},{"href":"http://localhost:8082/urn: >> dev:ops:32473-wotdirectory-1234/properties/Temperature/observable","o >> p >> ":["observeproperty"],"subprotocol":"longpoll","contentType":"applica >> t >> ion/json"}],"type":"number","observable":true,"readOnly":true,"@type": >> "saref:Temperature"},"databaseRunning":{"description":"is database >> running","forms":[{"href":"http://localhost:8082/urn:dev:ops:32473-wo >> t >> directory-1234/properties/databaseRunning","op":["readproperty"],"con >> t >> entType":"application/json","htv:methodName":"GET"},{"href":"http://l >> o >> calhost:8082/urn:dev:ops:32473-wotdirectory-1234/properties/databaseR >> u >> nning/observable","op":["observeproperty"],"subprotocol":"longpoll"," >> c >> ontentType":"application/json"}],"type":"boolean","observable":true," >> r >> eadOnly":true,"@type":"saref:OnOffState"},"status":{"forms":[{"href":" >> http://localhost:8082/urn:dev:ops:32473-wotdirectory-1234/properties/ >> s >> tatus","op":["readproperty","writeproperty"],"contentType":"applicati >> o >> n/json"}],"type":"string","@type":"saref:OnOffState"}},"actions":{"ad >> d NewResource":{"description":"Allows to register a new >> resource.","forms":[{"href":"http://localhost:8082/urn:dev:ops:32473- >> w >> otdirectory-1234/actions/addNewResource{?resource}","op":["invokeacti >> o >> n"],"contentType":"application/json","htv:methodName":"POST"}],"uriVa >> r >> iables":{"resource":{"type":"string"}},"input":{"type":"object"},"out >> p >> ut":{"type":"string"}}},"forms":[{"href":"http://localhost:8082/urn:d >> e >> v:ops:32473-wotdirectory-1234/all/properties","op":["readallproperty" >> , >> "readmultipleproperty"],"contentType":"application/json"}],"security": >> ["basic_sc"],"@type":"saref:Device","@context":["https://www.w3.org/2 >> 0 >> 19/wot/td/v1",{"saref":"https://w3id.org/saref#","om":"http://www.wur >> v >> oc.org/vocabularies/om-1.8/","ssn":"http://www.w3.org/ns/ssn/"}],"sec >> u rityDefinitions":{"basic_sc":{"scheme":"basic","in":"header"}}} >> >> This ist he output of JsonLdProcessor.toRdf: >> { >> "@default" : [ { >> "subject" : { >> "type" : "IRI", >> "value" : "urn:dev:ops:32473-wotdirectory-1234" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" >> }, >> "object" : { >> "type" : "IRI", >> "value" : "https://w3id.org/saref#Device" >> } >> }, { >> "subject" : { >> "type" : "IRI", >> "value" : "urn:dev:ops:32473-wotdirectory-1234" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "https://www.w3.org/2019/wot/td#hasActionAffordance" >> }, >> "object" : { >> "type" : "blank node", >> "value" : "_:b0" >> } >> }, { >> "subject" : { >> "type" : "IRI", >> "value" : "urn:dev:ops:32473-wotdirectory-1234" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "https://www.w3.org/2019/wot/td#hasForm" >> }, >> "object" : { >> "type" : "blank node", >> "value" : "_:b5" >> } >> }, { >> "subject" : { >> "type" : "IRI", >> "value" : "urn:dev:ops:32473-wotdirectory-1234" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "https://www.w3.org/2019/wot/td#hasPropertyAffordance" >> }, >> "object" : { >> "type" : "blank node", >> "value" : "_:b6" >> } >> }, { >> "subject" : { >> "type" : "IRI", >> "value" : "urn:dev:ops:32473-wotdirectory-1234" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "https://www.w3.org/2019/wot/td#hasPropertyAffordance" >> }, >> "object" : { >> "type" : "blank node", >> "value" : "_:b9" >> } >> }, { >> "subject" : { >> "type" : "IRI", >> "value" : "urn:dev:ops:32473-wotdirectory-1234" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "https://www.w3.org/2019/wot/td#hasPropertyAffordance" >> }, >> "object" : { >> "type" : "blank node", >> "value" : "_:b12" >> } >> }, { >> "subject" : { >> "type" : "IRI", >> "value" : "urn:dev:ops:32473-wotdirectory-1234" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "https://www.w3.org/2019/wot/td#securityDefinitions" >> }, >> "object" : { >> "type" : "blank node", >> "value" : "_:b14" >> } >> }, { >> "subject" : { >> "type" : "IRI", >> "value" : "urn:dev:ops:32473-wotdirectory-1234" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "https://www.w3.org/2019/wot/td#title" >> }, >> "object" : { >> "type" : "literal", >> "value" : "Directory Service", >> "datatype" : "http://www.w3.org/2001/XMLSchema#string" >> } >> }, { >> "subject" : { >> "type" : "blank node", >> "value" : "_:b0" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "https://www.w3.org/2019/wot/td#description" >> }, >> "object" : { >> "type" : "literal", >> "value" : "Allows to register a new resource.", >> "datatype" : "http://www.w3.org/2001/XMLSchema#string" >> } >> }, { >> "subject" : { >> "type" : "blank node", >> "value" : "_:b0" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "https://www.w3.org/2019/wot/td#hasForm" >> }, >> "object" : { >> "type" : "blank node", >> "value" : "_:b1" >> } >> }, { >> "subject" : { >> "type" : "blank node", >> "value" : "_:b0" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "https://www.w3.org/2019/wot/td#hasInputSchema" >> }, >> "object" : { >> "type" : "blank node", >> "value" : "_:b2" >> } >> }, { >> "subject" : { >> "type" : "blank node", >> "value" : "_:b0" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "https://www.w3.org/2019/wot/td#hasOutputSchema" >> }, >> "object" : { >> "type" : "blank node", >> "value" : "_:b3" >> } >> }, { >> "subject" : { >> "type" : "blank node", >> "value" : "_:b0" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "https://www.w3.org/2019/wot/td#hasUriTemplateVariable" >> }, >> "object" : { >> "type" : "blank node", >> "value" : "_:b4" >> } >> }, { >> "subject" : { >> "type" : "blank node", >> "value" : "_:b1" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "htv:methodName" >> }, >> "object" : { >> "type" : "literal", >> "value" : "POST", >> "datatype" : "http://www.w3.org/2001/XMLSchema#string" >> } >> }, { >> "subject" : { >> "type" : "blank node", >> "value" : "_:b6" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" >> }, >> "object" : { >> "type" : "IRI", >> "value" : "https://w3id.org/saref#Temperature" >> } >> }, { >> "subject" : { >> "type" : "blank node", >> "value" : "_:b6" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "https://www.w3.org/2019/wot/td#description" >> }, >> "object" : { >> "type" : "literal", >> "value" : "Temperature", >> "datatype" : "http://www.w3.org/2001/XMLSchema#string" >> } >> }, { >> "subject" : { >> "type" : "blank node", >> "value" : "_:b6" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "https://www.w3.org/2019/wot/td#hasForm" >> }, >> "object" : { >> "type" : "blank node", >> "value" : "_:b7" >> } >> }, { >> "subject" : { >> "type" : "blank node", >> "value" : "_:b6" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "https://www.w3.org/2019/wot/td#hasForm" >> }, >> "object" : { >> "type" : "blank node", >> "value" : "_:b8" >> } >> }, { >> "subject" : { >> "type" : "blank node", >> "value" : "_:b6" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "https://www.w3.org/2019/wot/td#isObservable" >> }, >> "object" : { >> "type" : "literal", >> "value" : "true", >> "datatype" : "http://www.w3.org/2001/XMLSchema#boolean" >> } >> }, { >> "subject" : { >> "type" : "blank node", >> "value" : "_:b7" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "htv:methodName" >> }, >> "object" : { >> "type" : "literal", >> "value" : "GET", >> "datatype" : "http://www.w3.org/2001/XMLSchema#string" >> } >> }, { >> "subject" : { >> "type" : "blank node", >> "value" : "_:b9" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" >> }, >> "object" : { >> "type" : "IRI", >> "value" : "https://w3id.org/saref#OnOffState" >> } >> }, { >> "subject" : { >> "type" : "blank node", >> "value" : "_:b9" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "https://www.w3.org/2019/wot/td#description" >> }, >> "object" : { >> "type" : "literal", >> "value" : "is database running", >> "datatype" : "http://www.w3.org/2001/XMLSchema#string" >> } >> }, { >> "subject" : { >> "type" : "blank node", >> "value" : "_:b9" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "https://www.w3.org/2019/wot/td#hasForm" >> }, >> "object" : { >> "type" : "blank node", >> "value" : "_:b10" >> } >> }, { >> "subject" : { >> "type" : "blank node", >> "value" : "_:b9" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "https://www.w3.org/2019/wot/td#hasForm" >> }, >> "object" : { >> "type" : "blank node", >> "value" : "_:b11" >> } >> }, { >> "subject" : { >> "type" : "blank node", >> "value" : "_:b9" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "https://www.w3.org/2019/wot/td#isObservable" >> }, >> "object" : { >> "type" : "literal", >> "value" : "true", >> "datatype" : "http://www.w3.org/2001/XMLSchema#boolean" >> } >> }, { >> "subject" : { >> "type" : "blank node", >> "value" : "_:b10" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "htv:methodName" >> }, >> "object" : { >> "type" : "literal", >> "value" : "GET", >> "datatype" : "http://www.w3.org/2001/XMLSchema#string" >> } >> }, { >> "subject" : { >> "type" : "blank node", >> "value" : "_:b12" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" >> }, >> "object" : { >> "type" : "IRI", >> "value" : "https://w3id.org/saref#OnOffState" >> } >> }, { >> "subject" : { >> "type" : "blank node", >> "value" : "_:b12" >> }, >> "predicate" : { >> "type" : "IRI", >> "value" : "https://www.w3.org/2019/wot/td#hasForm" >> }, >> "object" : { >> "type" : "blank node", >> "value" : "_:b13" >> } >> } ] >> } >> >> And when using: >> InputStream in = new >> ByteArrayInputStream(JsonLdProcessor.toRdf(exposedThing.toJson().getB >> y tes(StandardCharsets.UTF_8))); Dataset dataset = >> DatasetFactory.createTxnMem(); RDFDataMgr.read(dataset, in, >> Lang.JSONLD); RDFDataMgr.write(System.out, dataset, Lang.JSONLD); >> >> This ist he output: >> { } >> >> Phil >> >> >> >> >> -----Ursprüngliche Nachricht----- >> Von: Andy Seaborne <[email protected]> >> Gesendet: Sonntag, 25. Juli 2021 12:52 >> An: [email protected] >> Betreff: Re: AW: Storing ThingDescription in Dataset >> >> Hi Phil, >> >> That does not look like JSON-LD. >> >> JSON-LD parsing ignores anything it does not understand, not give an >> error. In your code snippet, no Jena involved, >> >> Object compact >> >> is a jsonld-data object "Dataset" (which isn't a Jena Dataset) with nothing >> in it. >> >> JSON-LD parsing ignores anything it does not understand, not give an error. >> >> Jena translates the output of JsonLdProcessor.toRDF to Jena objects. If >> there is an empty input, you get an empty output. >> >> On 25/07/2021 11:11, Philipp Leeb wrote: >>> Hi Andy, >>> >>> this ist he output when using JsonUtils: >>> { >>> "@default" : [ { >>> "subject" : { >>> "type" : "IRI", >>> "value" : "urn:dev:ops:32473-wotdirectory-1234" >>> }, >>> "predicate" : { >>> "type" : "IRI", >>> "value" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" >>> }, >>> "object" : { >>> "type" : "IRI", >>> "value" : "https://w3id.org/saref#Device" >>> } >> >> That would be in JSON-LD: >> >> { >> "@id" : "urn:dev:ops:32473-wotdirectory-1234", >> "@type" : "https://w3id.org/saref#Device" >> } >> >> or there needs to be a @context >> >> Try it at: >> https://json-ld.org/playground/ >> >> Andy >> >
