Closed BoraBak closed 2 years ago
Maybe if someone can supply a code example of: TTL -> JSON-LD -> Object
After investigation of the current, it seems that there is no support to parse Turtle from string into an RDFDataset: https://github.com/piprate/json-gold/blob/33b90c4ca86c41ea5c28cfd1ea0a5fd314c91848/ld/serialize_turtle.go#L23 🤦♂️
Nevertheless, if someone could write what's the logical path a program should go through in order to achieve a conversion from a TTL file to a Golang structs?
@BoraBak, apologies for neglecting your issue report. As you have identified, JSON-goLD doesn't support Turtle as either input or output format. At the time this library was created there was no readily available Turtle processing package in Go. Maybe it exists now. If you are aware of one, please let me know and I'll see if I can add support for Turtle. PRs are also welcome.
Hello, my main goal is to convert .ttl file format to an object or a "simple" .json file format. For that, I'm converting the .ttl file to a json-ld. And from there, using the current repo, convert from json-ld to an object.
I tried 2 options in order to convert a .ttl file format to json-ld file format.
1) using
github.com/deiu/rdf2go
- worked2) using
github.com/piprate/json-gold/ld
- didn't work: throwing the following errorpanic: runtime error: invalid memory address or nil pointer dereference
I verified the conversion from TTL to json-ld in the following website: http://rdfvalidator.mybluemix.net/
Then, I tried to convert the json-ld to an object: The object I'm converting to is
Host
. Assume that both outputs from the above functions are writing todata/hosts-ld.json
file.hosts-test.ttl
Below is the json-ld file from the function
convertTtlToJsonLd1()
. Note. the json-ld below is different from the outputs from the website: http://rdfvalidator.mybluemix.net/The
Host
struct: