Skip to content

Lock imported types #112

Open
neogermi opened this Issue Jun 4, 2012 · 0 comments

1 participant

@neogermi
neogermi commented Jun 4, 2012

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.

@neogermi neogermi pushed a commit to neogermi/VIE that referenced this issue Jun 4, 2012
Sebastian Germesin added locking mechanism for VIE.Types and VIE.Attributes, this addres…
…ses issue #112
620af21
@neogermi neogermi pushed a commit to neogermi/VIE that referenced this issue Jun 4, 2012
Sebastian Germesin added locking mechanism for VIE.Types and VIE.Attributes, this addres…
…ses issue #112
ea973da
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.