from SmartObject.SmartObject import SmartObject
from SmartObject.Description import Description
from SmartObject.ObservableProperty import ObservableProperty
from SmartObject.Observers import Observers
from SmartObject.PropertyOfInterest import PropertyOfInterest
from rdflib.term import Literal, URIRef
from rdflib.namespace import RDF, RDFS, XSD, OWL
from ObjectService.HttpObjectService import HttpObjectService
from ObjectService.CoapObjectService import CoapObjectService
from time import sleep
import sys


if __name__ == '__main__' :
    
    baseObject = HttpObjectService(port=8001).baseObject # make a service instance at port 8001 
    print 'httpd started at', baseObject.Properties.get('httpService')
    
    #coapService = CoapObjectService(baseObject)

    # create the weather station resource template
    # emulate the .well-known/core interface
    baseObject.create({'resourceName': '.well-known','resourceClass': 'SmartObject'},\
                        ).create({'resourceName': 'core','resourceClass': 'LinkFormatProxy'})
      
    # sensors resource under the baseObject for all sensors  
    # top level object container for sensors, default class is SmartObject  
    sensors = baseObject.create({'resourceName': 'sensors', 'resourceClass': 'SmartObject'}) 
  
    #weather resource under sensors for the weather sensor
    # create a default class SmartObject for the weather sensor cluster 
Exemple #2
0
@author: mjkoster
'''
from SmartObject.SmartObject import SmartObject
from SmartObject.Description import Description
from SmartObject.ObservableProperty import ObservableProperty
from SmartObject.Observers import Observers
from SmartObject.PropertyOfInterest import PropertyOfInterest
from rdflib.term import Literal, URIRef
from rdflib.namespace import RDF, RDFS, XSD, OWL
from ObjectService.HttpObjectService import HttpObjectService
from time import sleep
import sys

if __name__ == '__main__':

    baseObject = HttpObjectService(
    ).baseObject  # make an instance of the service, default object root and default port 8000
    print 'httpd started at', baseObject.Properties.get('httpService')

    # create the weather station resource template
    # first the description
    baseObject.Description.set(
        (URIRef('sensors/rhvWeather-01'), RDFS.Class, Literal('SmartObject')))
    baseObject.Description.set((URIRef('sensors/rhvWeather-01'), RDFS.Resource,
                                Literal('SensorSystem')))
    baseObject.Description.set(
        (URIRef('sensors/rhvWeather-01'), RDF.type, Literal('WeatherSensor')))

    # sensors resource under the baseObject for all sensors
    sensors = baseObject.create({'resourceName': 'sensors',\
                                 'resourceClass': 'SmartObject'}) # top level object container for sensors, default class is SmartObject
    #weather resource under sensors for the weather sensor
Exemple #3
0
'''
from SmartObject.SmartObject import SmartObject
from SmartObject.Description import Description
from SmartObject.ObservableProperty import ObservableProperty
from SmartObject.Observers import Observers
from SmartObject.PropertyOfInterest import PropertyOfInterest
from rdflib.term import Literal, URIRef
from rdflib.namespace import RDF, RDFS, XSD, OWL
from ObjectService.HttpObjectService import HttpObjectService
from time import sleep
import sys


if __name__ == '__main__' :
    
    baseObject = HttpObjectService().baseObject # make an instance of the service, default object root and default port 8000
    print 'httpd started at', baseObject.Properties.get('httpService')

    # create the weather station resource template
    # first the description 
    baseObject.Description.set((URIRef('sensors/rhvWeather-01'), RDFS.Class, Literal('SmartObject')))
    baseObject.Description.set((URIRef('sensors/rhvWeather-01'), RDFS.Resource, Literal('SensorSystem')))
    baseObject.Description.set((URIRef('sensors/rhvWeather-01'), RDF.type, Literal('WeatherSensor')))
    
    # sensors resource under the baseObject for all sensors    
    sensors = baseObject.create({'resourceName': 'sensors',\
                                 'resourceClass': 'SmartObject'}) # top level object container for sensors, default class is SmartObject
    #weather resource under sensors for the weather sensor    
    weather = sensors.create({'resourceName': 'rhvWeather-01', \
                             'resourceClass': 'SmartObject'}) # create a default class SmartObject for the weather sensor cluster
