js3 icon indicating copy to clipboard operation
js3 copied to clipboard

How do you handle namespace collisions?

Open ghost opened this issue 6 years ago • 0 comments

Impressive project, but the main reason we use a parser instead because different vocabs/namespaces can use the same names and they can collide.

You could have used a simple object with the properties you generate from the RDF vocab. Another, maybe a little faster solution is using a unique id or a Symbol for property name and adding a Symbol - URI map.

var foaf = {
    age: "http://xmlns.com/foaf/0.1/age"
};
var o = {};
o[foaf.age] = 12;
console.log(o[foaf.age]);

I am thinking on something similar, but I guess something more advanced than your lib. I'd like to generate JS prototypes from RDFs classes and vice-versa. It is just something that requires a lot of work if you want to do it properly. For example I'll need to write a validator that understands OWL and XSD. A lot of ppl worked on this kind of projects in the last 10 years, now we have RDF parsers and even a new JSON based format called JSON-LD, so there is definitely some progress.

ghost avatar Feb 09 '20 01:02 ghost