For my application, I want to model an HTML template in Neo4J, using the MetaModel api.
So I started setting up MetaModelClasses for the various HTML entities. e.g. (code in Scala) val classProp = namespace.getMetaProperty("class", true) val idProp = namespace.getMetaProperty("id", true) idProp.setCardinality(1) val body = namespace.getMetaClass("body", true) body.getDirectProperties(classProp) body.getDirectProperties(idProp) Which creates a class named "body" which has a property named "class" without a cardinality restriction and a property named "id" with a cardinality restriction of 1. Now I can create nodes of class "body" with various values for "class" and for "id". So far so good, but now I want to say that the class body has a property "tagname" which should get the value "body". The meta model itself doesn't allow classes to have properties, but it allows access to the underlying node of the class. So I created a separate namespace for the meta meta classes and added the following three definitions: val tagName = metaNamespace.getMetaProperty("tagname", true) tagName.setCardinality(1) val taggable = metaNamespace.getMetaClass("taggable", true) body.node.setProperty("tagname", "body") This creates a property "tagname" with the value "body" for the class named "body". Now comes the more ambiguous part, how to link "body" to "taggable". I can make body.node an instance of taggable. Once there is a validator, the existence of a "tagname" property with cardinality 1 should be checked, so it is reasonable to make body.node an instance of taggable. At the same time the class body is actually a subclass of taggable, so I am inclined to define that as well. So I end up doing the following: taggable.getDirectInstances.add(body.node) taggable.getDirectSubs.add(body) I would like to know if this is the correct approach to this situation, or whether there are better alternatives. Kind regards, Niels Hoogeveen _________________________________________________________________ New Windows 7: Find the right PC for you. Learn more. http://windows.microsoft.com/shop _______________________________________________ Neo mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user