+ def get_path(self, pathsep='/', field='slug'):
+ path = getattr(self.instance, field, getattr(self.instance, 'slug', '?'))
+ parent = self.parent
+ while parent:
+ path = getattr(parent.instance, field, getattr(parent.instance, 'slug', '?')) + pathsep + path
+ parent = parent.parent
+ return path
+ path = property(get_path)
+
+ @property
+ def attributes(self):
+ if self.parent:
+ return QuerySetMapper(self.instance.attribute_set, passthrough=self.parent.instance.attributes)
+ return QuerySetMapper(self.instance.attribute_set)
+
+ @property
+ def relationships(self):
+ if self.parent:
+ return QuerySetMapper(self.instance.relationship_set, passthrough=self.parent.instance.relationships)
+ return QuerySetMapper(self.instance.relationship_set)
+
+ class Meta:
+ abstract = True
+
+
+class Node(InheritableTreeEntity):