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 #8547

Merged
merged 10 commits into from
Dec 12, 2024
187 changes: 150 additions & 37 deletions docs/manual/docs/api/rdf-dcat.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
as="node()"/>

<foaf:isPrimaryTopicOf>
<rdf:Description>
<rdf:Description rdf:about="{gn-fn-dcat:getRecordUri(.)}">
<rdf:type rdf:resource="http://www.w3.org/ns/dcat#CatalogRecord"/>
<xsl:copy-of select="$properties"/>
<foaf:primaryTopic rdf:resource="{gn-fn-dcat:getRecordUri($metadata)}"/>
<foaf:primaryTopic rdf:resource="{gn-fn-dcat:getResourceUri($metadata)}"/>
</rdf:Description>
</foaf:isPrimaryTopicOf>
</xsl:template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
xmlns:gco="http://standards.iso.org/iso/19115/-3/gco/1.0"
xmlns:mco="http://standards.iso.org/iso/19115/-3/mco/1.0"
xmlns:mri="http://standards.iso.org/iso/19115/-3/mri/1.0"
xmlns:mpc="http://standards.iso.org/iso/19115/-3/mpc/1.0"
xmlns:mdq="http://standards.iso.org/iso/19157/-2/mdq/1.0"
xmlns:mrc="http://standards.iso.org/iso/19115/-3/mrc/2.0"
xmlns:gcx="http://standards.iso.org/iso/19115/-3/gcx/1.0"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
Expand All @@ -28,46 +30,46 @@
https://github.com/SEMICeu/GeoDCAT-AP/issues/100
-->
<xsl:param name="copyDatasetInfoToDistribution"
as="xs:string"
select="'false'"/>
as="xs:string"
select="'false'"/>
<xsl:variable name="isCopyingDatasetInfoToDistribution"
as="xs:boolean"
select="xs:boolean($copyDatasetInfoToDistribution)"/>

<xsl:variable name="protocolToStandardPage"
as="node()*">
<entry key="http://www.opengeospatial.org/standards/cat">
<value>csw</value>
<value>ogc:csw</value>
</entry>
<entry key="http://www.opengeospatial.org/standards/sos">
<value>sos</value>
<value>ogc:sos</value>
</entry>
<entry key="http://www.opengeospatial.org/standards/sps">
<value>sps</value>
<value>ogc:sps</value>
</entry>
<entry key="http://www.opengeospatial.org/standards/wcs">
<value>wcs</value>
<value>ogc:wcs</value>
</entry>
<entry key="http://www.opengeospatial.org/standards/wfs">
<value>wfs</value>
<value>ogc:wfs</value>
</entry>
<entry key="http://www.opengeospatial.org/standards/wms">
<value>wms</value>
<value>ogc:wms</value>
</entry>
<entry key="http://www.opengeospatial.org/standards/wmts">
<value>wmts</value>
<value>ogc:wmts</value>
</entry>
<entry key="http://www.opengeospatial.org/standards/wps">
<value>wps</value>
<value>ogc:wps</value>
</entry>
<entry key="http://www.opengeospatial.org/standards/cat">
<value>csw</value>
<value>ogc:csw</value>
</entry>
<entry key="http://www.opengeospatial.org/standards/sos">
<value>sos</value>
<value>ogc:sos</value>
</entry>
<entry key="http://www.opengeospatial.org/standards/sps">
<value>sps</value>
<value>ogc:sps</value>
</entry>
<entry key="http://www.opengeospatial.org/standards/wcs">
<value>wcs</value>
<value>ogc:wcs</value>
</entry>
<entry key="http://www.opengeospatial.org/standards/wfs">
<value>wfs</value>
<value>ogc:wfs</value>
</entry>
<entry key="http://www.opengeospatial.org/standards/wms">
<value>wms</value>
<value>ogc:wms</value>
</entry>
<entry key="http://www.opengeospatial.org/standards/wmts">
<value>wmts</value>
<value>ogc:wmts</value>
</entry>
<entry key="http://www.opengeospatial.org/standards/wps">
<value>wps</value>
<value>ogc:wps</value>
</entry>
</xsl:variable>


