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 2 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
109 changes: 92 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 @@ -104,6 +104,7 @@
<xsl:param name="uuid"/>

<dct:references>
<!-- SIB addon-->
<rdf:Description rdf:about="{$url}/srv/api/records/{$uuid}/formatters/xml">
<dct:format>
<dct:IMT>
Expand All @@ -115,7 +116,9 @@
</dct:references>

<dct:references>
<rdf:Description rdf:about="{$url}/srv/api/records/{$uuid}">
<!-- SIB addon-->
<!-- <rdf:Description rdf:about="{$url}/srv/api/records/{$uuid}"> -->
<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 +190,14 @@
<xsl:value-of select="(gmd:protocol/gmx:Anchor)[1]"/>
</dcat:mediaType>
</xsl:if>

<!-- SIB addon-->
<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 +284,10 @@
-->
<xsl:template match="gmd:MD_DataIdentification|*[contains(@gco:isoType, 'MD_DataIdentification')]"
mode="to-dcat">
<dcat:Dataset rdf:about="{$resourcePrefix}/datasets/{iso19139:getResourceCode(../../.)}">

<!-- SIB addon-->
<!-- <dcat:Dataset rdf:about="{$resourcePrefix}/datasets/{iso19139:getResourceCode(../../.)}"> -->
<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 +304,10 @@
</dct:identifier>
<!-- xpath: gmd:identificationInfo/*/gmd:citation/*/gmd:identifier/*/gmd:code -->

<!-- SIB addon-->
<dcat:landingPage>
<xsl:value-of select="$url"/>/srv/api/records/<xsl:value-of select="$uuid"/>
landryb marked this conversation as resolved.
Show resolved Hide resolved
</dcat:landingPage>

<dct:title>
<xsl:value-of select="gmd:citation/*/gmd:title/gco:CharacterString"/>
Expand All @@ -299,6 +317,16 @@

<dct:abstract>
<xsl:value-of select="gmd:abstract/gco:CharacterString"/>

<!-- SIB addon-->
<!-- Layout will be visible only in source mode in the browser. If not in source mode, newlines won't be displayed and the keywords will be shown inline -->
<xsl:text>&#xa;</xsl:text> <!-- linebreak -->
<!-- Keywords -->
<xsl:for-each-group select="//gmd:MD_Keywords[(gmd:thesaurusName)]/gmd:keyword"
group-by="gco:CharacterString|gmx:Anchor">
<xsl:text>&#xa;</xsl:text> <!-- linebreak -->
<xsl:value-of select="normalize-space(../gmd:thesaurusName/*/gmd:title)"/> : <xsl:value-of select="normalize-space(gco:CharacterString|gmx:Anchor)"/><xsl:text>.</xsl:text>
</xsl:for-each-group>
Copy link
Member Author

Choose a reason for hiding this comment

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

after discussion with @jeanpommier this section might not be needed ?

</dct:abstract>
<!-- xpath: gmd:identificationInfo/*/gmd:abstract/gco:CharacterString -->

Expand Down Expand Up @@ -427,26 +455,45 @@
<!-- xpath: gmd:identificationInfo/*/gmd:language/gmd:LanguageCode/@codeListValue -->


<!-- dct:license content -->
<!-- "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: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">accessRights</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<!-- xpath: gmd:identificationInfo/*/gmd:resourceConstraints/??? -->


<xsl:for-each select="../../gmd:distributionInfo/*/gmd:transferOptions/*/gmd:onLine">
<dcat:distribution rdf:resource="{iso19139:RecordUri($uuid)}#{encode-for-uri(gmd:CI_OnlineResource/gmd:protocol/*/text())}-{encode-for-uri(gmd:CI_OnlineResource/gmd:name/(gco:CharacterString|gmx:Anchor)/text())}"/>
</xsl:for-each>
Expand Down Expand Up @@ -522,6 +569,34 @@
</xsl:template>


<!--
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