Exemplo n.º 1
0
 def __init__(self, parentObject=None, resourceDescriptor = {}):
     RESTfulResource.__init__(self, parentObject, resourceDescriptor)
     self._settings = self._resourceDescriptor # use the constructor descriptor for the initial settings
     # link cache keeps endpoints hashed by pathFromBase string, only need to walk the path one time
     self._linkBaseDict = self.Resources.get('baseObject').resources
     self._linkCache = {}
     self._init()
Exemplo n.º 2
0
 def __init__(self, parentObject=None, resourceDescriptor = {}):
     RESTfulResource.__init__(self, parentObject, resourceDescriptor)
     self._settings = self._resourceDescriptor # use the constructor descriptor for the initial settings
     # link cache keeps endpoints hashed by pathFromBase string, only need to walk the path one time
     self._linkBaseDict = self.Resources.get('baseObject').resources
     self._linkCache = {}
     self._init()
Exemplo n.º 3
0
 def __init__(self, parentObject=None, resourceDescriptor={}):
     RESTfulResource.__init__(self, parentObject, resourceDescriptor)
     # make the defaultResources
     self.Description = self.create({'resourceName':'Description',\
                                     'resourceClass': 'Description'})
     self.Agent = self.create({'resourceName':'Agent',\
                               'resourceClass':'Agent'})
Exemplo n.º 4
0
 def __init__(self, parentObject=None, resourceDescriptor = {}):
     RESTfulResource.__init__(self, parentObject, resourceDescriptor) 
     #make default resources
     self.Description = self.create({'resourceName':'Description',\
                                     'resourceClass': 'Description'})
     self.Observers = self.create({'resourceName':'Observers',\
                               'resourceClass':'Observers'})            
Exemplo n.º 5
0
 def __init__(self, parentObject=None, resourceDescriptor = {}):
     RESTfulResource.__init__(self, parentObject, resourceDescriptor)
     # make the defaultResources
     self.Description = self.create({'resourceName':'Description',\
                                     'resourceClass': 'Description'})
     self.Agent = self.create({'resourceName':'Agent',\
                               'resourceClass':'Agent'})            
Exemplo n.º 6
0
 def __init__(self, parentObject=None, resourceDescriptor = {}):
     RESTfulResource.__init__(self, parentObject, resourceDescriptor)
     self._settings = self._resourceDescriptor
     self._baseObject = self.resources['baseObject']
     self._linkBaseDict = self.resources['baseObject'].resources
     self._thisURI =  self.resources['baseObject'].Properties.get('httpService') \
                 + self.resources['parentObject'].resources['parentObject'].Properties.get('pathFromBase')
     self._settings.update({'thisURI': self._thisURI})
     self._init() 
Exemplo n.º 7
0
 def __init__(self, parentObject=None, resourceName=''):
     RESTfulResource.__init__(self, parentObject, resourceName)
     self.graph = Graph()
     self._parseContentTypes = [ 'text/plain' , 'application/rdf+xml' , 'text/rdf+n3' ]
     self._serializeContentTypes = [ 'text/xml' , 'text/plain', 'application/rdf+xml' , 'application/x-turtle' , 'text/rdf+n3' ]
     self.fmt = { 'text/xml' : 'xml', 
            'application/rdf+xml' : 'xml',
            'application/x-turtle' : 'turtle',
            'text/rdf+n3' : 'n3',
            'text/plain' : 'nt'
            }
Exemplo n.º 8
0
 def __init__(self):
     RESTfulResource.__init__(self)
     self.graph = Graph()
     self._parseContentTypes = [ 'text/plain' , 'application/rdf+xml' , 'text/rdf+n3' ]
     self._serializeContentTypes = [ 'text/xml' , 'text/plain', 'application/rdf+xml' , 'application/x-turtle' , 'text/rdf+n3' ]
     self.fmt = { 'text/xml' : 'xml', 
            'application/rdf+xml' : 'xml',
            'application/x-turtle' : 'turtle',
            'text/rdf+n3' : 'n3',
            'text/plain' : 'nt'
            }
