Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatter / DCAT improvements forllowing HVD reporting #112

Open
wants to merge 11 commits into
base: 44-dcat-formatter-improvements
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public class EsSearchManager implements ISearchManager {
.add(Geonet.IndexFieldNames.GROUP_OWNER)
.add(Geonet.IndexFieldNames.RESOURCEABSTRACT)
.add(Geonet.IndexFieldNames.RESOURCEABSTRACT + "Object")
.add("resourceIdentifier")
.add("operatesOn")
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,41 @@
as="xs:boolean"
select="false()"/>

<xsl:variable name="dcatApAccessTypes" as="node()*">
<entry key="http://publications.europa.eu/resource/authority/access-right/PUBLIC">unrestricted</entry>
<entry key="http://publications.europa.eu/resource/authority/access-right/PUBLIC">licenceUnrestricted</entry>
<entry key="http://publications.europa.eu/resource/authority/access-right/RESTRICTED">restricted</entry>
<entry key="http://publications.europa.eu/resource/authority/access-right/NON_PUBLIC">private</entry>
<entry key="http://publications.europa.eu/resource/authority/access-right/CONFIDENTIAL">confidential</entry>
<entry key="http://publications.europa.eu/resource/authority/access-right/PUBLIC">http://inspire.ec.europa.eu/metadata-codelist/LimitationsOnPublicAccess/noLimitations</entry>
<entry key="http://publications.europa.eu/resource/authority/access-right/NON_PUBLIC">https://inspire.ec.europa.eu/metadata-codelist/LimitationsOnPublicAccess/INSPIRE_Directive_Article13_1e</entry>
</xsl:variable>

<xsl:variable name="admsLicenceTypes" as="node()*">
<entry key="https://creativecommons.org/licenses/by/4.0/">http://purl.org/adms/licencetype/Attribution</entry>
<entry key="https://creativecommons.org/licenses/by/4.0/legalcode">http://purl.org/adms/licencetype/Attribution</entry>
<entry key="https://publications.europa.eu/resource/authority/licence/CC_BY_4_0">http://purl.org/adms/licencetype/Attribution</entry>
<entry key="https://creativecommons.org/licenses/by/4.0/deed">http://purl.org/adms/licencetype/Attribution</entry>
<entry key="https://creativecommons.org/public-domain/cc0/">http://purl.org/adms/licencetype/PublicDomain</entry>
<entry key="https://creativecommons.org/publicdomain/zero/1.0/">http://purl.org/adms/licencetype/PublicDomain</entry>
<entry key="https://creativecommons.org/licenses/by-sa/3.0">http://purl.org/adms/licencetype/Attribution</entry>
<entry key="https://creativecommons.org/licenses/by-sa/3.0">http://purl.org/adms/licencetype/ViralEffect-ShareAlike</entry>
<entry key="https://creativecommons.org/licenses/by-sa/2.0">http://purl.org/adms/licencetype/ViralEffect-ShareAlike</entry>
<entry key="https://creativecommons.org/licenses/by-sa/2.0">http://purl.org/adms/licencetype/Attribution</entry>
<entry key="https://opendatacommons.org/licenses/odbl/1-0">http://purl.org/adms/licencetype/Attribution</entry>
<entry key="https://opendatacommons.org/licenses/odbl/1-0">http://purl.org/adms/licencetype/ViralEffect-ShareAlike</entry>
<entry key="https://opendatacommons.org/licenses/odbl/">http://purl.org/adms/licencetype/Attribution</entry>
<entry key="https://opendatacommons.org/licenses/odbl/">http://purl.org/adms/licencetype/ViralEffect-ShareAlike</entry>
<entry key="https://opendatacommons.org/licenses/odbl/summary/">http://purl.org/adms/licencetype/Attribution</entry>
<entry key="https://opendatacommons.org/licenses/odbl/summary/">http://purl.org/adms/licencetype/ViralEffect-ShareAlike</entry>
<entry key="https://creativecommons.org/licenses/by-nc/4.0/legalcode">http://purl.org/adms/licencetype/Attribution</entry>
<entry key="https://creativecommons.org/licenses/by-nc/4.0/legalcode">http://purl.org/adms/licencetype/NonCommercialUseOnly</entry>
<entry key="https://creativecommons.org/licenses/by-nc/3.0/">http://purl.org/adms/licencetype/Attribution</entry>
<entry key="https://creativecommons.org/licenses/by-nc/3.0/">http://purl.org/adms/licencetype/NonCommercialUseOnly</entry>
</xsl:variable>

<xsl:variable name="admsLicenceTypeVocabulary"
select="document('vocabularies/adms-licence-type.rdf')"/>
<!--
RDF Property: dcterms:accessRights
Definition: Information about who can access the resource or an indication of its security status.
Expand All @@ -58,6 +93,17 @@
<xsl:template mode="iso19115-3-to-dcat"
match="mdb:identificationInfo/*/mri:resourceConstraints/*">
<xsl:if test="count(../preceding-sibling::mri:resourceConstraints/*) = 0">

<xsl:for-each select="distinct-values(../../mri:resourceConstraints/*/mco:accessConstraints/*/@codeListValue)">
<xsl:variable name="dcatAccessType"
select="$dcatApAccessTypes[. = current()]"/>
<xsl:if test="$dcatAccessType">
<dct:accessRights>
<dct:RightsStatement rdf:about="{$dcatAccessType/@key}"/>
</dct:accessRights>
</xsl:if>
</xsl:for-each>

<xsl:for-each select="../../mri:resourceConstraints/*[mco:accessConstraints]/mco:otherConstraints">
<xsl:if test="position() = 1 or ($isPreservingAllResourceConstraints and position() > 1)">
<xsl:element name="{if (position() = 1) then 'dct:accessRights' else 'dct:rights'}">
Expand Down Expand Up @@ -104,6 +150,15 @@
<xsl:if test="$euDcatLicense != ''">
<dct:license>
<dct:LicenseDocument rdf:about="{$euDcatLicense/@rdf:about}">
<xsl:for-each select="$admsLicenceTypes[starts-with($httpUriInAnchorOrText, @key)]">
<xsl:variable name="uri" select="."/>
<dct:type>
<skos:Concept rdf:about="{$uri}">
<xsl:copy-of select="$admsLicenceTypeVocabulary//owl:NamedIndividual[@rdf:about = $uri]/skos:*"
copy-namespaces="no"/>
</skos:Concept>
</dct:type>
</xsl:for-each>
<!--<xsl:copy-of select="$euDcatLicense/(skos:prefLabel[@xml:lang = $languages/@iso2code]
|skos:exactMatch)"
copy-namespaces="no"/>-->
Expand All @@ -113,7 +168,17 @@
</xsl:when>
<xsl:when test="$httpUriInAnchorOrText != ''">
<dct:license>
<dct:LicenseDocument rdf:about="{$httpUriInAnchorOrText}"/>
<dct:LicenseDocument rdf:about="{$httpUriInAnchorOrText}">
<xsl:for-each select="$admsLicenceTypes[starts-with($httpUriInAnchorOrText, @key)]">
<xsl:variable name="uri" select="."/>
<dct:type>
<skos:Concept rdf:about="{$uri}">
<xsl:copy-of select="$admsLicenceTypeVocabulary//owl:NamedIndividual[@rdf:about = $uri]/skos:*"
copy-namespaces="no"/>
</skos:Concept>
</dct:type>
</xsl:for-each>
</dct:LicenseDocument>
</dct:license>
</xsl:when>
<xsl:otherwise>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@
-->
<xsl:template mode="iso19115-3-to-dcat"
match="mdb:identificationInfo/*/mri:associatedResource">
<!--
Disabled / See dcat-core-resource using the related API
<xsl:variable name="associationType"
select="*/mri:associationType/*/@codeListValue"/>
<xsl:variable name="initiativeType"
Expand All @@ -106,6 +108,6 @@
select="*/mri:metadataReference|*/mri:aggregateDataSetIdentifier">
<xsl:with-param name="isAbout" select="false()"/>
</xsl:apply-templates>
</xsl:element>
</xsl:element>-->
</xsl:template>
</xsl:stylesheet>
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@
<xsl:with-param name="reference" select="$reference"/>
</xsl:call-template>
<rdf:type rdf:resource="http://xmlns.com/foaf/0.1/{if ($isindividual) then 'Person' else 'Organization'}"/>
<rdf:type rdf:resource="http://www.w3.org/ns/prov#Agent"/>

