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

Subject id from reference (rr:subjectMap/rml:reference) #153

Closed
mchlrch opened this issue Apr 11, 2024 · 1 comment
Closed

Subject id from reference (rr:subjectMap/rml:reference) #153

mchlrch opened this issue Apr 11, 2024 · 1 comment

Comments

@mchlrch
Copy link
Member

mchlrch commented Apr 11, 2024

Current version (1.5.0) only supports creating the subject id based on a template.

Because processors always perform percent-encoding when IRIs are generated from string templates, this becomes cumbersome in cases where the subject id already exists pre-fabricated in the source.

Quoting from the spec https://www.w3.org/TR/r2rml/#from-template :

Note: R2RML always performs percent-encoding when IRIs are generated from string templates.
If IRIs need to be generated without percent-encoding, then rr:column should be used instead of rr:template,
with an [R2RML view](https://www.w3.org/TR/r2rml/#dfn-r2rml-view) that performs the string concatenation.

... the equivalent to R2RML views in RML are path-expressions (eg. XPath or JSONPath).

Sample XML input:

<?xml version="1.0" encoding="utf-8"?>
<akomaNtoso xmlns="http://docs.oasis-open.org/legaldocml/ns/akn/3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://docs.oasis-open.org/legaldocml/ns/akn/3.0 https://docs.oasis-open.org/legaldocml/akn-core/v1.0/os/part2-specs/schemas/akomantoso30.xsd">
  <act name="Grunderlass" contains="originalVersion"> 
    <meta>
      <identification source="#source">
        <FRBRWork>
          <FRBRthis value="/akn/CH-ZH/act/2024-02-29/2024-17/main"/> 
          <FRBRuri value="/akn/CH-ZH/act/2024-02-29/2024-17"/>
          <FRBRdate date="2024-02-29" name="Beschlussdatum"/> 
          <FRBRauthor href="#Kantonsrat" as="#author"/> 
          <FRBRcountry value="#CH-ZH" showAs="CH-ZH"/>
          <FRBRsubtype value="#Gesetz" showAs="Gesetz"/> 
          <FRBRnumber value="2024-17"/> 
        </FRBRWork>
      </identification>
    </meta>		
  </act>	
</akomaNtoso>

Feature request:

# sources.xrm
logical-source Example3Xml {
	type xml
	source "stdin"
	xml-namespace-extension akomaNtoso
	iterator "/akn:akomaNtoso/akn:act/akn:meta/akn:identification/akn:FRBRWork"

	referenceables
		legalResourceIri "concat('http://zrh.ch', akn:FRBRuri/@value)"
-		jurisdiction "tokenize(akn:FRBRuri/@value, '/')[3]"
-		doctype "tokenize(akn:FRBRuri/@value, '/')[4]"
-		docdate "tokenize(akn:FRBRuri/@value, '/')[5]"
-		docnumber "tokenize(akn:FRBRuri/@value, '/')[6]"
}

xml-namespace-extension akomaNtoso {
	prefix "akn" "http://docs.oasis-open.org/legaldocml/ns/akn/3.0"
}


# mapping3.xrm
 output carml

- template workIri "http://zrh.ch/akn/{0}/{1}/{2}/{3}"
 
 map example3 from Example3Xml {
-       subject template workIri with jurisdiction doctype docdate docnumber;
+       subject from legalResourceIri as IRI;
 
        types
                eli.LegalResource


# src-gen/mapping3.carml.ttl        
        rr:subjectMap [
-               rr:template "http://zrh.ch/akn/{tokenize(akn:FRBRuri/@value, '/')[3]}/{tokenize(akn:FRBRuri/@value, '/')[4]}/{tokenize(akn:FRBRuri/@value, '/')[5]}/{tokenize(akn:FRBRuri/@value, '/')[6]}";
+               rml:reference "concat('http://zrh.ch', akn:FRBRuri/@value)";
                rr:class eli:LegalResource
        ];
mchlrch added a commit to mchlrch/xrm-xml-workflow that referenced this issue Apr 17, 2024
mchlrch added a commit to mchlrch/xrm-xml-workflow that referenced this issue Apr 17, 2024
mchlrch added a commit that referenced this issue Apr 17, 2024
- subject from __
- subject constant __
- graphs from __
mchlrch added a commit to zazuko/expressive-rdf-mapper that referenced this issue Apr 18, 2024
@mchlrch
Copy link
Member Author

mchlrch commented Apr 18, 2024

Resolved in xrm version 1.6.0

 subject from legalResourceIri;
 subject from legalResourceIri as IRI;

Both of the above are fine. Explicitly stating the TermType IRI is possible but not necessary.

@mchlrch mchlrch closed this as completed Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant