Skip to content

Commit

Permalink
Formatter / DCAT / Add ADMS license type and EU access rights.
Browse files Browse the repository at this point in the history
* Based on license URL add corresponding ADMS type
* Based on accessConstraint type add EU access type

```xml
<dct:LicenseDocument rdf:about="https://creativecommons.org/licenses/by-sa/2.0">
    <dct:type>
       <skos:Concept rdf:about="http://purl.org/adms/licencetype/ViralEffect-ShareAlike">
          <skos:prefLabel xml:lang="en">Viral effect (a.k.a. Share-alike)</skos:prefLabel>
          <skos:notation>ViralEffect-ShareAlike</skos:notation>
          <skos:inScheme rdf:resource="http://purl.org/adms/licencetype/1.0"/>
       </skos:Concept>
    </dct:type>
    <dct:type>
       <skos:Concept rdf:about="http://purl.org/adms/licencetype/Attribution">
          <skos:notation>Attribution</skos:notation>
          <skos:prefLabel xml:lang="en">Attribution</skos:prefLabel>
          <skos:inScheme rdf:resource="http://purl.org/adms/licencetype/1.0"/>
       </skos:Concept>
    </dct:type>
 </dct:LicenseDocument>
</dct:license>

<dct:accessRights>
 <dct:RightsStatement rdf:about="http://publications.europa.eu/resource/authority/access-right/PUBLIC"/>
</dct:accessRights>
```
  • Loading branch information
fxprunayre committed Feb 7, 2025
1 parent 63171aa commit deee919
Show file tree
Hide file tree
Showing 3 changed files with 1,102 additions and 1 deletion.
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
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8" ?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
xmlns:ns5="http://publications.europa.eu/ontology/euvoc#"
xmlns:ns6="http://www.w3.org/2008/05/skos-xl#"
xmlns:ns7="http://publications.europa.eu/ontology/authority/" >
<rdf:Description rdf:about="http://publications.europa.eu/resource/authority/access-right/NON_PUBLIC">
<skos:inScheme rdf:resource="http://publications.europa.eu/resource/authority/access-right" />
<skos:topConceptOf rdf:resource="http://publications.europa.eu/resource/authority/access-right" />
</rdf:Description>
<rdf:Description rdf:about="http://publications.europa.eu/resource/authority/access-right/OP_DATPRO">
<skos:inScheme rdf:resource="http://publications.europa.eu/resource/authority/access-right" />
<skos:topConceptOf rdf:resource="http://publications.europa.eu/resource/authority/access-right" />
</rdf:Description>
<rdf:Description rdf:about="http://publications.europa.eu/resource/authority/access-right/PUBLIC">
<skos:inScheme rdf:resource="http://publications.europa.eu/resource/authority/access-right" />
<skos:topConceptOf rdf:resource="http://publications.europa.eu/resource/authority/access-right" />
</rdf:Description>
<rdf:Description rdf:about="http://publications.europa.eu/resource/authority/access-right/RESTRICTED">
<skos:inScheme rdf:resource="http://publications.europa.eu/resource/authority/access-right" />
<skos:topConceptOf rdf:resource="http://publications.europa.eu/resource/authority/access-right" />
</rdf:Description>
<rdf:Description rdf:about="http://publications.europa.eu/resource/authority/access-right">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Ontology" />
<rdf:type rdf:resource="http://www.w3.org/2004/02/skos/core#ConceptScheme" />
<dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2016-07-21</dcterms:created>
<rdfs:label xml:lang="en">Access right</rdfs:label>
<owl:imports rdf:resource="http://publications.europa.eu/ontology/euvoc" />
<rdfs:comment rdf:datatype="http://www.w3.org/2000/01/rdf-schema#Literal">Access right</rdfs:comment>
<owl:versionInfo>20240612-0</owl:versionInfo>
<skos:prefLabel xml:lang="en">Access right</skos:prefLabel>
<dcterms:title xml:lang="en">Access right</dcterms:title>
<ns5:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2016-07-21</ns5:startDate>
<dcterms:identifier>http://publications.europa.eu/resource/authority/access-right</dcterms:identifier>
<ns6:prefLabel rdf:resource="http://publications.europa.eu/resource/authority/access-right/d4e24400" />
<skos:hasTopConcept rdf:resource="http://publications.europa.eu/resource/authority/access-right/SENSITIVE" />
<skos:hasTopConcept rdf:resource="http://publications.europa.eu/resource/authority/access-right/NORMAL" />
<skos:hasTopConcept rdf:resource="http://publications.europa.eu/resource/authority/access-right/OP_DATPRO" />
<skos:hasTopConcept rdf:resource="http://publications.europa.eu/resource/authority/access-right/PUBLIC" />
<skos:hasTopConcept rdf:resource="http://publications.europa.eu/resource/authority/access-right/NON_PUBLIC" />
<skos:hasTopConcept rdf:resource="http://publications.europa.eu/resource/authority/access-right/RESTRICTED" />
<skos:hasTopConcept rdf:resource="http://publications.europa.eu/resource/authority/access-right/CONFIDENTIAL" />
<ns7:prefLabel xml:lang="en">Access right</ns7:prefLabel>
<ns7:table.id>access-right</ns7:table.id>
<ns7:table.version.number>20240612-0</ns7:table.version.number>
<owl:versionIRI rdf:resource="http://publications.europa.eu/resource/authority/access-right/20240612-0" />
</rdf:Description>
<rdf:Description rdf:about="http://publications.europa.eu/resource/authority/access-right/SENSITIVE">
<skos:inScheme rdf:resource="http://publications.europa.eu/resource/authority/access-right" />
<skos:topConceptOf rdf:resource="http://publications.europa.eu/resource/authority/access-right" />
</rdf:Description>
<rdf:Description rdf:about="http://publications.europa.eu/resource/authority/access-right/CONFIDENTIAL">
<skos:inScheme rdf:resource="http://publications.europa.eu/resource/authority/access-right" />
<skos:topConceptOf rdf:resource="http://publications.europa.eu/resource/authority/access-right" />
</rdf:Description>
<rdf:Description rdf:about="http://publications.europa.eu/resource/authority/access-right/NORMAL">
<skos:inScheme rdf:resource="http://publications.europa.eu/resource/authority/access-right" />
<skos:topConceptOf rdf:resource="http://publications.europa.eu/resource/authority/access-right" />
</rdf:Description>
</rdf:RDF>
Loading

0 comments on commit deee919

Please sign in to comment.