<xsl:choose>
<xsl:when test="$isindividual">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
<xsl:template mode="iso19115-3-to-dcat"
match="srv:containsOperations/*/srv:connectPoint/*[not(
matches(cit:protocol/(gco:CharacterString|gcx:Anchor)/text(), $endpointDescriptionProtocolsExpression, 'i')
or matches(cit:linkage/(gco:CharacterString|gcx:Anchor)/text(), $endpointDescriptionUrlExpression, 'i'))]/cit:linkage">
or matches(cit:linkage/(gco:CharacterString|gcx:Anchor)/text(), $endpointDescriptionUrlExpression, 'i')
or cit:function/*/@codeListValue = 'information')]/cit:linkage">

<dcat:endpointURL rdf:resource="{normalize-space((gco:CharacterString|gcx:Anchor)/text())}"/>
</xsl:template>
Expand All @@ -54,7 +55,8 @@
<xsl:template mode="iso19115-3-to-dcat"
match="srv:containsOperations/*/srv:connectPoint/*[
matches(cit:protocol/(gco:CharacterString|gcx:Anchor)/text(), $endpointDescriptionProtocolsExpression, 'i')
or matches(cit:linkage/(gco:CharacterString|gcx:Anchor)/text(), $endpointDescriptionUrlExpression, 'i')]/cit:linkage">
or matches(cit:linkage/(gco:CharacterString|gcx:Anchor)/text(), $endpointDescriptionUrlExpression, 'i')
or cit:function/*/@codeListValue = 'information']/cit:linkage">
<dcat:endpointDescription rdf:resource="{normalize-space((gco:CharacterString|gcx:Anchor)/text())}"/>
</xsl:template>