Exemplo n.º 9
0
 def __init__(self, parentObject=None, resourceDescriptor = {}):
     RESTfulResource.__init__(self, parentObject, resourceDescriptor)
     self.graph = Graph()
     # see if graph was passed in on the resource constructor
     if 'graph' in resourceDescriptor and any(resourceDescriptor['graph']) :
         self.graph.parse( data=json.dumps(resourceDescriptor['graph']) ,format='rdf-json' )
                             
     self._parseContentTypes = [ 
                                'application/json',
                                'application/rdf+xml' , 
                                'application/json+ld',
                                'text/turtle',
                                'text/n3', 
                                'application/n-triples',
                                'application/n-quads',
                                'application/trix',
                                'text/trig',
                                ]
     
     self._serializeContentTypes = [ 
                                    'application/json', 
                                    'application/rdf+xml' ,
                                    'application/json+ld', 
                                    'text/turtle',
                                    'text/n3',
                                    'application/n-triples',
                                    'application/n-quads', # context
                                    'application/trix', # context
                                    'text/trig',
                                    'text/xml', 
                                    'text/plain' 
                                    ]
     
     # FIXME look at passing cType strings into parser selector, RDFlib plugins register as cType handlers
     self.fmt = {
                 'text/xml' : 'xml', 
                 'application/rdf+xml' : 'xml',
                 'text/turtle' : 'turtle',
                 'test/trig' : 'trig',
                 'text/n3' : 'n3',
                 'application/n-triples' : 'nt',
                 'application/trix' : 'trix',
                 'application/n-quads' : 'nquads',
                 'text/trig' : 'trig',
                 'application/rdf+json' : 'rdf-json',
                 'application/json+ld' : 'json-ld',
                 'application/json' : 'rdf-json',
                 'text/plain' : 'xml' 
                 }
Exemplo n.º 10
0
 def __init__(self, parentObject=None, resourceName=''):
     RESTfulResource.__init__(self, parentObject, resourceName)
     # make a reference to the graph inside the associated Description resource
     self.graph = self.resources['parentObject'].resources['parentObject'].Description.graph
     # This resource supports link-format only
     self._parseContentTypes = [ 'application/link-format' ]
     self._serializeContentTypes = [ 'application/link-format' ]
     self.fmt = { 'application/link-format': 'linkFormat' }
     
     # attribute - predicate bindings RDF - core-link-format
     self._attrToPred = {'rt': RDFS.Resource,
                         'if': RDF.type }
     
     self._predToAttr = {RDFS.Resource: 'rt',
                         RDF.type: 'if' }
Exemplo n.º 11
0
 def __init__(self, parentObject=None, resourceName=''):
     RESTfulResource.__init__(self, parentObject, resourceName)
     # make a reference to the graph inside the associated Description resource
     # move to get and set methods to allow creation of this resource before Description
     # self.graph = self.resources['parentObject'].resources['parentObject'].resources['Description'].graph
     # This resource supports link-format only
     self._parseContentTypes = [ 'application/link-format' ]
     self._serializeContentTypes = [ 'application/link-format' ]
     self.fmt = { 'application/link-format': 'linkFormat' }
     
     # attribute - predicate bindings RDF - core-link-format
     self._attrToPred = {'rt': Literal('resourceType'),
                         'if': Literal('interfaceType') }
     
     self._predToAttr = {Literal('resourceType'): 'rt',
                         Literal('interfaceType') : 'if' }
Exemplo n.º 12
0
 def __init__(self, parentObject=None, resourceName=""):
     RESTfulResource.__init__(self, parentObject, resourceName)
     self.graph = Graph()
     self._parseContentTypes = ["text/plain", "application/rdf+xml", "text/rdf+n3"]
     self._serializeContentTypes = [
         "text/xml",
         "text/plain",
         "application/rdf+xml",
         "application/x-turtle",
         "text/rdf+n3",
     ]
     self.fmt = {
         "text/xml": "xml",
         "application/rdf+xml": "xml",
         "application/x-turtle": "turtle",
         "text/rdf+n3": "n3",
         "text/plain": "nt",
     }