Exemple #4
0
'''
from SmartObject.SmartObject import SmartObject
from SmartObject.Description import Description
from SmartObject.ObservableProperty import ObservableProperty
from SmartObject.Observers import Observers
from SmartObject.PropertyOfInterest import PropertyOfInterest
from rdflib.term import Literal, URIRef
from rdflib.namespace import RDF, RDFS, XSD, OWL
from ObjectService.HttpObjectService import HttpObjectService
from ObjectService.CoapObjectService import CoapObjectService
from time import sleep
import sys

if __name__ == '__main__':

    baseObject = HttpObjectService(
    ).baseObject  # make an instance of the service, default object root and default port 8000
    print 'httpd started at', baseObject.Properties.get('httpService')

    coapService = CoapObjectService(baseObject)

    # create the weather station resource template
    # emulate the .well-known/core interface
    baseObject.create({'resourceName': '.well-known','resourceClass': 'SmartObject'},\
                        ).create({'resourceName': 'core','resourceClass': 'LinkFormatProxy'})

    # sensors resource under the baseObject for all sensors
    # top level object container for sensors, default class is SmartObject
    sensors = baseObject.create({
        'resourceName': 'sensors',
        'resourceClass': 'SmartObject'
    })
from SmartObject.SmartObject import SmartObject
from SmartObject.Description import Description
from SmartObject.ObservableProperty import ObservableProperty
from SmartObject.Observers import Observers
from SmartObject.PropertyOfInterest import PropertyOfInterest
from rdflib.term import Literal, URIRef
from rdflib.namespace import RDF, RDFS, XSD, OWL
from ObjectService.HttpObjectService import HttpObjectService
from time import sleep
import sys


if __name__ == '__main__' :
    # print 'path = ', sys.path
    baseObject = SmartObject() # create a Smart Object to serve as the base container for other Smart Objects and resources
    server = HttpObjectService(baseObject) # make an instance of the service, baseObject is the object root
    server.start(8000) # forks a server thread to listen on port 8000
    print 'httpd started at', baseObject.Properties.get('httpService')

    # create the weather station resource template
    # first the description 
    baseObject.Description.set((URIRef('sensors/rhvWeather-01'), RDFS.Class, Literal('SmartObject')))
    baseObject.Description.set((URIRef('sensors/rhvWeather-01'), RDFS.Resource, Literal('SensorSystem')))
    baseObject.Description.set((URIRef('sensors/rhvWeather-01'), RDF.type, Literal('WeatherSensor')))
    
    # sensors resource under the baseObject for all sensors    
    sensors = baseObject.create({'resourceName': 'sensors',\
                                 'resourceClass': 'SmartObject'}) # top level object container for sensors, default class is SmartObject
    #weather resource under sensors for the weather sensor    
    weather = sensors.create({'resourceName': 'rhvWeather-01', \
                             'resourceClass': 'SmartObject'}) # create a default class SmartObject for the weather sensor cluster
'''
from SmartObject.SmartObject import SmartObject
from SmartObject.Description import Description
from SmartObject.ObservableProperty import ObservableProperty
from SmartObject.Observers import Observers
from SmartObject.PropertyOfInterest import PropertyOfInterest
from rdflib.term import Literal, URIRef
from rdflib.namespace import RDF, RDFS, XSD, OWL
from ObjectService.HttpObjectService import HttpObjectService
from ObjectService.CoapObjectService import CoapObjectService
from time import sleep
import sys

if __name__ == '__main__':

    baseObject = HttpObjectService(
        port=8001).baseObject  # make a service instance at port 8001
    print 'httpd started at', baseObject.Properties.get('httpService')

    #coapService = CoapObjectService(baseObject)

    # create the weather station resource template
    # emulate the .well-known/core interface
    baseObject.create({'resourceName': '.well-known','resourceClass': 'SmartObject'},\
                        ).create({'resourceName': 'core','resourceClass': 'LinkFormatProxy'})

    # sensors resource under the baseObject for all sensors
    # top level object container for sensors, default class is SmartObject
    sensors = baseObject.create({
        'resourceName': 'sensors',
        'resourceClass': 'SmartObject'
    })
Exemple #7
0
from SmartObject.Description import Description
from SmartObject.ObservableProperty import ObservableProperty
from SmartObject.Observers import Observers
from SmartObject.PropertyOfInterest import PropertyOfInterest
from rdflib.term import Literal, URIRef
from rdflib.namespace import RDF, RDFS, XSD, OWL
from ObjectService.HttpObjectService import HttpObjectService
from time import sleep
import sys

if __name__ == '__main__':
    # print 'path = ', sys.path
    baseObject = SmartObject(
    )  # create a Smart Object to serve as the base container for other Smart Objects and resources
    server = HttpObjectService(
        baseObject
    )  # make an instance of the service, baseObject is the object root
    server.start(8000)  # forks a server thread to listen on port 8000
    print 'httpd started at', baseObject.Properties.get('httpService')

    # create the weather station resource template
    # first the description
    baseObject.Description.set(
        (URIRef('sensors/rhvWeather-01'), RDFS.Class, Literal('SmartObject')))
    baseObject.Description.set((URIRef('sensors/rhvWeather-01'), RDFS.Resource,
                                Literal('SensorSystem')))
    baseObject.Description.set(
        (URIRef('sensors/rhvWeather-01'), RDF.type, Literal('WeatherSensor')))

    # sensors resource under the baseObject for all sensors
    sensors = baseObject.create({'resourceName': 'sensors',\