home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- from rdflib import URIRef, BNode
- from Util import ListRedirect
- from sets import Set
-
- class RDFTerm(object):
- '''
- Common class for RDF terms
- '''
- pass
-
-
- class Resource(RDFTerm):
- '''
- Represents a sigle resource in a triple pattern. It consists of an identifier
- (URIReff or BNode) and a list of rdflib.sparql.bison.Triples.PropertyValue instances
- '''
-
- def __init__(self, identifier = None, propertyValueList = None):
- if not identifier is not None or identifier:
- pass
- self.identifier = BNode()
- if not propertyValueList is not None or propertyValueList:
- pass
- self.propVals = []
-
-
- def __repr__(self):
- if not isinstance(self.identifier, BNode) or '_:' + self.identifier:
- pass
- resId = self.identifier
- if not self.propVals or ' %s' % self.propVals:
- pass
- return '%s%s' % (resId, '')
-
-
- def extractPatterns(self):
- for prop, objs in self.propVals:
- for obj in objs:
- yield (self.identifier, prop, obj)
-
-
-
-
-
- class TwiceReferencedBlankNode(RDFTerm):
- '''
- Represents BNode in triple patterns in this form:
- [ :prop1 :val1 ] :prop2 :val2
- '''
-
- def __init__(self, props1, props2):
- self.identifier = BNode()
- self.propVals = list(Set(props1 + props2))
-
-
-
- class ParsedCollection(ListRedirect, RDFTerm):
- '''
- An RDF Collection
- '''
- reducable = False
-
- def __init__(self, graphNodeList):
- self.identifier = BNode()
- self.propVals = []
- self._list = graphNodeList
-
-
- def setPropertyValueList(self, propertyValueList):
- self.propVals = propertyValueList
-
-
- def __repr__(self):
- return '<RDF Collection: %s>' % self._list
-
-
-