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

anyURI values containing pipes are not parseable by the org.hl7.fhir.core library #155

Open
balhoff opened this issue Dec 12, 2024 · 1 comment
Labels
Turtle FHIR specification Turtle examples

Comments

@balhoff
Copy link
Contributor

balhoff commented Dec 12, 2024

Turtle filename
allergyintolerance.profile.ttl

That file and other profile files contain lines like this:

fhir:valueSet [
           fhir:v "http://hl7.org/fhir/ValueSet/all-languages|5.0.0"^^xsd:anyURI ;
           fhir:link <http://hl7.org/fhir/ValueSet/all-languages|5.0.0>
         ]

The value "http://hl7.org/fhir/ValueSet/all-languages|5.0.0"^^xsd:anyURI is not parseable by the https://github.com/hapifhir/org.hl7.fhir.core library, which is used to generate the Turtle examples and can also read them back in. Running the test generator gives this error when trying to roundtrip:

org.hl7.fhir.exceptions.FHIRFormatError: Illegal URI http://hl7.org/fhir/ValueSet/all-languages|5.0.0
	at org.hl7.fhir.utilities.turtle.Turtle$TTLURL.setUri(Turtle.java:727)
	at org.hl7.fhir.utilities.turtle.Turtle.parseComplex(Turtle.java:1232)
	at org.hl7.fhir.utilities.turtle.Turtle.parseComplex(Turtle.java:1228)
	at org.hl7.fhir.utilities.turtle.Turtle.parseComplex(Turtle.java:1228)
	at org.hl7.fhir.utilities.turtle.Turtle.parseComplex(Turtle.java:1228)
	at org.hl7.fhir.utilities.turtle.Turtle.parseComplex(Turtle.java:1228)
	at org.hl7.fhir.utilities.turtle.Turtle.parse(Turtle.java:1175)
	at org.hl7.fhir.utilities.turtle.Turtle.parse(Turtle.java:1106)
	at org.hl7.fhir.r5.test.TurtleGeneratorTests.parseGeneratedTurtle(TurtleGeneratorTests.java:120)
	at org.hl7.fhir.r5.test.TurtleGeneratorTests.testInstanceGeneration(TurtleGeneratorTests.java:102)
	at org.hl7.fhir.r5.test.TurtleGeneratorTests.testPublishedExamples(TurtleGeneratorTests.java:87)
	<trimmed>

