SlideShare una empresa de Scribd logo
1 de 14
DogOnt in Dog Ontology related tasks in Dog2.0 Dario Bonino Politecnicodi Torino, e-Lite research group http://elite.polito.it
Outline Dog2.0 Device categories Device models Automatic Generation Queries 4/30/2010 DogOnt in Dog: Ontology related tasks in Dog2.0 2
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
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
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); }
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
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
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
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
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
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
Some Figures Total execution time <10s ~7 seconds to load and reason the ontology Amount of compiled classes 228 classes 114 device categories 114 device models 4/30/2010 DogOnt in Dog: Ontology related tasks in Dog2.0 12
Rules Generation (DOG1.0) Query Rule SELECT DISTINCT ?x ?y ?v ?c ?d ?class ?cvWHERE { ?x a dogont:Controllable . ?y a dogont:Controllable . ?x dogont:controlledObject?y . ?x dogont:hasFunctionality ?f . ?f dogont:hasNotification ?n . ?n dogont:notificationValue?v . ?n dogont:generateCommand ?c . ?d dogont:hasFunctionality ?f2 . ?f2 dogont:hasCommand ?c . ?c rdf:type ?class . ?class rdfs:subClassOfdogont:DiscreteCommand . ?class rdfs:subClassOf [rdf:typeowl:Restriction; owl:onPropertydogont:realCommandName; owl:hasValue?cv]} when dev:Device( id == "http://elite.polito.it/ontologies/simplehome.owl#"?x") cmd:StateCommand(state =="?v") status:DeviceStatus( status == cmd, device == dev) rulesCore:RulesCore() message: DogMessage(dataType == DogBundle.DataTypeEnum.DEVICE_STATUS, data == status) then Device newDev = new Device("http://elite.polito.it/ontologies/DOGHouseModel.owl#"+?y+"); DeviceStatusnewStatus = new DeviceStatus(newDev, new StateCommand("+?cv+”,StatusTypeEnum.DISCRETE)); DogMessagemyCmd = new DogMessage(MessageTypeEnum.CMD,newGregorianCalendar(), message.getDataType(), newStatus);  rulesCore.takeActions(myCmd);  4/30/2010 DogOnt in Dog: Ontology related tasks in Dog2.0 13
Questions? Dario Bonino dario.bonino@polito.it

Más contenido relacionado

La actualidad más candente

Effective Java - Enum and Annotations
Effective Java - Enum and AnnotationsEffective Java - Enum and Annotations
Effective Java - Enum and AnnotationsRoshan Deniyage
 
Programming Java - Lection 07 - Puzzlers - Lavrentyev Fedor
Programming Java - Lection 07 - Puzzlers - Lavrentyev FedorProgramming Java - Lection 07 - Puzzlers - Lavrentyev Fedor
Programming Java - Lection 07 - Puzzlers - Lavrentyev FedorFedor Lavrentyev
 
Android & Kotlin - The code awakens #02
Android & Kotlin - The code awakens #02Android & Kotlin - The code awakens #02
Android & Kotlin - The code awakens #02Omar Miatello
 
Android & Kotlin - The code awakens #01
Android & Kotlin - The code awakens #01Android & Kotlin - The code awakens #01
Android & Kotlin - The code awakens #01Omar Miatello
 
The Ring programming language version 1.4.1 book - Part 9 of 31
The Ring programming language version 1.4.1 book - Part 9 of 31The Ring programming language version 1.4.1 book - Part 9 of 31
The Ring programming language version 1.4.1 book - Part 9 of 31Mahmoud Samir Fayed
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android InfrastructureAlexey Buzdin
 
Looping the Loop with SPL Iterators
Looping the Loop with SPL IteratorsLooping the Loop with SPL Iterators
Looping the Loop with SPL IteratorsMark Baker
 
Reactive Autonomous System Programming using the PROFETA tool
Reactive Autonomous System Programming using the PROFETA toolReactive Autonomous System Programming using the PROFETA tool
Reactive Autonomous System Programming using the PROFETA toolCorrado Santoro
 
​"Delegates, Delegates everywhere" Владимир Миронов
​"Delegates, Delegates everywhere" Владимир Миронов​"Delegates, Delegates everywhere" Владимир Миронов
​"Delegates, Delegates everywhere" Владимир МироновAvitoTech
 
Jumping-with-java8
Jumping-with-java8Jumping-with-java8
Jumping-with-java8Dhaval Dalal
 
Python Evolution
Python EvolutionPython Evolution
Python EvolutionQuintagroup
 
Google guava - almost everything you need to know
Google guava - almost everything you need to knowGoogle guava - almost everything you need to know
Google guava - almost everything you need to knowTomasz Dziurko
 
Android & Kotlin - The code awakens #03
Android & Kotlin - The code awakens #03Android & Kotlin - The code awakens #03
Android & Kotlin - The code awakens #03Omar Miatello
 
Integrating Cloud Services in Behaviour Programming for Autonomous Robots
Integrating Cloud Services in Behaviour  Programming for Autonomous RobotsIntegrating Cloud Services in Behaviour  Programming for Autonomous Robots
Integrating Cloud Services in Behaviour Programming for Autonomous RobotsCorrado Santoro
 
Metaprogramming in julia
Metaprogramming in juliaMetaprogramming in julia
Metaprogramming in julia岳華 杜
 
Google Guava for cleaner code
Google Guava for cleaner codeGoogle Guava for cleaner code
Google Guava for cleaner codeMite Mitreski
 
Privet Kotlin (Windy City DevFest)
Privet Kotlin (Windy City DevFest)Privet Kotlin (Windy City DevFest)
Privet Kotlin (Windy City DevFest)Cody Engel
 

La actualidad más candente (20)

Effective Java - Enum and Annotations
Effective Java - Enum and AnnotationsEffective Java - Enum and Annotations
Effective Java - Enum and Annotations
 
Programming Java - Lection 07 - Puzzlers - Lavrentyev Fedor
Programming Java - Lection 07 - Puzzlers - Lavrentyev FedorProgramming Java - Lection 07 - Puzzlers - Lavrentyev Fedor
Programming Java - Lection 07 - Puzzlers - Lavrentyev Fedor
 
Android & Kotlin - The code awakens #02
Android & Kotlin - The code awakens #02Android & Kotlin - The code awakens #02
Android & Kotlin - The code awakens #02
 
Android & Kotlin - The code awakens #01
Android & Kotlin - The code awakens #01Android & Kotlin - The code awakens #01
Android & Kotlin - The code awakens #01
 
The Ring programming language version 1.4.1 book - Part 9 of 31
The Ring programming language version 1.4.1 book - Part 9 of 31The Ring programming language version 1.4.1 book - Part 9 of 31
The Ring programming language version 1.4.1 book - Part 9 of 31
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android Infrastructure
 
Looping the Loop with SPL Iterators
Looping the Loop with SPL IteratorsLooping the Loop with SPL Iterators
Looping the Loop with SPL Iterators
 
Reactive Autonomous System Programming using the PROFETA tool
Reactive Autonomous System Programming using the PROFETA toolReactive Autonomous System Programming using the PROFETA tool
Reactive Autonomous System Programming using the PROFETA tool
 
​"Delegates, Delegates everywhere" Владимир Миронов
​"Delegates, Delegates everywhere" Владимир Миронов​"Delegates, Delegates everywhere" Владимир Миронов
​"Delegates, Delegates everywhere" Владимир Миронов
 
Jumping-with-java8
Jumping-with-java8Jumping-with-java8
Jumping-with-java8
 
Python Evolution
Python EvolutionPython Evolution
Python Evolution
 
Google guava - almost everything you need to know
Google guava - almost everything you need to knowGoogle guava - almost everything you need to know
Google guava - almost everything you need to know
 
Android & Kotlin - The code awakens #03
Android & Kotlin - The code awakens #03Android & Kotlin - The code awakens #03
Android & Kotlin - The code awakens #03
 
Pattern Matching in Java 14
Pattern Matching in Java 14Pattern Matching in Java 14
Pattern Matching in Java 14
 
Integrating Cloud Services in Behaviour Programming for Autonomous Robots
Integrating Cloud Services in Behaviour  Programming for Autonomous RobotsIntegrating Cloud Services in Behaviour  Programming for Autonomous Robots
Integrating Cloud Services in Behaviour Programming for Autonomous Robots
 
Metaprogramming in julia
Metaprogramming in juliaMetaprogramming in julia
Metaprogramming in julia
 
Google Guava for cleaner code
Google Guava for cleaner codeGoogle Guava for cleaner code
Google Guava for cleaner code
 
Lazy java
Lazy javaLazy java
Lazy java
 
Python and You Series
Python and You SeriesPython and You Series
Python and You Series
 
Privet Kotlin (Windy City DevFest)
Privet Kotlin (Windy City DevFest)Privet Kotlin (Windy City DevFest)
Privet Kotlin (Windy City DevFest)
 

Similar a Dog Ont In Dog

From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)Jose Manuel Pereira Garcia
 
