692 ask_confirm=self.verbosity>=2) |
692 ask_confirm=self.verbosity>=2) |
693 if addrdef: |
693 if addrdef: |
694 self.commit() |
694 self.commit() |
695 self.rqlexecall(ss.rdef2rql(rschema), |
695 self.rqlexecall(ss.rdef2rql(rschema), |
696 ask_confirm=self.verbosity>=2) |
696 ask_confirm=self.verbosity>=2) |
|
697 if rtype in META_RTYPES: |
|
698 # if the relation is in META_RTYPES, ensure we're adding it for |
|
699 # all entity types *in the persistent schema*, not only those in |
|
700 # the fs schema |
|
701 for etype in self.repo.schema.entities(): |
|
702 if not etype in self.fs_schema: |
|
703 # get sample object type and rproperties |
|
704 objtypes = rschema.objects() |
|
705 assert len(objtypes) == 1 |
|
706 objtype = objtypes[0] |
|
707 props = rschema.rproperties( |
|
708 rschema.subjects(objtype)[0], objtype) |
|
709 assert props |
|
710 self.rqlexecall(ss.rdef2rql(rschema, etype, objtype, props), |
|
711 ask_confirm=self.verbosity>=2) |
|
712 |
697 if commit: |
713 if commit: |
698 self.commit() |
714 self.commit() |
699 |
715 |
700 def cmd_drop_relation_type(self, rtype, commit=True): |
716 def cmd_drop_relation_type(self, rtype, commit=True): |
701 """unregister an existing relation type""" |
717 """unregister an existing relation type""" |