Error processing valid schema with live loader:

I get an error from live loader when trying to load a file and schema:

Error while processing schema file “ontology.rdf”: rpc error: code = Unknown desc = while lexing <?xml version="1.0" encoding="UTF-8"?> …
at line 1 column 5: Invalid schema: Unexpected character ’ ’ while parsing IRI

Yet the schema is valid according to https://www.w3.org/RDF/Validator/

Seems a single blank space is shutting down my live load. :frowning:

Any ideas?

Edit:
Worked on the first line a bit, and replaced the space with colon. Then it quits on quotation marks.
WTH is wrong with the lexer?

The W3C RDF standards aren’t supported. Dgraph uses a simple type of RDF. Just triples, no other RDF feature like RDF Turtle syntax has for example.

You need to sanitize your data before ingestion.

K, I’ll try that. Thanks.
Sounds delish. I must be hungry. :smirk:

BTW, is this RDF dataset public? if so, would you mind to share? just to take a look.

I’ve been trying to figure out how to best load Geonames.org. I’ve tried converting the Ontology to rdf http://www.geonames.org/ontology/ontology_v3.2.rdf and different kinds of json, and using as the schema for dgraph live loader. No luck so far. Just dies at things it doesn’t like, like quotes, numbers, backslashes…

This is XML RDF. You have to convert it to triple RDF.

So say I’m using http://www.easyrdf.org/converter, what is the output format you recommend from their list? N-triples?

Yes, but I’m not sure if this tool would convert it well. Try the Prótégé.

PS. I’ve tested with this one http://rdf-translator.appspot.com/ and it works. But you need to sanitize the data. My tip is, try to live load it and learn from the error logs output.

Thanks for the tip. I’ll try it out.
I tried just importing their data without a schema, but too many errors.
Questions:
From the docs and tutorials the schemas look pretty basic. You’re just basically saying this object gets this data type. Correct? But there’s a hierarchy to data types, eg. continent>country>state>region>city …
Is that in the schema? Or is that in the data itself?
The schema also decides what gets indexed and what doesn’t, right?
I guess what I’m trying to get at is, what parts do I cut and what parts do I keep from their rdf files?
Is the schema also in triples? Are you basically taking the objects in the schema and attaching the objects in the data?

That Prótégé app looks good. Looking forward to trying it out. Also that translator. But what output do you suggest? RDFa or N-triples?

Dgraph supports only N-triples. No fancy RDF formats.

I’m not sure if Prótége has N-triples exporter, it has CSV exporter for sure. What you can do is “Save as” json-ld. And you can sanitize it a bit. As you can see https://github.com/dgraph-io/dgraph/issues/4897 Dgraph don’t fully support JSON-LD due some conflicts with internal keywords.

One thing you have to pay attention to is that Dgraph does not support ontology. That is, you need to treat/sanitize this dataset before inserting it into Dgraph - and you can “simulate” ontology if you are a advanced user of GraphQL+-. There are several approaches you can take. Always remembering that Dgraph is an N-triple DB, but it is not really a triple store (as is the case with DBs that support ontology).

BTW, there is other cool tool called “OpenRefine” former “Google Refine”. You can import several formats and “refine/sanitize” it. And you can export it to JSON. In “Export => Templating”.

This tool is good to create JSON from CSV or spreadsheets too.

But you need to lear how to use the Refine queries to treat/refine/sanitize the data.

PS. You can use https://json-ld.org/playground/ to transform JSON-LD into triples. Paste the JSON-LD in the input box, and go to N-Quads tab.

Cheers.

Do you mean the relation? it is in the data. The edges are recorded in KV. You don’t need to define the hierarchy. It is “abstract”.

Yes, by the keyword @index(some).

Yes, that’s what I mean whit “sanitize”. As Dgraph doesn’t supports those RDFs, you should “convert” it to a supported format and remove the unnecessary parts.

OMG this Prótégé is awesome! Can finally see what it’s all about.
OK, I think I get what you’re telling me. Thank you for the hints, MichelDiz.

1 Like

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