afs commented on issue #3180:
URL: https://github.com/apache/jena/issues/3180#issuecomment-2862534844
Hi @AndreasMeier12
When a URI has `%7C` in it, it really is those three characters, it is not
an escape mechanism, unlike `\u0041` or, in a string, `\n`. That step is
something the application must do.
`Resource.getLocalName()` returns the safest form - RDF/XML is the most
restrictive. `%` is not legal in an XML qname.
You get `mg` because (1) the split can not go across %7C (2) an XML qname
localname starts with a letter.
Jena has a utility class `SplitIRI` to split according to different policies.
```java
String x =
"resource:LOL-123.345.678-example-Quantity-ASDF%7C323-20-mg";
System.out.println("LN: "+SplitIRI.localname(x));
System.out.println("TTL: "+SplitIRI.localnameTTL(x));
System.out.println("XML: "+SplitIRI.localnameXML(x));
```
gives
```
LN: LOL-123.345.678-example-Quantity-ASDF%7C323-20-mg
TTL: LOL\-123.345.678\-example\-Quantity\-ASDF\%7C323\-20\-mg
XML: mg
```
The first is for display purposes.
The other two are for specific syntax use.
The grammar for IRIs:
https://www.w3.org/TR/rdf12-concepts/#iri-abnf
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]