Expand Down Expand Up @@ -97,7 +99,6 @@
</xsl:template>



<xsl:template mode="iso19115-3-to-dcat"
match="mdb:identificationInfo/*/mri:graphicOverview[*/mcc:fileName/*/text() != '']">
<foaf:page>
Expand All @@ -117,7 +118,12 @@
-->
<xsl:template mode="iso19115-3-to-dcat"
name="iso19115-3-to-dcat-distribution"
match="mdb:distributionInfo//mrd:onLine">
match="mdb:distributionInfo//mrd:onLine
|mpc:portrayalCatalogueCitation/*/cit:onlineResource
|mrl:additionalDocumentation/*/cit:onlineResource
|mdq:reportReference/*/cit:onlineResource
|mdq:specification/*/cit:onlineResource
|mrc:featureCatalogueCitation/*/cit:onlineResource">
<xsl:param name="additionalProperties"
as="node()*"/>

Expand All @@ -141,8 +147,24 @@

<xsl:choose>
<xsl:when test="normalize-space($url) = ''"/>
<!--
TODO: The rule to populate the documentation element depends a lot on the context.
There is no known common guidance how to encode this and this can be quite user specific.
For service, it is mandatory from an HVD point of view ("quality of service information is considered part of the generic documentation of a Data Service.").
-->
<xsl:when test="$function = ('documentation')
or count(ancestor::mrl:additionalDocumentation) = 1
or starts-with($url, 'https://directory.spatineo.com')">
<foaf:documentation>
<foaf:Document rdf:about="{$url}">
<xsl:apply-templates mode="iso19115-3-to-dcat"
select="*/cit:name[normalize-space(.) != '']
|*/cit:description[normalize-space(.) != '']"/>
</foaf:Document>
</foaf:documentation>
</xsl:when>
<xsl:when test="$function = ('information', 'search', 'completeMetadata', 'browseGraphic', 'upload', 'emailService')
or matches($protocol, 'WWW:LINK.*')">
or (not($function) and matches($protocol, 'WWW:LINK.*'))">
<foaf:page>
<foaf:Document rdf:about="{$url}">
<xsl:apply-templates mode="iso19115-3-to-dcat"
Expand All @@ -169,7 +191,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">
<xsl:apply-templates mode="iso19115-3-to-dcat"
select=".">
<xsl:with-param name="dateType" select="'publication'"/>
Expand Down Expand Up @@ -228,7 +251,6 @@
-->



<!--
RDF Property: dcat:byteSize
Definition: The size of a distribution in bytes.
Expand All @@ -237,9 +259,12 @@
Usage note: The size in bytes can be approximated (as a non-negative integer) when the precise size is not known.
Usage note: While it is recommended that the size be given as an integer, alternative literals such as '1.5 MB' are sometimes used.
-->
<xsl:for-each select="ancestor::mrd:MD_DigitalTransferOptions/mrd:transferSize/*/text()[. castable as xs:double]">
<xsl:for-each
select="ancestor::mrd:MD_DigitalTransferOptions/mrd:transferSize/*/text()[. castable as xs:double]">
<!-- Not valid for eu-dcat-ap <dcat:byteSize><xsl:value-of select="concat(., ' MB')"/></dcat:byteSize>-->
<dcat:byteSize rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger"><xsl:value-of select="format-number(. * 1048576, '#')"/></dcat:byteSize>
<dcat:byteSize rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">
<xsl:value-of select="format-number(. * 1048576, '#')"/>
</dcat:byteSize>
</xsl:for-each>


