YAWS: Difference between revisions
From ICO wiki
Jump to navigationJump to search
Line 156: | Line 156: | ||
<source lang="xml"> | <source lang="xml"> | ||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" | |||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> | |||
<xs:element name="records"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element name="record" maxOccurs="unbounded" minOccurs="0"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element type="xs:string" name="username"/> | |||
<xs:element name="location"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element type="xs:string" name="aadress"> | |||
<xs:annotation> | |||
<xs:documentation>Postal aadressPostal aadress</xs:documentation> | |||
</xs:annotation> | |||
</xs:element> | |||
<xs:element name="geo"> | |||
<xs:annotation> | |||
<xs:documentation>GPS cordinatesGPS cordinates</xs:documentation> | |||
</xs:annotation> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element type="xs:string" name="lat"/> | |||
<xs:element type="xs:string" name="long"/> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
<xs:element name="values"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element name="airpressure"> | |||
<xs:complexType> | |||
<xs:simpleContent> | |||
<xs:extension base="xs:float"> | |||
<xs:attribute type="xs:string" name="unit" use="optional"/> | |||
</xs:extension> | |||
</xs:simpleContent> | |||
</xs:complexType> | |||
</xs:element> | |||
<xs:element name="relativehumidity"> | |||
<xs:complexType> | |||
<xs:simpleContent> | |||
<xs:extension base="xs:byte"> | |||
<xs:attribute type="xs:string" name="unit" use="optional"/> | |||
</xs:extension> | |||
</xs:simpleContent> | |||
</xs:complexType> | |||
</xs:element> | |||
<xs:element name="airtemperature"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element type="xs:float" name="value"/> | |||
<xs:element type="xs:float" name="max"/> | |||
<xs:element type="xs:float" name="min"/> | |||
</xs:sequence> | |||
<xs:attribute type="xs:float" name="max" use="optional"/> | |||
<xs:attribute type="xs:float" name="min" use="optional"/> | |||
<xs:attribute type="xs:string" name="unit" use="optional"/> | |||
</xs:complexType> | |||
</xs:element> | |||
<xs:element name="winddirection"> | |||
<xs:complexType> | |||
<xs:simpleContent> | |||
<xs:extension base="xs:short"> | |||
<xs:attribute type="xs:string" name="property" use="optional"/> | |||
<xs:attribute type="xs:string" name="unit" use="optional"/> | |||
</xs:extension> | |||
</xs:simpleContent> | |||
</xs:complexType> | |||
</xs:element> | |||
<xs:element name="windspeed"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element type="xs:float" name="value"/> | |||
<xs:element type="xs:float" name="max"/> | |||
</xs:sequence> | |||
<xs:attribute type="xs:byte" name="max" use="optional"/> | |||
<xs:attribute type="xs:byte" name="min" use="optional"/> | |||
<xs:attribute type="xs:string" name="unit" use="optional"/> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs: | <xs:element type="xs:string" name="sunrise"> | ||
<xs:annotation> | |||
<xs:documentation>Calculated values if GPS cordinates is setCalculated values if GPS cordinates is set</xs:documentation> | |||
</xs:annotation> | |||
</xs:element> | |||
<xs:element type="xs:string" name="sunset"> | |||
<xs:annotation> | |||
<xs:documentation>Calculated values if GPS cordinates is setCalculated values if GPS cordinates is set</xs:documentation> | |||
</xs:annotation> | |||
</xs:element> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
<xs:element name="related_ehmi_stations"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element name="station" maxOccurs="unbounded" minOccurs="0"> | |||
<xs:annotation> | |||
<xs:documentation>Following data origin from http://www.ilmateenistus.ee/ilma_andmed/xml/observations.phpFollowing data origin from http://www.ilmateenistus.ee/ilma_andmed/xml/observations.php</xs:documentation> | |||
</xs:annotation> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element type="xs:string" name="name"/> | |||
<xs:element type="xs:short" name="wmocode"/> | |||
<xs:element type="xs:string" name="phenomenon"/> | |||
<xs:element type="xs:float" name="visibility"/> | |||
<xs:element type="xs:byte" name="precipitations"/> | |||
<xs:element type="xs:float" name="airpressure"/> | |||
<xs:element type="xs:byte" name="relativehumidity"/> | |||
<xs:element type="xs:float" name="airtemperature"/> | |||
<xs:element type="xs:short" name="winddirection"/> | |||
<xs:element type="xs:float" name="windspeed"/> | |||
<xs:element type="xs:float" name="windspeedmax"/> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
<xs:attribute type="xs:string" name="start_date"/> | |||
<xs:attribute type="xs:string" name="end_date"/> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:schema> | </xs:schema> | ||
Revision as of 23:30, 20 March 2017
Meeskond
- Andres Kepler
Idee
Luua ilmajaama veebiteenus.
Vajalikud komponendid:
- REST teenus
- REST Teenuse kliendiks on RPi(2|3) W10, mis teeb sensori (SparkFun Weather Shield) andmetega XML POST päringuid REST teenuse suunas
- Presentatsiooni kiht, mis visualiseerib REST'i andmed.
- Presenteerivaks seadmeks on tavaarvuti või RPI3 7" W10'ga
Projekt
Ülesanne
- Tuvastatud kasutaja saab ilmajaama andmedi lisada, kuvada ja kustutada
- Tuvastatud kasutaja saab REST teenusega lisada andmebaasi ilmajaama andmedi.
- Anonüümne ja tuvastatud kasutaja saab ilmajaama sensoriandmedi filtreerida asukoha ja perioodi järgi
- Tuvastatud kasutajajid saab lisada gruppidesse (Riik, Maakond, Vald, Linn, Linnaosa)
- Tuvastatud kasutaja andmeid saab muuta
- Igal tuvastatud kasutajal on oma sensoriadnemetega "töölaud" (dashboard)
- Tuvastatud kasutaja saab oma ilmajaama andmed (dashboard) anonüümselt jagada.
Blog
- 17.03.2017 - YEInt'st saabus raudvara. RPi sai omale W10 peale.
XML
Teema
Ilmajaama andmed
XML
<?xml version="1.0" encoding="utf-8"?>
<records start_date="19.03.17" end_date="19.03.17" >
<record>
<username>andres@kepler.ee</username>
<location>
<!--Postal aadress-->
<aadress/>
<!--GPS cordinates-->
<geo>
<lat/>
<long/>
</geo>
</location>
<values>
<value property="airpressure" unit="hPa" > <![CDATA[1004.1]]></value>
<value property="relativehumidity" unit="%" ><![CDATA[87]]></value>
<airtemperature max="50.0" min="-50.0">
<value property="airtemperature" unit="°C" ><![CDATA[-0.5]]></value>
<value property="max" unit="°C" ><![CDATA[50.0]]></value>
<value property="min" unit="°C" ><![CDATA[-5.5]]></value>
</airtemperature>
<value property="winddirection" unit="°" ><![CDATA[207]]></value>
<windspeed max="36" min="0">
<value property="windspeed" unit="m/s" ><![CDATA[0.5]]></value>
<value property="max" unit="m/s" ><![CDATA[2.1]]></value>
</windspeed>
<!--Calculated values if GPS cordinates is set-->
<value property="sunrise" ><![CDATA[04:00]]></value>
<!--Calculated values if GPS cordinates is set-->
<value property="sunset" ><![CDATA[02:00]]></value>
</values>
<related_ehmi_stations>
<!--Following data origin from http://www.ilmateenistus.ee/ilma_andmed/xml/observations.php-->
<station>
<name>Võru</name>
<wmocode>26249</wmocode>
<phenomenon>Variable clouds</phenomenon>
<visibility>20.0</visibility>
<precipitations>0</precipitations>
<airpressure>1004.1</airpressure>
<relativehumidity>87</relativehumidity>
<airtemperature>-0.5</airtemperature>
<winddirection>207</winddirection>
<windspeed>0.5</windspeed>
<windspeedmax>2.1</windspeedmax>
</station>
<station>
<name>Valga</name>
<wmocode>26247</wmocode>
<phenomenon/>
<visibility>23.0</visibility>
<precipitations>0</precipitations>
<airpressure>1004.4</airpressure>
<relativehumidity>92</relativehumidity>
<airtemperature>-1.4</airtemperature>
<winddirection>203</winddirection>
<windspeed>0.4</windspeed>
<windspeedmax>1.8</windspeedmax>
</station>
</related_ehmi_stations>
</record>
<record>
<username>jaan@gmail.com</username>
<location>
<!--Postal aadress-->
<aadress/>
<!--GPS cordinates-->
<geo>
<lat/>
<long/>
</geo>
</location>
<values>
<value property="airpressure" unit="hPa" > <![CDATA[1004.1]]></value>
<value property="relativehumidity" unit="%" ><![CDATA[87]]></value>
<airtemperature max="50.0" min="-50.0">
<value property="airtemperature" unit="°C" ><![CDATA[-0.5]]></value>
<value property="max" unit="°C" ><![CDATA[50.0]]></value>
<value property="min" unit="°C" ><![CDATA[-5.5]]></value>
</airtemperature>
<value property="winddirection" unit="°" ><![CDATA[207]]></value>
<windspeed max="36" min="0">
<value property="windspeed" unit="m/s" ><![CDATA[0.5]]></value>
<value property="max" unit="m/s" ><![CDATA[2.1]]></value>
</windspeed>
<!--Calculated values if GPS cordinates is set-->
<value property="sunrise" ><![CDATA[04:00]]></value>
<!--Calculated values if GPS cordinates is set-->
<value property="sunset" ><![CDATA[02:00]]></value>
</values>
<related_ehmi_stations>
<!--Following data origin from http://www.ilmateenistus.ee/ilma_andmed/xml/observations.php-->
<station>
<name>Võru</name>
<wmocode>26249</wmocode>
<phenomenon>Variable clouds</phenomenon>
<visibility>20.0</visibility>
<precipitations>0</precipitations>
<airpressure>1004.1</airpressure>
<relativehumidity>87</relativehumidity>
<airtemperature>-0.5</airtemperature>
<winddirection>207</winddirection>
<windspeed>0.5</windspeed>
<windspeedmax>2.1</windspeedmax>
</station>
</related_ehmi_stations>
</record>
</records>
XML schema (XSD)
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="records">
<xs:complexType>
<xs:sequence>
<xs:element name="record" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="username"/>
<xs:element name="location">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="aadress">
<xs:annotation>
<xs:documentation>Postal aadressPostal aadress</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="geo">
<xs:annotation>
<xs:documentation>GPS cordinatesGPS cordinates</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="lat"/>
<xs:element type="xs:string" name="long"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="values">
<xs:complexType>
<xs:sequence>
<xs:element name="airpressure">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:float">
<xs:attribute type="xs:string" name="unit" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="relativehumidity">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:byte">
<xs:attribute type="xs:string" name="unit" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="airtemperature">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:float" name="value"/>
<xs:element type="xs:float" name="max"/>
<xs:element type="xs:float" name="min"/>
</xs:sequence>
<xs:attribute type="xs:float" name="max" use="optional"/>
<xs:attribute type="xs:float" name="min" use="optional"/>
<xs:attribute type="xs:string" name="unit" use="optional"/>
</xs:complexType>
</xs:element>
<xs:element name="winddirection">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:short">
<xs:attribute type="xs:string" name="property" use="optional"/>
<xs:attribute type="xs:string" name="unit" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="windspeed">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:float" name="value"/>
<xs:element type="xs:float" name="max"/>
</xs:sequence>
<xs:attribute type="xs:byte" name="max" use="optional"/>
<xs:attribute type="xs:byte" name="min" use="optional"/>
<xs:attribute type="xs:string" name="unit" use="optional"/>
</xs:complexType>
</xs:element>
<xs:element type="xs:string" name="sunrise">
<xs:annotation>
<xs:documentation>Calculated values if GPS cordinates is setCalculated values if GPS cordinates is set</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element type="xs:string" name="sunset">
<xs:annotation>
<xs:documentation>Calculated values if GPS cordinates is setCalculated values if GPS cordinates is set</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="related_ehmi_stations">
<xs:complexType>
<xs:sequence>
<xs:element name="station" maxOccurs="unbounded" minOccurs="0">
<xs:annotation>
<xs:documentation>Following data origin from http://www.ilmateenistus.ee/ilma_andmed/xml/observations.phpFollowing data origin from http://www.ilmateenistus.ee/ilma_andmed/xml/observations.php</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="name"/>
<xs:element type="xs:short" name="wmocode"/>
<xs:element type="xs:string" name="phenomenon"/>
<xs:element type="xs:float" name="visibility"/>
<xs:element type="xs:byte" name="precipitations"/>
<xs:element type="xs:float" name="airpressure"/>
<xs:element type="xs:byte" name="relativehumidity"/>
<xs:element type="xs:float" name="airtemperature"/>
<xs:element type="xs:short" name="winddirection"/>
<xs:element type="xs:float" name="windspeed"/>
<xs:element type="xs:float" name="windspeedmax"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:string" name="start_date"/>
<xs:attribute type="xs:string" name="end_date"/>
</xs:complexType>
</xs:element>
</xs:schema>
XSLT 1
XSLT => HTML
XSLT 2
XSLT => XML