The error comes from this method (https://github.com/hapifhir/org.hl7.fhir.core/blob/7740b5d857013a905e99d1d82a530d82b58cdf29/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/turtle/Turtle.java#L725) which uses this IRI regex: https://github.com/hapifhir/org.hl7.fhir.core/blob/7740b5d857013a905e99d1d82a530d82b58cdf29/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/turtle/Turtle.java#L54

@balhoff balhoff added the Turtle FHIR specification Turtle examples label Dec 12, 2024
@balhoff
Copy link
Contributor Author

balhoff commented Dec 12, 2024

Jena riot 5.0.0 gives these warnings:

riot --validate fhir-examples-out-orig/allergyintolerance.profile.ttl
13:49:21 WARN  riot            :: [line: 283, col: 66] Illegal character in IRI (codepoint 0x7C, '|'): <http://hl7.org/fhir/ValueSet/all-languages[|]...>
13:49:21 WARN  riot            :: [line: 283, col: 22] Bad IRI: <http://hl7.org/fhir/ValueSet/all-languages|5.0.0> Code: 4/UNWISE_CHARACTER in PATH: The character matches no grammar rules of URIs/IRIs.
13:49:21 WARN  riot            :: [line: 520, col: 80] Illegal character in IRI (codepoint 0x7C, '|'): <http://hl7.org/fhir/ValueSet/allergyintolerance-clinical[|]...>
13:49:21 WARN  riot            :: [line: 520, col: 22] Bad IRI: <http://hl7.org/fhir/ValueSet/allergyintolerance-clinical|5.0.0> Code: 4/UNWISE_CHARACTER in PATH: The character matches no grammar rules of URIs/IRIs.
13:49:21 WARN  riot            :: [line: 569, col: 84] Illegal character in IRI (codepoint 0x7C, '|'): <http://hl7.org/fhir/ValueSet/allergyintolerance-verification[|]...>
13:49:21 WARN  riot            :: [line: 569, col: 22] Bad IRI: <http://hl7.org/fhir/ValueSet/allergyintolerance-verification|5.0.0> Code: 4/UNWISE_CHARACTER in PATH: The character matches no grammar rules of URIs/IRIs.
13:49:21 WARN  riot            :: [line: 674, col: 81] Illegal character in IRI (codepoint 0x7C, '|'): <http://hl7.org/fhir/ValueSet/allergy-intolerance-category[|]...>
13:49:21 WARN  riot            :: [line: 674, col: 22] Bad IRI: <http://hl7.org/fhir/ValueSet/allergy-intolerance-category|5.0.0> Code: 4/UNWISE_CHARACTER in PATH: The character matches no grammar rules of URIs/IRIs.
13:49:21 WARN  riot            :: [line: 726, col: 84] Illegal character in IRI (codepoint 0x7C, '|'): <http://hl7.org/fhir/ValueSet/allergy-intolerance-criticality[|]...>
13:49:21 WARN  riot            :: [line: 726, col: 22] Bad IRI: <http://hl7.org/fhir/ValueSet/allergy-intolerance-criticality|5.0.0> Code: 4/UNWISE_CHARACTER in PATH: The character matches no grammar rules of URIs/IRIs.
13:49:21 WARN  riot            :: [line: 1624, col: 76] Illegal character in IRI (codepoint 0x7C, '|'): <http://hl7.org/fhir/ValueSet/reaction-event-severity[|]...>
13:49:21 WARN  riot            :: [line: 1624, col: 22] Bad IRI: <http://hl7.org/fhir/ValueSet/reaction-event-severity|5.0.0> Code: 4/UNWISE_CHARACTER in PATH: The character matches no grammar rules of URIs/IRIs.
13:49:21 WARN  riot            :: [line: 1779, col: 80] Illegal character in IRI (codepoint 0x7C, '|'): <http://hl7.org/fhir/ValueSet/allergyintolerance-clinical[|]...>
13:49:21 WARN  riot            :: [line: 1779, col: 22] Bad IRI: <http://hl7.org/fhir/ValueSet/allergyintolerance-clinical|5.0.0> Code: 4/UNWISE_CHARACTER in PATH: The character matches no grammar rules of URIs/IRIs.
13:49:21 WARN  riot            :: [line: 1813, col: 84] Illegal character in IRI (codepoint 0x7C, '|'): <http://hl7.org/fhir/ValueSet/allergyintolerance-verification[|]...>
13:49:21 WARN  riot            :: [line: 1813, col: 22] Bad IRI: <http://hl7.org/fhir/ValueSet/allergyintolerance-verification|5.0.0> Code: 4/UNWISE_CHARACTER in PATH: The character matches no grammar rules of URIs/IRIs.
13:49:21 WARN  riot            :: [line: 1888, col: 81] Illegal character in IRI (codepoint 0x7C, '|'): <http://hl7.org/fhir/ValueSet/allergy-intolerance-category[|]...>
13:49:21 WARN  riot            :: [line: 1888, col: 22] Bad IRI: <http://hl7.org/fhir/ValueSet/allergy-intolerance-category|5.0.0> Code: 4/UNWISE_CHARACTER in PATH: The character matches no grammar rules of URIs/IRIs.
13:49:21 WARN  riot            :: [line: 1925, col: 84] Illegal character in IRI (codepoint 0x7C, '|'): <http://hl7.org/fhir/ValueSet/allergy-intolerance-criticality[|]...>
13:49:21 WARN  riot            :: [line: 1925, col: 22] Bad IRI: <http://hl7.org/fhir/ValueSet/allergy-intolerance-criticality|5.0.0> Code: 4/UNWISE_CHARACTER in PATH: The character matches no grammar rules of URIs/IRIs.
13:49:21 WARN  riot            :: [line: 2357, col: 76] Illegal character in IRI (codepoint 0x7C, '|'): <http://hl7.org/fhir/ValueSet/reaction-event-severity[|]...>
13:49:21 WARN  riot            :: [line: 2357, col: 22] Bad IRI: <http://hl7.org/fhir/ValueSet/reaction-event-severity|5.0.0> Code: 4/UNWISE_CHARACTER in PATH: The character matches no grammar rules of URIs/IRIs.

However, it is not complaining about the xsd:anyURI literals, but about the fhir:link IRIs that are also output, e.g. the second value here:

fhir:valueSet [
  fhir:v "http://hl7.org/fhir/ValueSet/all-languages|5.0.0"^^xsd:anyURI ;
  fhir:link <http://hl7.org/fhir/ValueSet/all-languages|5.0.0>
] ;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Turtle FHIR specification Turtle examples
Projects
None yet
Development

No branches or pull requests

1 participant