Expand All @@ -65,8 +67,13 @@
-->
<xsl:template mode="iso19115-3-to-dcat"
match="srv:operatesOn">
<!--
Can be disabled for catalogues describing services and
associating them with datasets.
See related API in dcat-core-resource
<dcat:servesDataset>
<dcat:Dataset rdf:about="{if (@xlink:href) then @xlink:href else @uuidref}"/>
</dcat:servesDataset>
-->
</xsl:template>
</xsl:stylesheet>
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,15 @@
|mpc:portrayalCatalogueCitation/*/cit:onlineResource
|mrl:additionalDocumentation/*/cit:onlineResource
|mdq:reportReference/*/cit:onlineResource
|mdq:reportReference/*/cit:title[gcx:Anchor/@xlink:href]
|mdq:specification/*/cit:onlineResource
|mdq:specification/*/cit:title[gcx:Anchor/@xlink:href]
|mrc:featureCatalogueCitation/*/cit:onlineResource">
<xsl:param name="additionalProperties"
as="node()*"/>

<xsl:variable name="url"
select="*/cit:linkage/gco:CharacterString/text()"/>
select="(*/cit:linkage/gco:CharacterString/text()|gcx:Anchor/@xlink:href)[1]"/>

<xsl:variable name="protocol"
select="*/cit:protocol/*/text()"/>
Expand Down Expand Up @@ -163,9 +165,10 @@
</foaf:Document>
</foaf:documentation>
</xsl:when>
<xsl:when test="$function = ('information', 'search', 'completeMetadata', 'browseGraphic', 'upload', 'emailService')
or (not($function) and matches($protocol, 'WWW:LINK.*'))">
<foaf:page>
<xsl:when test="$function = ('information', 'information.content', 'search', 'completeMetadata', 'browseGraphic', 'upload', 'emailService')
or ($function = ('browsing') and matches($protocol, 'WWW:LINK.*'))
or ((not($function) or $function = '') and (matches($protocol, 'WWW:LINK.*') or not($protocol) or $protocol = ''))">
<foaf:page>
<foaf:Document rdf:about="{$url}">
<xsl:apply-templates mode="iso19115-3-to-dcat"
select="*/cit:name[normalize-space(.) != '']
Expand All @@ -191,8 +194,8 @@
RDF Property: dcterms:issued
Definition: Date of formal issuance (e.g., publication) of the distribution.
-->
<xsl:for-each
select="ancestor::mrd:MD_Distributor/mrd:distributionOrderProcess/*/mrd:plannedAvailableDateTime">
<xsl:for-each select="ancestor::mrd:MD_Distributor/mrd:distributionOrderProcess/*/mrd:plannedAvailableDateTime|
ancestor::mdb:MD_Metadata/mdb:identificationInfo/*/mri:citation/*/cit:date/*[cit:dateType/*/@codeListValue = 'publication']">
<xsl:apply-templates mode="iso19115-3-to-dcat"
select=".">
<xsl:with-param name="dateType" select="'publication'"/>
Expand All @@ -203,9 +206,13 @@
RDF Property: dcterms:modified
Definition: Most recent date on which the distribution was changed, updated or modified.
Range: rdfs:Literal encoded using the relevant ISO 8601 Date and Time compliant string [DATETIME] and typed using the appropriate XML Schema datatype [XMLSCHEMA11-2] (xsd:gYear, xsd:gYearMonth, xsd:date, or xsd:dateTime).
Not supported
-->
<xsl:for-each select="ancestor::mdb:MD_Metadata/mdb:identificationInfo/*/mri:citation/*/cit:date/*[cit:dateType/*/@codeListValue = 'revision']">
<xsl:apply-templates mode="iso19115-3-to-dcat"
select=".">
<xsl:with-param name="dateType" select="'revision'"/>
</xsl:apply-templates>
</xsl:for-each>