Java design patterns
Java design patternsJava design patterns
Java design patternsShawn Brito
 
Тарас Олексин - Sculpt! Your! Tests!
Тарас Олексин  - Sculpt! Your! Tests!Тарас Олексин  - Sculpt! Your! Tests!
Тарас Олексин - Sculpt! Your! Tests!DataArt
 
Writing Kotlin Multiplatform libraries that your iOS teammates are gonna love
Writing Kotlin Multiplatform libraries that your iOS teammates are gonna loveWriting Kotlin Multiplatform libraries that your iOS teammates are gonna love
Writing Kotlin Multiplatform libraries that your iOS teammates are gonna loveAndré Oriani
 
Androidの本当にあった怖い話
Androidの本当にあった怖い話Androidの本当にあった怖い話
Androidの本当にあった怖い話Yusuke Yamamoto
 
activity_and_fragment_may_2020_lakopi
activity_and_fragment_may_2020_lakopiactivity_and_fragment_may_2020_lakopi
activity_and_fragment_may_2020_lakopiToru Wonyoung Choi
 
Architecting Single Activity Applications (With or Without Fragments)
Architecting Single Activity Applications (With or Without Fragments)Architecting Single Activity Applications (With or Without Fragments)
Architecting Single Activity Applications (With or Without Fragments)Gabor Varadi
 
