VIE
VIE copied to clipboard
Lock imported types
There are two ways to extend types in VIE:
var vie = new VIE();
vie.loadSchema("http://schema.rdfs.org/all.json", {baseNS: "http://schema.org/"});
vie.namespaces.base("http://viejs.org/ns/");
vie.namespaces.add("schema", "http://schema.org/");
var TPerson = vie.types.get("schema:Person");
(1) The BAD way - it extends the type directly, and leads to an incoherent type definition
TPerson.attributes.add("depiction", "schema:ImageObject");
(2) The BETTER way - it creates a new subtype which lives in its own namespace
var MyPerson = new v.Type("Person").inherit(TPerson);
MyPerson.attributes.add("depiction", "schema:ImageObject");
vie.types.add(MyPerson);
The issue here is to prevent the developer from doing (1) on load-in types and present him/her with an error message, telling them to do (2). In this way, we can provide a more coherent usage of types through several instances of VIE.