<!--
Expand Down Expand Up @@ -273,6 +280,8 @@
Definition: A data service that gives access to the distribution of the dataset
Range: dcat:DataService
Usage note: dcat:accessService SHOULD be used to link to a description of a dcat:DataService that can provide access to this distribution.
DataService can be better described by an associated service metadata record.
-->
<xsl:if test="$function = ('download', 'offlineAccess', 'order', 'browsing', 'fileAccess')
or matches($protocol, 'OGC:WMS|OGC:WFS|OGC:WCS|OGC:WPS|OGC API Features|OGC API Coverages|ESRI:REST')">
Expand Down Expand Up @@ -331,9 +340,22 @@
<xsl:otherwise>
<xsl:choose>
<xsl:when test="starts-with($protocol, 'WWW:DOWNLOAD:')">
<xsl:variable name="format"
select="substring-after($protocol, 'WWW:DOWNLOAD:')"/>

<!-- The file format of the Distribution. -->
<xsl:call-template name="rdf-format-as-mediatype">
<xsl:with-param name="format" select="substring-after($protocol, 'WWW:DOWNLOAD:')"/>
<xsl:with-param name="format" select="$format"/>
</xsl:call-template>

<!-- The media type of the Distribution as defined in the official register of media types managed by IANA. -->
<xsl:if test="matches($format, '\w+/[-+.\w]+')">
<dcat:mediaType>
<dct:MediaType>
<rdfs:label><xsl:value-of select="$format"/></rdfs:label>
</dct:MediaType>
</dcat:mediaType>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="iso19115-3-to-dcat-distribution"
Expand Down Expand Up @@ -410,6 +432,9 @@
-->
<xsl:apply-templates mode="iso19115-3-to-dcat"
select="ancestor::mdb:MD_Metadata/mdb:dataQualityInfo/*/mdq:report/*/mdq:result[mdq:DQ_ConformanceResult and mdq:DQ_ConformanceResult/mdq:pass/*/text() = 'true']"/>

<xsl:apply-templates mode="iso19115-3-to-dcat"
select="ancestor::mdb:MD_Metadata/mdb:identificationInfo/*/mri:defaultLocale"/>
</xsl:if>

<xsl:copy-of select="$additionalProperties"/>
Expand Down Expand Up @@ -443,7 +468,7 @@

<xsl:variable name="formatUri"
as="xs:string?"
select="($formatLabelToUri[lower-case($format) = text()]/@key)[1]"/>
select="($formatLabelToUri[lower-case($format) = lower-case(text())]/@key)[1]"/>

<xsl:variable name="rangeName"
as="xs:string"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
xmlns:mri="http://standards.iso.org/iso/19115/-3/mri/1.0"
xmlns:gco="http://standards.iso.org/iso/19115/-3/gco/1.0"
xmlns:gcx="http://standards.iso.org/iso/19115/-3/gcx/1.0"
xmlns:cit="http://standards.iso.org/iso/19115/-3/cit/2.0"
xmlns:dct="http://purl.org/dc/terms/"
xmlns:dcat="http://www.w3.org/ns/dcat#"
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xlink="http://www.w3.org/1999/xlink"
exclude-result-prefixes="#all">

Expand Down Expand Up @@ -38,15 +41,31 @@
<xsl:template mode="iso19115-3-to-dcat"
match="mdb:identificationInfo/*/mri:descriptiveKeywords/*/mri:keyword[gcx:Anchor/@xlink:href != '']"
priority="2">
<dcat:theme>
<skos:Concept>
<xsl:call-template name="rdf-object-ref-attribute"/>
<xsl:variable name="isDcatTheme"
select="../mri:thesaurusName/*/cit:title/*/@xlink:href = ('http://publications.europa.eu/resource/authority/data-theme')"/>

<xsl:choose>
<xsl:when test="$isDcatTheme">
<dcat:theme>
<skos:Concept>
<xsl:call-template name="rdf-object-ref-attribute"/>
<xsl:call-template name="rdf-localised">
<xsl:with-param name="nodeName"
select="'skos:prefLabel'"/>
</xsl:call-template>
</skos:Concept>
</dcat:theme>
</xsl:when>
<xsl:otherwise>
<dct:subject>
<xsl:attribute name="rdf:resource" select="gcx:Anchor/@xlink:href"/>
</dct:subject>
<xsl:call-template name="rdf-localised">
<xsl:with-param name="nodeName"
select="'skos:prefLabel'"/>
select="'dcat:keyword'"/>
</xsl:call-template>
</skos:Concept>
</dcat:theme>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template mode="iso19115-3-to-dcat"
Expand All @@ -57,4 +76,7 @@
select="'dcat:keyword'"/>
</xsl:call-template>
</xsl:template>

<xsl:template mode="iso19115-3-to-dcat"
match="mdb:identificationInfo/*/mri:descriptiveKeywords/*/mri:keyword"/>
</xsl:stylesheet>
Loading
Loading