Aklakan opened a new issue, #1498:
URL: https://github.com/apache/jena/issues/1498

   ### Version
   
   4.7.0-SNAPSHOT
   
   ### What happened?
   
   Preface: As mentioned e.g. at 
https://issues.apache.org/jira/browse/JENA-2309 we are using a prefix cc dump 
(~2.9K prefixes)
   Also, with the [LinkedSparqlQuery](http://lsq.aksw.org/), we are parsing 
logs of SPARQL queries. Often servers have predefined prefixes which do not 
appear in the logs so query parsing needs a "fragmented" approach with query 
string being parsed against a preconfigured set of prefixes. Because we want to 
parse million of queries we do not want to spend time uselessly coping billions 
of prefixes (all thousands prefixes for every query) - hence, an approach based 
on e.g. PrefixMapping2 is just what we want. I am mentioning this in order to 
avoid @afs  from performing a quick fix that seals off the APIs I need by e.g. 
changing all methods to always do the copying :)
   
   Unfortunately, the following breaks because Prologue setPrefix calls 
removeNsPrefix:
   
   ```java
   PrefixMapping pm = new PrefixMapping2(PrefixMapping.Extended);
   Query query = new Query();
   query.setPrefixMapping(pm);
   QueryFactory.parse(query, "PREFIX rdf: <http://foo.bar/baz/> SELECT * {}", 
null, Syntax.syntaxARQ);
   ```
   
   ### Relevant output and stacktrace
   
   ```shell
   Caused by: java.lang.UnsupportedOperationException: PrefixMapping2: prefix 
'rdf' in the immutable map
        at 
org.apache.jena.sparql.util.PrefixMapping2.removeNsPrefix(PrefixMapping2.java:68)
        at org.apache.jena.sparql.core.Prologue.setPrefix(Prologue.java:122)
        at 
org.apache.jena.sparql.lang.QueryParserBase.setPrefix(QueryParserBase.java:117)
   ```
   
   
   ### Are you interested in making a pull request?
   
   Maybe


-- 
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]

Reply via email to