| XML schema |
http://dd.eionet.europa.eu/schemas/habitatsdirective/art12_birds.xsd
|
|---|---|
| Output type | RDF |
| Description | RDF output |
| XSL file | birds-rdf-2018.xsl (Last modified: 20 Mar 2019 10:06 ) |
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: birds-rdf.xsl 15536 2014-01-17 09:27:48Z lainekai $ -->
<!DOCTYPE xsl:stylesheet [
<!ENTITY countries "http://rdfdata.eionet.europa.eu/eea/countries/">
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">
<!ENTITY punit "http://dd.eionet.europa.eu/vocabulary/art12_2018/populationUnits/">
<!ENTITY trend "http://dd.eionet.europa.eu/vocabulary/art12_2018/trends/">
<!ENTITY season "http://dd.eionet.europa.eu/vocabulary/art12_2018/seasonArt12/">
<!ENTITY estimate "http://dd.eionet.europa.eu/vocabulary/art12_2018/typeEstimate/">
<!ENTITY plan "http://dd.eionet.europa.eu/vocabulary/art12_2018/typeOfPlan/">
<!ENTITY umethod "http://dd.eionet.europa.eu/vocabulary/art12_2018/methodsUsed/">
<!ENTITY measures "http://dd.eionet.europa.eu/vocabulary/art12_2018/measures/">
<!ENTITY rchange "http://dd.eionet.europa.eu/vocabulary/art12_2018/reasonChange/">
<!ENTITY location "http://dd.eionet.europa.eu/vocabulary/art12_2018/pressuresThreatsLocation/">
<!ENTITY imeasures "http://dd.eionet.europa.eu/vocabulary/art17_2018/measuresIdentified/">
<!ENTITY lmeasures "http://dd.eionet.europa.eu/vocabulary/art17_2018/measuresLocation/">
<!ENTITY bmeasures "http://dd.eionet.europa.eu/vocabulary/art17_2018/measuresPurposeBirds/">
<!ENTITY rmeasures "http://dd.eionet.europa.eu/vocabulary/art17_2018/measuresResponse/">
]>
<xsl:stylesheet version="1.0"
xmlns="http://rdfdata.eionet.europa.eu/article12/ontology/"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:l="http://biodiversity.eionet.europa.eu/art17dataflow">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="bird_reports">
<rdf:RDF>
<xsl:apply-templates/>
</rdf:RDF>
</xsl:template>
<xsl:template match="bird_report">
<BirdReport rdf:about="">
<xsl:attribute name="rdf:about">#<xsl:value-of select="concat(speciescode, '-', season)"/></xsl:attribute>
<rdfs:label>Birds Directive Art. 12 report on <xsl:value-of select="concat(speciesname, ' - ', season/@desc)"/> in <xsl:value-of select="country/@desc"/></rdfs:label>
<forCountry>
<xsl:attribute name="rdf:resource">&countries;<xsl:value-of select="country/@isocode"/></xsl:attribute>
</forCountry>
<memberstate>
<xsl:value-of select="country/@desc"/>
</memberstate>
<xsl:call-template name="get-eunis-species-code"/>
<xsl:apply-templates/>
</BirdReport>
</xsl:template>
<!-- Country reference -->
<xsl:template match="country">
<xsl:element name="{local-name()}">
<xsl:attribute name="rdf:resource">&countries;<xsl:value-of select="@isocode"/></xsl:attribute>
</xsl:element>
</xsl:template>
<!-- Boolean properties -->
<xsl:template match="no_change|genuine|knowledge|method|no_info|sensitive_species|distribution_map|additional_distribution_map|
data_in_other_season|national_plan_adopted|nationally_hunted|huntingbag_y1_unknown|huntingbag_y2_unknown|huntingbag_y3_unknown|
huntingbag_y4_unknown|huntingbag_y5_unknown|huntingbag_y6_unknown|measures_needed">
<xsl:element name="{local-name()}">
<xsl:attribute name="rdf:datatype">&xsd;boolean</xsl:attribute>
<xsl:value-of select="."/></xsl:element>
</xsl:template>
<!-- Method used -->
<xsl:template match="population_method|population_trend_method|population_trend_long_method|distribution_method|distribution_trend_method|
distribution_trend_long_method|spa_population_method|spa_population_trend_method|huntingbag_method">
<xsl:if test="normalize-space(text()) != ''">
<xsl:element name="{local-name()}">
<xsl:attribute name="rdf:resource">&umethod;<xsl:value-of select="normalize-space(text())"/></xsl:attribute>
</xsl:element>
</xsl:if>
</xsl:template>
<!-- Trend -->
<xsl:template match="population_trend|population_trend_long|distribution_trend|distribution_trend_long|spa_population_trend">
<xsl:if test="normalize-space(text()) != ''">
<xsl:element name="{local-name()}">
<xsl:choose>
<xsl:when test="normalize-space(text()) = '+'">
<xsl:attribute name="rdf:resource">&trend;i</xsl:attribute>
</xsl:when>
<xsl:when test="normalize-space(text()) = '-'">
<xsl:attribute name="rdf:resource">&trend;d</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="rdf:resource">&trend;<xsl:value-of select="text()"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:if>
</xsl:template>
<!-- population size unit -->
<xsl:template match="population_size_unit|spa_population_unit|huntingbag_unit">
<xsl:if test="normalize-space(text()) != ''">
<xsl:element name="{local-name()}">
<xsl:attribute name="rdf:resource">&punit;<xsl:value-of select="normalize-space(text())"/></xsl:attribute>
</xsl:element>
</xsl:if>
</xsl:template>
<!-- type of estimate -->
<xsl:template match="population_estimate_type|spa_population_estimate_type">
<xsl:if test="normalize-space(text()) != ''">
<xsl:element name="{local-name()}">
<xsl:attribute name="rdf:resource">&estimate;<xsl:value-of select="normalize-space(text())"/></xsl:attribute>
</xsl:element>
</xsl:if>
</xsl:template>
<!-- reason change -->
<xsl:template match="main_reason">
<xsl:if test="normalize-space(text()) != ''">
<xsl:element name="{local-name()}">
<xsl:attribute name="rdf:resource">&rchange;<xsl:value-of select="normalize-space(text())"/></xsl:attribute>
</xsl:element>
</xsl:if>
</xsl:template>
<!-- season -->
<xsl:template match="season">
<xsl:if test="normalize-space(text()) != ''">
<xsl:element name="{local-name()}">
<xsl:attribute name="rdf:resource">&season;<xsl:value-of select="normalize-space(text())"/></xsl:attribute>
</xsl:element>
</xsl:if>
</xsl:template>
<!-- plan -->
<xsl:template match="plan">
<xsl:if test="normalize-space(text()) != ''">
<xsl:element name="{local-name()}">
<xsl:attribute name="rdf:resource">&plan;<xsl:value-of select="normalize-space(text())"/></xsl:attribute>
</xsl:element>
</xsl:if>
</xsl:template>
<!-- location -->
<xsl:template match="location">
<xsl:if test="normalize-space(text()) != ''">
<xsl:element name="{local-name()}">
<xsl:attribute name="rdf:resource">&location;<xsl:value-of select="normalize-space(text())"/></xsl:attribute>
</xsl:element>
</xsl:if>
</xsl:template>
<!-- Measures identified -->
<xsl:template match="measures_status">
<xsl:if test="normalize-space(text()) != ''">
<xsl:element name="{local-name()}">
<xsl:attribute name="rdf:resource">&imeasures;<xsl:value-of select="normalize-space(text())"/></xsl:attribute>
</xsl:element>
</xsl:if>
</xsl:template>
<!-- Measures purpose for birds -->
<xsl:template match="measures_purpose">
<xsl:if test="normalize-space(text()) != ''">
<xsl:element name="{local-name()}">
<xsl:attribute name="rdf:resource">&bmeasures;<xsl:value-of select="normalize-space(text())"/></xsl:attribute>
</xsl:element>
</xsl:if>
</xsl:template>
<!-- Measures location -->
<xsl:template match="measures_location">
<xsl:if test="normalize-space(text()) != ''">
<xsl:element name="{local-name()}">
<xsl:attribute name="rdf:resource">&lmeasures;<xsl:value-of select="normalize-space(text())"/></xsl:attribute>
</xsl:element>
</xsl:if>
</xsl:template>
<!-- Measures response -->
<xsl:template match="measures_response">
<xsl:if test="normalize-space(text()) != ''">
<xsl:element name="{local-name()}">
<xsl:attribute name="rdf:resource">&rmeasures;<xsl:value-of select="normalize-space(text())"/></xsl:attribute>
</xsl:element>
</xsl:if>
</xsl:template>
<xsl:template match="population_reasons_for_change">
<xsl:element name="{local-name()}">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="pressures|threats|measures|pressures_threats_info|conservation_measures|data_birds_annexII">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="pressure|threat">
<xsl:element name="{local-name()}">
<xsl:attribute name="rdf:parseType">Resource</xsl:attribute>
<rdfs:label><xsl:value-of select="code/@desc"/></rdfs:label>
<xsl:call-template name="one-resource-predicate">
<xsl:with-param name="text" select="code"/>
<xsl:with-param name="table" select="'threats'"/>
<xsl:with-param name="predicate" select="'forPressureThreat'"/>
</xsl:call-template>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="ranking">
<xsl:if test="normalize-space(text()) != ''">
<xsl:call-template name="one-resource-predicate">
<xsl:with-param name="text" select="text()"/>
<xsl:with-param name="table" select="local-name(.)"/>
<xsl:with-param name="predicate" select="local-name(.)"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template match="measure">
<measure>
<xsl:attribute name="rdf:parseType">Resource</xsl:attribute>
<rdfs:label><xsl:value-of select="code/@desc"/></rdfs:label>
<xsl:call-template name="one-resource-predicate">
<xsl:with-param name="text" select="code"/>
<xsl:with-param name="table" select="local-name(parent::*)"/>
<xsl:with-param name="predicate" select="'forMeasure'"/>
</xsl:call-template>
<xsl:apply-templates/>
</measure>
</xsl:template>
<xsl:template name="one-resource-predicate">
<xsl:param name="text"/>
<xsl:param name="predicate"/>
<xsl:param name="table"/>
<xsl:if test="string-length($text) != 0">
<xsl:element name="{$predicate}">
<xsl:attribute name="rdf:resource">http://dd.eionet.europa.eu/vocabulary/art17_2012/<xsl:value-of
select="$table" />/<xsl:value-of select="$text"/></xsl:attribute>
</xsl:element>
</xsl:if>
</xsl:template>
<xsl:template name="one-literal-predicate">
<xsl:param name="text"/>
<xsl:param name="predicate"/>
<xsl:element name="{$predicate}">
<xsl:value-of select="$text"/>
</xsl:element>
</xsl:template>
<xsl:template match="text()"/>
<!-- obsolete as no EUNIS codes in the RDF? -->
<xsl:template name="get-eunis-species-code">
<xsl:param name="speciesname" select="speciescode/@desc"/>
<xsl:if test="speciescode/@euniscode!=''">
<forSpecies>
<xsl:attribute name="rdf:resource">http://eunis.eea.europa.eu/species/<xsl:value-of select="speciescode/@euniscode"/>
</xsl:attribute>
</forSpecies>
</xsl:if>
<xsl:if test="speciescode/@euniscode='' ">
<xsl:if test="document('https://converters.eionet.europa.eu/xmlfile/map-eunis-species.xml')/l:eunis/l:species[@name=$speciesname] != ''">
<forSpecies>
<xsl:attribute name="rdf:resource">http://eunis.eea.europa.eu/species/<xsl:value-of select="document('https://converters.eionet.europa.eu/xmlfile/map-eunis-species.xml')/l:eunis/l:species[@name=$speciesname]"/>
</xsl:attribute>
</forSpecies>
</xsl:if>
</xsl:if>
</xsl:template>
<xsl:template match="*">
<xsl:if test="normalize-space(text()) != ''">
<xsl:element name="{local-name()}"><xsl:value-of select="."/></xsl:element>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
European Environment Agency
Kgs. Nytorv 6, DK-1050 Copenhagen K, Denmark