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.device.Sensor;
25  
26  /**
27   * Ontological representation of an activity hub sensor concept, to be extended
28   * by different sensor types.
29   * 
30   * @author Thomas Fuxreiter
31   * 
32   */
33  public abstract class ActivityHubSensor extends Sensor {
34  
35      public static final String MY_URI = ActivityHubOntology.NAMESPACE
36  	    + "ActivityHubSensor";
37  
38      public static final String PROP_LASTEVENT = ActivityHubOntology.NAMESPACE
39  	    + "lastEvent";
40  
41      // doesn't work here!
42      // private int MY_SENSOR_TYPE; //ActivityHubSensorType.ActivityHubSensor;
43      /**
44       * must be implemented in the child classes { return MY_SENSOR_TYPE; }
45       */
46      public abstract int getSensorType();
47  
48      /* MUST be defined! otherwise the URI of the parent class is returned */
49      public String getClassURI() {
50  	return MY_URI;
51      }
52  
53      /* following 2 methods SHOULD be overwritten */
54  
55      /*
56       * defines which part of this concept is serialized e.g. only parts of this
57       * concept should be passed
58       */
59      public int getPropSerializationType(String propURI) {
60  	/*
61  	 * set OPTIONAL if the properties can be ignored or the class has no
62  	 * property set FULL if there are properties here set to FULL for all
63  	 * deriving classes
64  	 */
65  	return PROP_SERIALIZATION_FULL;
66      }
67  
68      /**
69       * From Resource class: The properties denote the RDF triples of this
70       * resource, realized as Hashtable. The RDF subject is this Resource itself,
71       * the key of the Hashtable is the RDF predicate and the value of the
72       * Hashtable is the RDF object, which can be a literal or another resource.
73       * See {@link #setProperty(String propURI, Object value)} for more
74       * information.
75       */
76      public void setMeasuredValue(ActivityHubSensorEvent event) {
77  	props.put(PROP_MEASURED_VALUE, event);
78      }
79  
80      /* for testing return true */
81      /* variables could be checked here */
82      public boolean isWellFormed() {
83  	return true;
84      }
85  
86      public ActivityHubSensor() {
87  	super();
88      }
89  
90      public ActivityHubSensor(String uri) {
91  	super(uri);
92      }
93  
94  }