Expand Down Expand Up @@ -433,7 +458,9 @@
</xsl:when>
<xsl:otherwise>
<xsl:element name="{$rangeName}">
<rdfs:label><xsl:value-of select="$format"/></rdfs:label>
<rdfs:label>
<xsl:value-of select="$format"/>
</rdfs:label>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
xmlns:mex="http://standards.iso.org/iso/19115/-3/mex/1.0"
xmlns:msr="http://standards.iso.org/iso/19115/-3/msr/2.0"
xmlns:mmi="http://standards.iso.org/iso/19115/-3/mmi/1.0"
xmlns:mpc="http://standards.iso.org/iso/19115/-3/mpc/1.0"
xmlns:mrd="http://standards.iso.org/iso/19115/-3/mrd/1.0"
xmlns:mdq="http://standards.iso.org/iso/19157/-2/mdq/1.0"
xmlns:srv="http://standards.iso.org/iso/19115/-3/srv/2.0"
Expand Down Expand Up @@ -85,7 +86,6 @@
select="$metadata"/>
</xsl:variable>


<xsl:variable name="resourcePrefix"
select="concat(util:getSettingValue('nodeUrl'), 'api/records/')"
as="xs:string"/>
Expand All @@ -99,15 +99,42 @@
select="$metadata/mdb:metadataLinkage/*/cit:linkage/(gco:CharacterString|gcx:Anchor)/text()"
as="xs:string?"/>

<xsl:variable name="metadataIdentifier"
as="node()?">
<xsl:apply-templates mode="iso19115-3-to-dcat"
select="$metadata/mdb:metadataIdentifier"/>
</xsl:variable>
<!-- TODO: Should we consider DOI? It may be encoded in metadata linkage (not available in ISO19139) -->

<xsl:value-of select="if($metadataLinkage) then $metadataLinkage
else concat($resourcePrefix, encode-for-uri($metadata/mdb:metadataIdentifier/*/mcc:code/*/text()))"
else if($metadataIdentifier) then $metadataIdentifier
else concat($resourcePrefix, encode-for-uri($metadata/mdb:metadataIdentifier/*/mcc:code/*/text()))"
/>
</xsl:function>

<xsl:function name="gn-fn-dcat:getResourceUri" as="xs:string">
<xsl:param name="metadata" as="node()"/>

<xsl:variable name="catalogRecordUri"
select="gn-fn-dcat:getRecordUri($metadata)"
as="xs:string"/>

<xsl:variable name="resourceIdentifier"
as="node()?">
<xsl:apply-templates mode="iso19115-3-to-dcat"
select="($metadata/mdb:identificationInfo/*/mri:citation/*/cit:identifier)[1]"/>
</xsl:variable>

<xsl:value-of select="if($resourceIdentifier) then $resourceIdentifier
else concat($catalogRecordUri, '#resource')"
/>
</xsl:function>


<!-- Create resource -->
<xsl:template mode="iso19115-3-to-dcat"
match="mdb:MD_Metadata">
<rdf:Description rdf:about="{gn-fn-dcat:getRecordUri(.)}">
<rdf:Description rdf:about="{gn-fn-dcat:getResourceUri(.)}">
<xsl:apply-templates mode="iso19115-3-to-dcat"
select="mdb:metadataScope/*/mdb:resourceScope/*/@codeListValue"/>

