Skip to content
This repository has been archived by the owner. It is now read-only.
Web Of Things Thing Ontology
Branch: cocktail_dev
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cocktail
legacy to be refactored
tools
.directory
.gitignore
LICENSE
README.md
new_thing_example.py

README.md

Cocktail

Within this repository we store all the necessary to start with a Web Of Things implementation.

1. WoT Ontology

The file called wot_ontology.owl contains the ontology we use to represent things. The Classes are

  1. Thing
  2. InteractionPattern (Action, Event, Property)
  3. DataSchema
  4. FieldSchema

And some others that are going to be described in a paper soon.

2. Cocktail python3 framework

Requiring Sepy, you can use the framework to create applications. First you have to run a SEPA instance, then just read up the documentation of the framework.

You should not need to know SPARQL to use Cocktail. However, for very special needs, in the package there are all the basic SPARQL that the framework uses, from which you can take inspiration, and then apply sepy to perform your queries.

Install
$ python3 setup.py build
$ python3 setup.py sdist
$ sudo python3 setup.py \[install|develop\]

3. Tests

For now, tests are available only to check ontology consistency.

$ python3 setup.py test

4. Examples

Coding

To have an example on how to make a WebThing, have a look to the following files.

  1. new_thing_example.py
  2. tools/observe_event.py
  3. tools/request_action.py and in the tests of the cocktail package. Notice that (1) is also useful to see what happens when you start using the wotMonitor.py tool. (2) is a nice runnable script to observe a specific event notifications.
Available tools and experiments

While tools/observe_event.py and tools/request_action.py are useful to learn how to program with Cocktail, they are also invokable from the python command line. Please refer to their -h argument to see how to invoke them.

There is also tools/wotMonitor.py. A typical experiment with wotMonitor.py consists in 0. Run the SEPA

  1. open a terminal, and run
$ cd tools
$ python3 ../new_thing_example.py
  1. Open another terminal, and run
$ python3 wotMonitor.py
  1. call discover
  2. call events
  3. choose http://MyFirstWebThing.com/Event1
  4. see that tools/observe_event.py is called from wotMonitor.py
  5. again from wotMonitor.py, call discover
  6. call actions
  7. choose an action available
  8. see that tools/request_action.py is called from wotMonitor.py and that it prompts you for some input, if the action needs it.
  9. enjoy

Contribute

Feel free to get in touch, if you have any question or suggestions

You can’t perform that action at this time.