dog ont in dog

Download Dog Ont In Dog

Post on 20-May-2015

627 views

Category:

Documents

3 download

Embed Size (px)

DESCRIPTION

How to exploit DogOnt concepts and instances to empower the DOG residential gateway

TRANSCRIPT

  • 1. DogOnt in Dog
    Ontology related tasks in Dog2.0
    Dario Bonino
    Politecnicodi Torino, e-Lite research group
    http://elite.polito.it

2. Outline
Dog2.0
Device categories
Device models
Automatic Generation
Queries
4/30/2010
DogOnt in Dog: Ontology related tasks in Dog2.0
2
3. Dog2.0
Device instances and classes in DogOnt can be associated to 2 different components of the Dog2.0 architecture
DeviceCategory
Defines how a Driver service and a Device service can cooperate (by defining a Java Interface)
DeviceModel
A representation of a physical device that can be attached to a Driver service
4/30/2010
DogOnt in Dog: Ontology related tasks in Dog2.0
3
4. Device Category (structure)
4/30/2010
DogOnt in Dog: Ontology related tasks in Dog2.0
4
Lighting
public interface Lamp extends Lighting
{
public static intMATCH_TYPE=100;
public static intMATCH_SUB_TYPE=50;
public static intMATCH_MANUFACTURER=0;
public static StringON_OFF_STATE = "OnOffState";
public void off();
public void on();
}
isA
Lamp
OnOffState
hasState
instance
Lamp
hasFunctionality
OnOffFunctionality
hasCommand
hasCommand
OnCommand
OffCommand
5. Device Category (Hi-Fi)
4/30/2010
DogOnt in Dog: Ontology related tasks in Dog2.0
5
package it.polito.elite.domotics.model.devicecategory;
/**
* HiFiCategory - automatically generated by DogOnt2Dog
*/
public interface HiFi extends Entertainment
{
public static intMATCH_TYPE=100;
public static intMATCH_SUB_TYPE=50;
public static intMATCH_MANUFACTURER=0;
public static String STAND_BY_ON_OFF_STATE = "StandByOnOffState";
public static String SOURCE_SELECTION_STATE = "SourceSelectionState";
public static String PLAY_STATE = "PlayState";
public static String TUNER_STATE = "TunerState";
public static String VOLUME_LEVEL_STATE = "VolumeLevelState";
public void stop();
public void stepUp();
public void rew();
public void set(Object value);
public void setVolume(Integer volume);
public void next();

public void goToTrack(Integer trackNumber);
}
6. Device Model (Structure)
4/30/2010
DogOnt in Dog: Ontology related tasks in Dog2.0
6
public class DogLamp extends DogDevice implements Lamp
{
public DogLamp(BundleContext context, Properties properties){
super(context);
if(properties==null)
properties=new Properties();
properties.put(Constants.DEVICE_CATEGORY, Lamp.class.getCanonicalName());
this.setDeviceProperties(properties);
this.states.put(Lamp.ON_OFF_STATE,
new DogStatusVariable(
properties.getProperty(DogDeviceCostants.DEVICEURI),
new StatusVariable(Lamp.ON_OFF_STATE, StatusVariable.CM_DER, "-"),
"current state of Lamp",true));
this.registerDevice(Lamp.class.getName());
this.registerStatusVariable();
}
@Override
public void off(){
((Lamp) this.driver).off();
}
@Override
public void on(){
((Lamp) this.driver).on();
}
}
Lighting
OnOffState
hasState
isA
Lamp
Lamp
hasFunctionality
OffCommand
instance
hasCommand
OnOffFunctionality
OnCommand
7. Automatic Generation
Template based
Common structure of device categories and device models
Fill placeholders (possibly empty) with information extracted from DogOnt
SPARQL
Works on the schema only
4/30/2010
DogOnt in Dog: Ontology related tasks in Dog2.0
7
8. Automatic Generation (recipe)
Device Categories
Device Models
GetAllDevicesWithAncestors
Foreach device
getDeviceCommands
getDeviceStates
Write the device category code
Compile all
Jar all with manifest (bundleize)
Use in Dog2.0
GetAllDevicesWithAncestors
Foreach device
getDeviceCommands
getDeviceStates
Write the device model code
Compile all
Jar all with manifest (bundleize)
Use in Dog2.0
4/30/2010
DogOnt in Dog: Ontology related tasks in Dog2.0
8
9. Queries (1) - Devices
Get all devices with ancestors
SELECT DISTINCT ?x WHERE { ?x rdfs:subClassOfdogont:Controllable FILTER (?x!=owl:Nothing)} ORDER BY ?x
Recurse over ?x and call
OntClassdeviceClass = this.modelLoader.getPlainOntModel().getOntClass(deviceURI);
ExtendedIteratoriter = deviceClass.listSuperClasses();
4/30/2010
DogOnt in Dog: Ontology related tasks in Dog2.0
9
10. Queries (2) - Commands
Non-Parametric Commands
Parametric Commands
SELECT DISTINCT ?commandValue WHERE { dogont:"+deviceClass+" rdfs:subClassOf [rdf:typeowl:Restriction; owl:onPropertydogont:hasFunctionality; owl:someValuesFrom ?functionality] . ?functionality rdfs:subClassOfdogont:ControlFunctionality. ?functionality rdfs:subClassOf [rdf:typeowl:Restriction; owl:onPropertydogont:hasCommand; owl:someValuesFrom ?command] . ?command rdfs:subClassOfdogont:NonParametricCommand . ?command rdfs:subClassOf [rdf:typeowl:Restriction; owl:onPropertydogont:realCommandName; owl:hasValue ?commandValue]} ORDER BY ?commandValue
SELECT DISTINCT ?commandValue ?commandParamValue WHERE { dogont:"+deviceClass+" rdfs:subClassOf [rdf:typeowl:Restriction; owl:onPropertydogont:hasFunctionality; owl:someValuesFrom ?functionality] . ?functionality rdfs:subClassOfdogont:ControlFunctionality . ?functionality rdfs:subClassOf [rdf:typeowl:Restriction; owl:onPropertydogont:hasCommand; owl:someValuesFrom ?command] . ?command rdfs:subClassOfdogont:ParametricCommand . ?command rdfs:subClassOf [rdf:typeowl:Restriction; owl:onPropertydogont:realCommandName; owl:hasValue ?commandValue] . ?command rdfs:subClassOf [rdf:typeowl:Restriction; owl:onPropertydogont:commandParamName; owl:hasValue ?commandParamValue]} ORDER BY ?commandValue
4/30/2010
DogOnt in Dog: Ontology related tasks in Dog2.0
10
11. Queries(3) - States
SELECT ?state WHERE{ dogont:"+deviceClass+" rdfs:subClassOf [rdf:typeowl:Restriction; owl:onPropertydogont:hasState; owl:someValuesFrom ?state] } ORDER BY ?state
4/30/2010
DogOnt in Dog: Ontology related tasks in Dog2.0
11
12. Some Figures
Total execution time