Mastering Python lesson 4_functions_parameters_arguments
Mastering Python lesson 4_functions_parameters_argumentsMastering Python lesson 4_functions_parameters_arguments
Mastering Python lesson 4_functions_parameters_argumentsRuth Marvin
 
Nice to meet Kotlin
Nice to meet KotlinNice to meet Kotlin
Nice to meet KotlinJieyi Wu
 
yagdao-0.3.1 JPA guide
yagdao-0.3.1 JPA guideyagdao-0.3.1 JPA guide
yagdao-0.3.1 JPA guideMert Can Akkan
 
2. Design patterns. part #2
2. Design patterns. part #22. Design patterns. part #2
2. Design patterns. part #2Leonid Maslov
 
Kotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developersKotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developersBartosz Kosarzycki
 
Kotlin Advanced - language reference for Android developers
Kotlin Advanced - language reference for Android developers Kotlin Advanced - language reference for Android developers
Kotlin Advanced - language reference for Android developers STX Next
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android InfrastructureC.T.Co
 
Stetl for INSPIRE Data Transformation
Stetl for INSPIRE Data TransformationStetl for INSPIRE Data Transformation
Stetl for INSPIRE Data TransformationJust van den Broecke
 

Similar a Dog Ont In Dog (20)

From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)
 
Java design patterns
Java design patternsJava design patterns
Java design patterns
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Тарас Олексин - Sculpt! Your! Tests!
Тарас Олексин  - Sculpt! Your! Tests!Тарас Олексин  - Sculpt! Your! Tests!
Тарас Олексин - Sculpt! Your! Tests!
 
Writing Kotlin Multiplatform libraries that your iOS teammates are gonna love
Writing Kotlin Multiplatform libraries that your iOS teammates are gonna loveWriting Kotlin Multiplatform libraries that your iOS teammates are gonna love
Writing Kotlin Multiplatform libraries that your iOS teammates are gonna love
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design Patterns
 
Androidの本当にあった怖い話
Androidの本当にあった怖い話Androidの本当にあった怖い話
Androidの本当にあった怖い話
 
activity_and_fragment_may_2020_lakopi
activity_and_fragment_may_2020_lakopiactivity_and_fragment_may_2020_lakopi
activity_and_fragment_may_2020_lakopi
 
Architecting Single Activity Applications (With or Without Fragments)
Architecting Single Activity Applications (With or Without Fragments)Architecting Single Activity Applications (With or Without Fragments)
Architecting Single Activity Applications (With or Without Fragments)
 
Wien15 java8
Wien15 java8Wien15 java8
Wien15 java8
 
Weapons for Boilerplate Destruction
Weapons for Boilerplate DestructionWeapons for Boilerplate Destruction
Weapons for Boilerplate Destruction
 
Mastering Python lesson 4_functions_parameters_arguments
Mastering Python lesson 4_functions_parameters_argumentsMastering Python lesson 4_functions_parameters_arguments
Mastering Python lesson 4_functions_parameters_arguments
 