Expand All @@ -129,6 +156,11 @@
|mdb:identificationInfo/*/mri:extent/*/gex:geographicElement/gex:EX_GeographicDescription
|mdb:identificationInfo/*/mri:extent/*/gex:temporalElement/*/gex:extent
|mdb:distributionInfo//mrd:onLine
|.//mpc:portrayalCatalogueCitation/*/cit:onlineResource
|.//mrl:additionalDocumentation//cit:onlineResource
|.//mdq:reportReference//cit:onlineResource
|.//mdq:specification//cit:onlineResource
|.//mrc:featureCatalogueCitation//cit:onlineResource
|mdb:identificationInfo/*/mri:graphicOverview
"/>

Expand All @@ -150,6 +182,7 @@
|mdb:resourceLineage/*/mrl:statement
|mrd:onLine/*/cit:name
|mrd:onLine/*/cit:description
|cit:onlineResource/*/cit:description
|mri:graphicOverview/*/mcc:fileDescription
">
<xsl:variable name="xpath"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
<entry key="dct:description">mdb:MD_Metadata/mdb:identificationInfo/mri:MD_DataIdentification/mri:graphicOverview/mcc:MD_BrowseGraphic/mcc:fileDescription</entry>
<entry key="dct:description">mdb:MD_Metadata/mdb:identificationInfo/srv:SV_ServiceIdentification/mri:graphicOverview/mcc:MD_BrowseGraphic/mcc:fileDescription</entry>
<entry key="dct:description">mdb:MD_Metadata/mdb:distributionInfo/mrd:MD_Distribution/mrd:transferOptions/mrd:MD_DigitalTransferOptions/mrd:onLine/cit:CI_OnlineResource/cit:description</entry>
<entry key="dct:description">mdb:MD_Metadata/mdb:contentInfo/mrc:MD_FeatureCatalogueDescription/mrc:featureCatalogueCitation/cit:CI_Citation/cit:onlineResource/cit:CI_OnlineResource/cit:CI_OnlineResource/cit:description</entry>
<entry key="dct:description">mdb:MD_Metadata/mdb:resourceLineage/mrl:LI_Lineage/mrl:additionalDocumentation/cit:CI_Citation/cit:onlineResource/cit:CI_OnlineResource/cit:CI_OnlineResource/cit:description</entry>
<entry key="dct:description">mdb:MD_Metadata/mdb:portrayalCatalogueInfo/mpc:MD_PortrayalCatalogueReference/mpc:portrayalCatalogueCitation/cit:CI_Citation/cit:onlineResource/cit:CI_OnlineResource/cit:description</entry>
<entry key="dct:description">mdb:MD_Metadata/mdb:distributionInfo/mrd:MD_Distribution/mrd:distributor/mrd:MD_Distributor/mrd:distributorTransferOptions/mrd:MD_DigitalTransferOptions/mrd:onLine/cit:CI_OnlineResource/cit:description</entry>
<entry key="owl:versionInfo">mdb:MD_Metadata/mdb:metadataStandard/cit:CI_Citation/cit:edition</entry>
<entry key="adms:versionNotes">mdb:MD_Metadata/mdb:resourceLineage/mrl:LI_Lineage/mrl:statement</entry>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
xmlns:dcatap="http://data.europa.eu/r5r/"
xmlns:dcat="http://www.w3.org/ns/dcat#"
xmlns:eli="http://data.europa.eu/eli/ontology"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:dct="http://purl.org/dc/terms/"
Expand Down Expand Up @@ -75,6 +76,11 @@
<xsl:variable name="hvdCategory"
select="$euHvdDataCategories/rdf:RDF/*[skos:prefLabel/normalize-space(.) = $category]"/>
<xsl:if test="$hvdCategory">
<!--<dcat:theme>
<skos:Concept rdf:about="{$hvdCategory/@rdf:about}">
<xsl:copy-of select="$hvdCategory/skos:prefLabel[@xml:lang = $languages/@iso2code]"/>
</skos:Concept>
</dcat:theme>-->
<dcatap:hvdCategory>
<skos:Concept rdf:about="{$hvdCategory/@rdf:about}">
<xsl:copy-of select="$hvdCategory/skos:prefLabel[@xml:lang = $languages/@iso2code]"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<dct:title xml:lang="en">EU applicable legislations</dct:title>
<dct:title xml:lang="fr">Législations applicables dans l'UE</dct:title>
<dct:description xml:lang="fr">Législation sectorielle qui prescrit la création ou la gestion de la ressource.
Liste non exhaustive.</dct:description>
Liste non exhaustive.
</dct:description>
</skos:ConceptScheme>
<skos:Concept rdf:about="http://data.europa.eu/eli/reg_impl/2023/138/oj">
Expand Down
Loading
Loading