Hi Laura If I recall correctly, not every JSON document can be parsed as JSON-LD merely by supplying a JSON-LD context. I think it is still the case that arrays of arrays are not valid in JSON-LD, so you may want to check your JSON data to ensure that it complies with that restriction.
I think Martynas Jusevičius is absolutely right to say that different RDF syntaxes and RDF conversion techniques are better suited to different types of data sources. Personally, I like to use XSLT to convert both XML and JSON data to RDF/XML, because although XSLT generally allows use to use a simple templating style like SPARQL-Generate or CSVW, it also allows you to the flexibility to define more complex mapping operations where that's necessary (since XSLT is a Turing-complete programming language). Good luck with your conversions! Con On Wed, 7 Nov 2018 at 20:41, Laura Morales <[email protected]> wrote: > This made me thinking... if I can convert CSV, XML, and other formats to > JSON, and then use JSON-LD context and framing to change the data to my > linking, why do tools such as RML, YARRRML, and SPARQL-Generate exist at > all? Do they do anything at all that can't be done with JSON-LD? > > > > > Sent: Monday, November 05, 2018 at 9:10 AM > From: "Christopher Johnson" <[email protected]> > To: [email protected] > Subject: Re: Loosely converting JSON/XML to RDF > Another approach is to use JSON-LD. A JSON document can be "converted" to > RDF by adding a context and using the toRDF method[1] in one of the JSON-LD > libraries. Defining the context is similar to what is done with RML, > basically mapping data objects to structured vocabulary terms. If your XML > is sufficiently denormalized, you can also convert that to JSON and repeat > the same process as above. > > Christopher Johnson > Scientific Associate > Universitätsbibliothek Leipzig > > [1] https://json-ld.org/spec/latest/json-ld-api/#object-to-rdf-conversion > > On Mon, 5 Nov 2018 at 08:55, Alex To <[email protected]> wrote: > > > We have web services returning XML and JSON in our environment. We use > > > https://github.com/RMLio/rmlmapper-java[https://github.com/RMLio/rmlmapper-java] > to map XML/JSON to RDF with > > satisfied results. > > > > Or course you need a valid URI for your XML or Json elements for e.g. in > > our XML, if we have <Student id="...">...</Student> then we use RML to > map > > it to > > > > > http://ourdomain.com/resources/students/[http://ourdomain.com/resources/students/]{id} > rdfs:type > > http://ourdomain.com/ont/Student[http://ourdomain.com/ont/Student] > > > > You can define your own URI generation scheme whatever works for you > > > > You can read more about RDF Mapping Language (RML) from W3C website. > > > > Regards > > > > On Mon, 5 Nov 2018 at 6:34 pm, Laura Morales <[email protected]> wrote: > > > > > I have a mixed set of datasets in XML, JSON, and RDF formats. I would > > like > > > to convert all the XML/JSON ones to RDF such that I can only use one > > query > > > language/library to access all the data, instead of having three > > different > > > ones. I'm also not interested in using any particular ontology or > > > vocabulary for the conversion, so anything will work as long as I can > > make > > > the conversion. > > > What would be an appropriate strategy for this? Since RDF requires > > > absolute IRIs, would it be a good idea for example to convert all > > > properties to > http://example.org/property-name-1[http://example.org/property-name-1], > > > http://example.org/property-name-2[http://example.org/property-name-2], > ...? And maybe use UUIDs for nodes? > > > Or is there a better way of doing this? > > > > > > -- Conal Tuohy http://conaltuohy.com/ @conal_tuohy +61-466-324297