Nice to meet Kotlin
Nice to meet KotlinNice to meet Kotlin
Nice to meet Kotlin
 
yagdao-0.3.1 JPA guide
yagdao-0.3.1 JPA guideyagdao-0.3.1 JPA guide
yagdao-0.3.1 JPA guide
 
2. Design patterns. part #2
2. Design patterns. part #22. Design patterns. part #2
2. Design patterns. part #2
 
Kotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developersKotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developers
 
Kotlin Advanced - language reference for Android developers
Kotlin Advanced - language reference for Android developers Kotlin Advanced - language reference for Android developers
Kotlin Advanced - language reference for Android developers
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android Infrastructure
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Stetl for INSPIRE Data Transformation
Stetl for INSPIRE Data TransformationStetl for INSPIRE Data Transformation
Stetl for INSPIRE Data Transformation
 

Más de Dario Bonino

Más de Dario Bonino (18)

OSGi compendium
OSGi compendiumOSGi compendium
OSGi compendium
 
OSGi introduction
OSGi introductionOSGi introduction
OSGi introduction
 
dfl
dfldfl
dfl
 
ficloud2015
ficloud2015ficloud2015
ficloud2015
 
citizen-centric-app
citizen-centric-appcitizen-centric-app
citizen-centric-app
 
Dog ont
Dog ontDog ont
Dog ont
 
bonino_thesis_final
bonino_thesis_finalbonino_thesis_final
bonino_thesis_final
 
bonino
boninobonino
bonino
 
The Dog Gateway - Intro
The Dog Gateway - IntroThe Dog Gateway - Intro
The Dog Gateway - Intro
 
Home and building automation systems sun slice
Home and building automation systems   sun sliceHome and building automation systems   sun slice
Home and building automation systems sun slice
 
Rilievo informatico di cavità naturali
Rilievo informatico di cavità naturaliRilievo informatico di cavità naturali
Rilievo informatico di cavità naturali
 
Dog2.3 Architecture
Dog2.3 ArchitectureDog2.3 Architecture
Dog2.3 Architecture
 
Home and building automation systems
Home and building automation systemsHome and building automation systems
Home and building automation systems
 
Dog Ont
Dog OntDog Ont
Dog Ont
 
Iswc2008
Iswc2008Iswc2008
Iswc2008
 
Webs2008
Webs2008Webs2008
Webs2008
 
Dog Sim
Dog SimDog Sim
Dog Sim
 
Interoperation Modeling
Interoperation ModelingInteroperation Modeling
Interoperation Modeling
 

Dog Ont In Dog

  • 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 <10s ~7 seconds to load and reason the ontology Amount of compiled classes 228 classes 114 device categories 114 device models 4/30/2010 DogOnt in Dog: Ontology related tasks in Dog2.0 12
  • 13. Rules Generation (DOG1.0) Query Rule SELECT DISTINCT ?x ?y ?v ?c ?d ?class ?cvWHERE { ?x a dogont:Controllable . ?y a dogont:Controllable . ?x dogont:controlledObject?y . ?x dogont:hasFunctionality ?f . ?f dogont:hasNotification ?n . ?n dogont:notificationValue?v . ?n dogont:generateCommand ?c . ?d dogont:hasFunctionality ?f2 . ?f2 dogont:hasCommand ?c . ?c rdf:type ?class . ?class rdfs:subClassOfdogont:DiscreteCommand . ?class rdfs:subClassOf [rdf:typeowl:Restriction; owl:onPropertydogont:realCommandName; owl:hasValue?cv]} when dev:Device( id == "http://elite.polito.it/ontologies/simplehome.owl#"?x") cmd:StateCommand(state =="?v") status:DeviceStatus( status == cmd, device == dev) rulesCore:RulesCore() message: DogMessage(dataType == DogBundle.DataTypeEnum.DEVICE_STATUS, data == status) then Device newDev = new Device("http://elite.polito.it/ontologies/DOGHouseModel.owl#"+?y+"); DeviceStatusnewStatus = new DeviceStatus(newDev, new StateCommand("+?cv+”,StatusTypeEnum.DISCRETE)); DogMessagemyCmd = new DogMessage(MessageTypeEnum.CMD,newGregorianCalendar(), message.getDataType(), newStatus); rulesCore.takeActions(myCmd); 4/30/2010 DogOnt in Dog: Ontology related tasks in Dog2.0 13
  • 14. Questions? Dario Bonino dario.bonino@polito.it