Exemplo n.º 13
0
    def __init__(self, parentObject=None, resourceName=''):
        RESTfulResource.__init__(self, parentObject, resourceName)
        # make a reference to the graph inside the associated Description resource
        # move to get and set methods to allow creation of this resource before Description
        # self.graph = self.resources['parentObject'].resources['parentObject'].resources['Description'].graph
        # This resource supports link-format only
        self._parseContentTypes = ['application/link-format']
        self._serializeContentTypes = ['application/link-format']
        self.fmt = {'application/link-format': 'linkFormat'}

        # attribute - predicate bindings RDF - core-link-format
        self._attrToPred = {
            'rt': Literal('resourceType'),
            'if': Literal('interfaceType')
        }

        self._predToAttr = {
            Literal('resourceType'): 'rt',
            Literal('interfaceType'): 'if'
        }
Exemplo n.º 14
0
 def __init__(self):
     RESTfulResource.__init__(self)
Exemplo n.º 15
0
 def __init__(self, parentObject=None, resourceDescriptor={}):
     RESTfulResource.__init__(self, parentObject, resourceDescriptor)
     self._settings = self._resourceDescriptor
     self._baseObject = self.resources['baseObject']
     self._linkBaseDict = self.resources['baseObject'].resources
     self._init()
Exemplo n.º 16
0
 def __init__(self, parentObject=None, resourceDescriptor = {}):
     RESTfulResource.__init__(self, parentObject, resourceDescriptor)
     self._observers = {}
Exemplo n.º 17
0
 def __init__(self):
     RESTfulResource.__init__(self)
     self._propertyLinks = None 
     self._appHandlerName = None
     self._updateHandler = None # reference to _updateHandler method of AppHandler
Exemplo n.º 18
0
 def __init__(self):
     RESTfulResource.__init__(self)
     self.defaultClass = 'ObservableProperty' # used when a new resource name is used in create
     self.wellKnownClasses = [ 'Description' , 'Observers' , 'PropertyOfInterest' , 'SmartObject' , 'RESTfulResource' , 'Agent' ]
Exemplo n.º 19
0
 def __init__(self):
     RESTfulResource.__init__(self)
Exemplo n.º 20
0
 def __init__(self):
     RESTfulResource.__init__(self)
     self.defaultClass = 'PropertyOfInterest'
Exemplo n.º 21
0
 def __init__(self):
     RESTfulResource.__init__(self)
             
     self.defaultClass = 'Handler'
     self._handlers = {}
Exemplo n.º 22
0
    def __init__(self):
        RESTfulResource.__init__(self)

        self.defaultClass = "Handler"
        self._handlers = {}
Exemplo n.º 23
0
 def __init__(self, parentObject=None, resourceDescriptor = {}):
     RESTfulResource.__init__(self, parentObject, resourceDescriptor)
 def __init__(self):
     RESTfulResource.__init__(self) 
     self.defaultClass = 'PropertyOfInterest'
Exemplo n.º 25
0
 def __init__(self, parentObject=None, resourceDescriptor = {}):
     RESTfulResource.__init__(self, parentObject, resourceDescriptor)
     self._settings = self._resourceDescriptor
     self._baseObject = self.resources['baseObject']
     self._linkBaseDict = self.resources['baseObject'].resources
     self._init() 
Exemplo n.º 26
0
 def __init__(self):
     RESTfulResource.__init__(self)
     self.__schemes = ['http', 'coap', 'callback']
     self.__observers = []
Exemplo n.º 27
0
 def __init__(self):
     RESTfulResource.__init__(self)
     self._propertyLinks = None
     self._appHandlerName = None
     self._updateHandler = None  # reference to _updateHandler method of AppHandler