Concept map editor: don't show 'hasType' predicate when assigning concepts
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@1782 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
ecdaf8eb8e
commit
a7bd96600b
2 changed files with 11 additions and 5 deletions
|
@ -82,13 +82,15 @@ There are a few standard objects we can retrieve directly:
|
|||
>>> typeConcept['id'], typeConcept['name']
|
||||
('0', u'type')
|
||||
|
||||
In addition we can get a list of all types and all predicates available:
|
||||
In addition we can get a list of all types and all predicates available;
|
||||
note that the 'hasType' predicate is not shown as it should not be
|
||||
applied in a direct assignment.
|
||||
|
||||
>>> sorted(t['name'] for t in xrf.getConceptTypes())
|
||||
[u'domain', u'file', u'note', u'person', u'predicate', u'query',
|
||||
u'textdocument', u'type']
|
||||
>>> sorted(t['name'] for t in xrf.getPredicates())
|
||||
[u'hasType', u'standard']
|
||||
[u'standard']
|
||||
|
||||
We can also retrieve a certain object by its id or its name:
|
||||
|
||||
|
|
|
@ -48,6 +48,10 @@ class LoopsMethods(MethodPublisher):
|
|||
def concepts(self):
|
||||
return self.context.getConceptManager()
|
||||
|
||||
@Lazy
|
||||
def typePredicate(self):
|
||||
return self.concepts.getTypePredicate()
|
||||
|
||||
def getStartObject(self):
|
||||
so = self.concepts.get('domain', self.concepts.getTypeConcept())
|
||||
return self.getObjectWithChildren(so)
|
||||
|
@ -62,21 +66,21 @@ class LoopsMethods(MethodPublisher):
|
|||
return self.getObjectWithChildren(self.concepts.getDefaultPredicate())
|
||||
|
||||
def getTypePredicate(self):
|
||||
return self.getObjectWithChildren(self.concepts.getTypePredicate())
|
||||
return self.getObjectWithChildren(self.typePredicate)
|
||||
|
||||
def getTypeConcept(self):
|
||||
return self.getObjectWithChildren(self.concepts.getTypeConcept())
|
||||
|
||||
def getConceptTypes(self):
|
||||
tc = self.concepts.getTypeConcept()
|
||||
types = tc.getChildren((self.concepts.getTypePredicate(),))
|
||||
types = tc.getChildren((self.typePredicate,))
|
||||
#types = [t for t in types if ITypeConcept(t).typeInterface ... ]
|
||||
return [objectAsDict(t) for t in types]
|
||||
|
||||
def getPredicates(self):
|
||||
pt = self.concepts.getDefaultPredicate().conceptType
|
||||
preds = pt.getChildren((self.concepts.getTypePredicate(),))
|
||||
return [objectAsDict(p) for p in preds]
|
||||
return [objectAsDict(p) for p in preds if p is not self.typePredicate]
|
||||
|
||||
def getChildren(self, id, predicates=[], child=''):
|
||||
obj = getObjectForUid(id)
|
||||
|
|
Loading…
Add table
Reference in a new issue