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

wip for better csw-dcat output for data.gouv.fr #288

Draft
wants to merge 5 commits into
base: georchestra-gn4.2.x
Choose a base branch
from
Draft
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
94 changes: 77 additions & 17 deletions schemas/iso19139/src/main/plugin/iso19139/layout/tpl-rdf.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@
</dct:references>

<dct:references>
<rdf:Description rdf:about="{$url}/srv/api/records/{$uuid}">
<!-- geOrchestra change: use a 'nice' HTML view for the md description url-->
<rdf:Description rdf:about="{$url}/srv/fre/catalog.search#/metadata/{$uuid}">
<dct:format>
<dct:IMT>
<rdf:value>text/html</rdf:value>
Expand Down Expand Up @@ -187,6 +188,14 @@
<xsl:value-of select="(gmd:protocol/gmx:Anchor)[1]"/>
</dcat:mediaType>
</xsl:if>

<!-- geOrchestra addition: put the description of the attached file -> fills the 'Description des données' field in uData -->
<xsl:if test="(gmd:description/gco:CharacterString)[1]!=''">
<dct:description>
<xsl:value-of select="(gmd:description/gco:CharacterString)[1]"/>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note for $self: this is to solve Description des données non renseignée on harvested data, which comes from the attached resource description

</dct:description>
</xsl:if>

<xsl:if test="(gmd:protocol/gco:CharacterString)[1]!=''">
<dct:format>
<xsl:value-of select="(gmd:protocol/gco:CharacterString)[1]"/>
Expand Down Expand Up @@ -273,7 +282,8 @@
-->
<xsl:template match="gmd:MD_DataIdentification|*[contains(@gco:isoType, 'MD_DataIdentification')]"
mode="to-dcat">
<dcat:Dataset rdf:about="{$resourcePrefix}/datasets/{iso19139:getResourceCode(../../.)}">
<!-- geOrchestra change: /datasets/ doesnt map to anything, use the same as rdf:Description -->
<dcat:Dataset rdf:about="{$resourcePrefix}/{iso19139:getResourceCode(../../.)}">
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/datasets doesnt map to anything in geonetwork under resources?

<xsl:call-template name="to-dcat"/>
</dcat:Dataset>
</xsl:template>
Expand All @@ -290,6 +300,10 @@
</dct:identifier>
<!-- xpath: gmd:identificationInfo/*/gmd:citation/*/gmd:identifier/*/gmd:code -->

<!-- geOrchestra addition: provide an HTML record view for the 'Voir la source originale' link -->
<dcat:landingPage>
<xsl:value-of select="$url"/>/<xsl:value-of select="util:getNodeId()"/>/api/records/<xsl:value-of select="$uuid"/>
</dcat:landingPage>

<dct:title>
<xsl:value-of select="gmd:citation/*/gmd:title/gco:CharacterString"/>
Expand Down Expand Up @@ -427,23 +441,41 @@
<!-- xpath: gmd:identificationInfo/*/gmd:language/gmd:LanguageCode/@codeListValue -->


<!-- dct:license content - geOrchestra addition -->
<!-- "The license under which the dataset is published and can be reused." -->
<xsl:for-each select="gmd:resourceConstraints/gmd:MD_LegalConstraints/*/gmd:MD_RestrictionCode[@codeListValue!='otherRestrictions']">
<dct:license>
<xsl:value-of select="@codeListValue"/>
</dct:license>
<xsl:for-each select="gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:useConstraints">
<xsl:choose>
<xsl:when test="gmd:MD_RestrictionCode[@codeListValue!='otherRestrictions']">
<dct:license>
<xsl:value-of select="@codeListValue"/>
</dct:license>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="legalOtherConstraints">
<xsl:with-param name="ocnode"><xsl:copy-of select="./following-sibling::gmd:otherConstraints[1]"/></xsl:with-param>
<xsl:with-param name="tagname">license</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:for-each
select="gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:otherConstraints/gco:CharacterString">
<dct:license>
<xsl:value-of select="."/>
</dct:license>
</xsl:for-each>
<xsl:for-each
select="gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:otherConstraints/gmx:Anchor">
<dct:license rdf:resource="{@xlink:href}">
<xsl:value-of select="."/>
</dct:license>

<!-- Access constraints should not be stored under license, but rather on accessRights category,
cf https://semiceu.github.io/GeoDCAT-AP/releases/2.0.0/#conditions-for-access-and-use-and-limitations-on-public-access-use-limitation-and-access-other-constraints
-->
<xsl:for-each select="gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:accessConstraints">
<xsl:choose>
<xsl:when test="gmd:MD_RestrictionCode[@codeListValue!='otherRestrictions']">
<dct:accessRights>
<xsl:value-of select="@codeListValue"/>
</dct:accessRights>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="legalOtherConstraints">
<xsl:with-param name="ocnode"><xsl:copy-of select="./following-sibling::gmd:otherConstraints[1]"/></xsl:with-param>
<xsl:with-param name="tagname">accessRights</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<!-- xpath: gmd:identificationInfo/*/gmd:resourceConstraints/??? -->

Expand Down Expand Up @@ -522,6 +554,34 @@
</xsl:template>


<!-- geOrchestra addition
Process the otherContraints in LegalResources differently depending on the previous sibling. If gmd:useConstraints use dct:license, if gmd:accessConstraints use dct:accessRights
-->
<xsl:template name="legalOtherConstraints">
<xsl:param name="ocnode"/>
<xsl:param name="tagname"/>

<xsl:choose>
<xsl:when test="$ocnode/gmd:otherConstraints/gmx:Anchor">
<xsl:element name="dct:{$tagname}">
<xsl:attribute name="rdf:resource">
<xsl:value-of select="$ocnode/gmd:otherConstraints/gmx:Anchor/@xlink:href"/>
</xsl:attribute>
<xsl:value-of select="$ocnode/gmd:otherConstraints/gmx:Anchor"/>
</xsl:element>
</xsl:when>
<xsl:when test="$ocnode/gmd:otherConstraints/gco:CharacterString">
<xsl:element name="dct:{$tagname}">
<xsl:value-of select="$ocnode/gmd:otherConstraints/gco:CharacterString"/>
</xsl:element>
</xsl:when>
<!-- <xsl:otherwise>-->
<!-- <xsl:copy-of select="$ocnode"/>-->
<!-- </xsl:otherwise>-->
</xsl:choose>
</xsl:template>


<!--
Get resource (dataset or service) identifier if set and return metadata UUID if not.
-->
Expand Down
Loading