What
Generate a RDF description for single sensor nodes.The returned description is split into sections according to the dependency of the included information, and "where" to store it is suggested. This service is available through either the manually fillable form here or a RESTful API.
Why
The unambiguity and schema-indepenedency features that characterize RDF, are the key to enable- plug-and-play sensor nodes
- interoperability among different sensors
REST API Specification
HTTP Method: POST;
Payload encoding: JSON;
Accepted type: xml, json, turtle, n3, ntriples, html, plain text
RDF Serialization language supported: RDF/XML, RDF/JSON, TURTLE, N3, NTRIPLES
Resources:
- http://spitfire-project.eu/incontextsensing/intrinsic
RDF representation of intrinsic (which means stored on the node itself) information
Payload example: $parameters = array("sensor_id" => "123456", "uom" => "Centigrades - C", "observed_property" => "Temperature", "observed_value" => "10.2", "timestamp" => "11-12-12T20:38Z",); - http://spitfire-project.eu/incontextsensing/intrinsic_sider
RDF representation of sider intrinsic (which means stored anywhere but referred by the intrinsic information) information
Payload example: same as above - http://spitfire-project.eu/incontextsensing/node_dependent
RDF representation of node-dependent (which means that change when brand features of a particular node model change) information
Payload example: $parameters = array("sensor_id" => "123456", "observed_property" => "Temperature", "sensor_model" => "wm1015", "sensor_manual" => "http://example/sheet.pdf", "sensor_stimulus" => "silver expansion", "capabilities" => array("Accuracy - 0.5/0.8 - meter,m", "Battery life time - 2/3 - hour,h"), "conditions" => array(array("Temperature - -40/-35 - Fahrenheit,F", "Humidity 40/70 - percent,%"), array(array("wavelength - 380/740 - nanometer,nm", "speed - 300000/400000 - kilometer per second,km/s", "frequency - 30/40 - Hertz,Hz"))) ); - http://spitfire-project.eu/incontextsensing/owner_dependent
RDF representation of owner-dependent (which means that change when the sensor's owner change) information
Payload example: $parameters = array("sensor_id" => "123456","sensor_owner" => "deri", "sensor_publisher" => "myriam","sensor_foi" => "Room", "sensor_platform" => "http://www.example.com/platform/1","sensor_history" => "http://www.example.com/history/24");
Here follows a sample PHP client:
$intrinsic_url = "http://spitfire-project.eu/incontextsensing/rdf4sensors/intrinsic";
$intrinsic_sider_url = "http://spitfire-project.eu/incontextsensing/rdf4sensors/intrinsic_sider";
$node_dependent_url = "http://spitfire-project.eu/incontextsensing/rdf4sensors/node_dependent";
$owner_dependent_url = "http://spitfire-project.eu/incontextsensing/rdf4sensors/owner_dependent";
//---------------------------------------------------------
//intrinsic
//intrinsic_sider
$parameters = array("sensor_id" => "123456",
"uom" => "Centigrades - C",
"observed_property" => "Temperature",
"observed_value" => "10.2");
//---------------------------------------------------------
//node-dependent
$parameters += array("sensor_model" => "wm1015", "sensor_manual" => "http://example/sheet.pdf",
"sensor_stimulus" => "silver expansion", "capabilities" => array("Accuracy - 0.5/0.8", "Battery life time - 2/3 - hour,h"), "conditions" => array(array("Temperature - -40/-35 - Fahrenheit,F", "Humidity 40/70 - percent,%"), array(array("wavelength - 380/740 - nanometer,nm", "speed - 300000/400000 - kilometer per second,km/s", "frequency - 30/40 - Hertz,Hz"))) );
//---------------------------------------------------------
//owner-dependent
$parameters += array("sensor_owner" => "deri", "sensor_publisher" => "myriam leggieri","sensor_foi" => "Room", "sensor_foi_name" => "Room 12",
"sensor_platform" => "http://www.example.com/platform/1","sensor_history" => "http://www.example.com/history/24");
//---------------------------------------------------------
$json_data = json_encode($parameters);
$accepted_type = "xml";
//$uri = $intrinsic_url;
$uri = $intrinsic_sider_url;
//$uri = $node_dependent_url;
//$uri = $owner_dependent_url;
//---------------------------------------------------------
$response = sendRequest($json_data, $uri, $accepted_type);
displayResponse($response);
//---------------------------------------------------------
function sendRequest($json_data, $uri, $accepted_type){
$ret = null;
$tuCurl = curl_init();
curl_setopt($tuCurl, CURLOPT_URL, $uri);
curl_setopt($tuCurl, CURLOPT_PORT , 80);
curl_setopt($tuCurl, CURLOPT_VERBOSE, 0);
curl_setopt($tuCurl, CURLOPT_HEADER, false);
curl_setopt($tuCurl, CURLOPT_POST, true);
curl_setopt($tuCurl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($tuCurl, CURLOPT_POSTFIELDS, $json_data);
curl_setopt($tuCurl, CURLOPT_HTTPHEADER, array("Content-Type: text/xml", "Accept: $accepted_type",
"inContextSensing: LD4Sensors intrinsic representation", "Content-length: ".strlen($json_data)));
$response = curl_exec($tuCurl);
if(!curl_errno($tuCurl)){
$ret = $response;
// $info = curl_getinfo($tuCurl);
// echo 'Took ' . $info['total_time'] . ' seconds to send a request to ' . $info['url'];
} else {
$ret = curl_error($tuCurl);
}
curl_close($tuCurl);
return $ret;
}
function displayResponse($response){
echo $response;
}
$intrinsic_sider_url = "http://spitfire-project.eu/incontextsensing/rdf4sensors/intrinsic_sider";
$node_dependent_url = "http://spitfire-project.eu/incontextsensing/rdf4sensors/node_dependent";
$owner_dependent_url = "http://spitfire-project.eu/incontextsensing/rdf4sensors/owner_dependent";
//---------------------------------------------------------
//intrinsic
//intrinsic_sider
$parameters = array("sensor_id" => "123456",
"uom" => "Centigrades - C",
"observed_property" => "Temperature",
"observed_value" => "10.2");
//---------------------------------------------------------
//node-dependent
$parameters += array("sensor_model" => "wm1015", "sensor_manual" => "http://example/sheet.pdf",
"sensor_stimulus" => "silver expansion", "capabilities" => array("Accuracy - 0.5/0.8", "Battery life time - 2/3 - hour,h"), "conditions" => array(array("Temperature - -40/-35 - Fahrenheit,F", "Humidity 40/70 - percent,%"), array(array("wavelength - 380/740 - nanometer,nm", "speed - 300000/400000 - kilometer per second,km/s", "frequency - 30/40 - Hertz,Hz"))) );
//---------------------------------------------------------
//owner-dependent
$parameters += array("sensor_owner" => "deri", "sensor_publisher" => "myriam leggieri","sensor_foi" => "Room", "sensor_foi_name" => "Room 12",
"sensor_platform" => "http://www.example.com/platform/1","sensor_history" => "http://www.example.com/history/24");
//---------------------------------------------------------
$json_data = json_encode($parameters);
$accepted_type = "xml";
//$uri = $intrinsic_url;
$uri = $intrinsic_sider_url;
//$uri = $node_dependent_url;
//$uri = $owner_dependent_url;
//---------------------------------------------------------
$response = sendRequest($json_data, $uri, $accepted_type);
displayResponse($response);
//---------------------------------------------------------
function sendRequest($json_data, $uri, $accepted_type){
$ret = null;
$tuCurl = curl_init();
curl_setopt($tuCurl, CURLOPT_URL, $uri);
curl_setopt($tuCurl, CURLOPT_PORT , 80);
curl_setopt($tuCurl, CURLOPT_VERBOSE, 0);
curl_setopt($tuCurl, CURLOPT_HEADER, false);
curl_setopt($tuCurl, CURLOPT_POST, true);
curl_setopt($tuCurl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($tuCurl, CURLOPT_POSTFIELDS, $json_data);
curl_setopt($tuCurl, CURLOPT_HTTPHEADER, array("Content-Type: text/xml", "Accept: $accepted_type",
"inContextSensing: LD4Sensors intrinsic representation", "Content-length: ".strlen($json_data)));
$response = curl_exec($tuCurl);
if(!curl_errno($tuCurl)){
$ret = $response;
// $info = curl_getinfo($tuCurl);
// echo 'Took ' . $info['total_time'] . ' seconds to send a request to ' . $info['url'];
} else {
$ret = curl_error($tuCurl);
}
curl_close($tuCurl);
return $ret;
}
function displayResponse($response){
echo $response;
}