Comments (3)
Historically Resource.getLocalName()
uses RDF/XML specific local name rules, which early versions of other syntaxes also used to follow. As RDF/XML has become less and less prevalent other formats relaxed those rules to allow for a wider range of characters in the local name portion of their prefixed name syntaxes but given Jena's long history early parts of the API like Model
and Resource
have not really changed in that regard.
There are other ways to present URIs e.g. PrefixMapping.shortForm()
or PrefixMap.abbreviate()
that should be used if you want more generic URI shortening and these will use more modern rules about what is allowed in the local name portion of URIs
Or you could look at the NodeFormatter
API if you plan to generate a lot of shortened URIs in your outputs
from jena.
See SplitIRI
for split algorithms -- there are splits for RDF/XML, Turtle and a basic /
,#
split.
The javadoc for Resource.getLocalName
refers to SplitIRI
.
Changing Resource.getLocalName
would impact existing applications and Jena has tended to be conservative in that regard. It encourages people to upgrade their use of Jena for general good security health.
New Resource.splitLocalName
/splitNamespace
operations could be done that call SplitIRI
.
Contributions welcome!
from jena.
Thanks for the quick replies.
That'll teach me for looking at decompiled code in the debugger rather than the actual sources!
As Andy says the actual source does mention this:
/** Returns the localname of this resource within its namespace if it is a URI else null.
* <p>
* Note: XML requires QNames to start with a letter, not a digit,
* and this method reflects that restriction.
* <p>
* See functions in {@code SplitIRI} for other split algorithms.
* @return The localname of this property within its namespace.
*/
I'lll investigate using either PrefixMapping or SplitIRI.
When I have a free moment I'll consider creating a PR for those new methods, depending on my success!
from jena.
Related Issues (20)
- Remove commons-cli dependency from jena-core
- Update various @Deprecation to include "forRemoval"
- The CORS filter has references to Jetty code.
- Make jena-fuseki-core independent of Eclipse Jetty
- Lookup script name "javascript"
- Fuseki WAR file fails to start HOT 1
- vite-plugin-istanbul 6.0.1+ not compatible with Fuseki UI build. HOT 1
- moving/renaming `:jena-ontapi` vocabularies.
- [Fuseki] Reloadable configuration files HOT 5
- `mvn clean install` fails HOT 8
- RDFXML: can't parse rdf:XMLLiteral HOT 17
- Spread out the days dependabot PRs are generated
- OntModel enhancements HOT 3
- Fuseki query endpoint stopped working on jena-fuseki-main upgrade HOT 6
- jena-benchmark-jmh module defunct HOT 10
- Remove <dependencyPath> from POMs where it is unnecessary
- Clean warnings in jena-ontapi
- trouble with Fuseki UI and one AJAX request (/$/stats) HOT 9
- Fuseki HttpAction: Check and improve the transaction lifecycle for HTTP action execution.
- Fuseki - setting the context path to a relative path causes 404s.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jena.