Adding RDF triples in turtle format

I am trying to load the data in Dgraph. My data looks like this:

<Observation_WindSpeed_4UT01_2004_8_9_16_25_00>    <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>    <WindSpeedObservation>.
<Observation_WindSpeed_4UT01_2004_8_9_16_25_00>    <observedProperty>    <_WindSpeed>.
<Observation_WindSpeed_4UT01_2004_8_9_16_25_00>    <procedure>    <System_4UT01>.
<MeasureData_WindGust_4UT01_2004_8_9_17_25_00>    <floatValue>    "2.0"^^<http://www.w3.org/2001/XMLSchema#float>.
<MeasureData_WindGust_4UT01_2004_8_9_17_25_00>    <uom>    <milesPerHour>.

Docs says xid edges are not added automatically in mutations. In general it is a user’s responsibility to check for existing xid ’s and add nodes and xid edges if necessary.

Would I have to add xids for each of these subjects because it is not in the format “:_node”?

Turtle RDF isn’t supported at all. It has several syntaxes that the Dgraph’s parser won’t understand.

What you can do is sanitize the data and use the flag --store_xids (that’s only supported with bulkloader).

After store_xids you can use upsert block with this approach https://dgraph.io/docs/mutations/#external-ids-and-upsert-block

See https://dgraph.io/docs/deploy/#other-bulk-loader-options

Another way around to sanitize your data is by using a tool called “OpenRefine”. And use an option to export it as “custom” (don’t quite remember the name, but it will exports in a JSON format. Which is supported by Dgraph)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.