Commit a2f806e6 authored by Sylvain's avatar Sylvain
Browse files

* backported subjrproperty/objrproperty ESchema methods

    * new has_[subject|object]_relation methods on ESchema
parent 3113d948dbbd
......@@ -7,6 +7,8 @@ ChangeLog for yams
* support for entities whose fulltext content should be indexed on a related
entity, using new fulltext_container attribute on RelationSchema instance
and new fulltext_relations and fulltext_containers methods on EntitySchema
* backported subjrproperty/objrproperty ESchema methods
* new has_[subject|object]_relation methods on ESchema
2008-02-15 -- 0.16.0
* nicer schema image view
......
......@@ -253,6 +253,11 @@ class EntitySchema(ERSchema):
"""
return self.type in BASE_TYPES
def subjrproperty(self, rschema, prop):
return rschema.rproperty(self.type, rschema.objects(self.type)[0], prop)
def objrproperty(self, rschema, prop):
return rschema.rproperty(rschema.subjects(self.type)[0], self.type, prop)
def is_subobject(self):
"""return True if this entity type is contained by another"""
for rschema in self.object_relations():
......@@ -277,11 +282,20 @@ class EntitySchema(ERSchema):
"""
return self._subj_relations.values()
def has_subject_relation(self, rtype):
"""return True if this entity type as a `rtype` subject relation"""
return rtype in self._subj_relations
def object_relations(self):
"""return a list of relations that may have this type of entity as
object
"""
return self._obj_relations.values()
def has_object_relation(self, rtype):
"""return True if this entity type as a `rtype` object relation"""
return rtype in self._obj_relations
def subject_relation(self, rtype):
"""return the relation schema for the rtype subject relation
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment