View Javadoc

1   /*
2        Copyright 2010-2014 AIT Austrian Institute of Technology GmbH
3   	 http://www.ait.ac.at
4        
5        See the NOTICE file distributed with this work for additional
6        information regarding copyright ownership
7   
8        Licensed under the Apache License, Version 2.0 (the "License");
9        you may not use this file except in compliance with the License.
10       You may obtain a copy of the License at
11  
12         http://www.apache.org/licenses/LICENSE-2.0
13  
14       Unless required by applicable law or agreed to in writing, software
15       distributed under the License is distributed on an "AS IS" BASIS,
16       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17       See the License for the specific language governing permissions and
18       limitations under the License.
19  */
20  
21  package org.universAAL.ontology.activityhub;
22  
23  import org.universAAL.ontology.ActivityHubOntology;
24  import org.universAAL.ontology.activityhub.util.ActivityHubSensorType;
25  
26  /**
27   * Ontological representation of a temperature sensor according to ISO 11073 -
28   * Part 10471 (Independent living activity hub). Methods included in this class
29   * are the mandatory ones for representing an ontological concept in Java
30   * classes for uAAL. Usually it includes getters and setters for most of its
31   * properties.
32   * 
33   * Specific sensor events (from standard specification): - high temperature
34   * detected - low temperature detected - rate of change too fast (optional) - no
35   * condition detected (optional)
36   * 
37   * TODO: Implement generic sensor properties flags for activity hub sensors
38   * 
39   * @author Thomas Fuxreiter
40   */
41  public class TemperatureSensor extends ActivityHubSensor {
42  
43      public static final String MY_URI = ActivityHubOntology.NAMESPACE
44  	    + "TemperatureSensor";
45  
46      public static final int MY_SENSOR_TYPE = ActivityHubSensorType.TemperatureSensor;
47  
48      /**
49  	 * 
50  	 */
51      public TemperatureSensor() {
52  	// super();
53      }
54  
55      /**
56       * @param uri
57       */
58      public TemperatureSensor(String uri) {
59  	super(uri);
60      }
61  
62      /**
63       * From Resource class: The properties denote the RDF triples of this
64       * resource, realized as Hashtable. The RDF subject is this Resource itself,
65       * the key of the Hashtable is the RDF predicate and the value of the
66       * Hashtable is the RDF object, which can be a literal or another resource.
67       * See {@link #setProperty(String propURI, Object value)} for more
68       * information.
69       */
70      public void setMeasuredValue(TemperatureSensorEvent event) {
71  	props.put(PROP_MEASURED_VALUE, event);
72      }
73  
74      public TemperatureSensorEvent getMeasuredvalue() {
75  	return ((TemperatureSensorEvent) props.get(PROP_MEASURED_VALUE));
76      }
77  
78      /**
79       * @see org.universAAL.ontology.phThing.Sensor#getClassURI()
80       * @return Ontology namespace for this class
81       */
82      public String getClassURI() {
83  	return MY_URI;
84      }
85  
86      public int getPropSerializationType(String propURI) {
87  	return PROP_MEASURED_VALUE.equals(propURI) ? PROP_SERIALIZATION_FULL
88  		: super.getPropSerializationType(propURI);
89      }
90  
91      public boolean isWellFormed() {
92  	return true;
93      }
94  
95      /*
96       * (non-Javadoc)
97       * 
98       * @see
99       * org.universAAL.ontology.activityhub.ActivityHubSensor#getSensorType()
100      */
101     public int getSensorType() {
102 	return MY_SENSOR_TYPE;
103     }
104 }