diff --git a/xmlrpc/README.txt b/xmlrpc/README.txt index 4a99d2f..ac56119 100755 --- a/xmlrpc/README.txt +++ b/xmlrpc/README.txt @@ -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: diff --git a/xmlrpc/common.py b/xmlrpc/common.py index fe20d18..00c9a6d 100644 --- a/xmlrpc/common.py +++ b/xmlrpc/common.py @@ -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)