Comments (14)
@Aklakan: Thank you for fixing that.
from jena.
Simpler: no ?y
reuse for ?z
:
SELECT ?z { BIND('x' AS ?y) BIND('z' AS ?z) }
from jena.
OpAsQuery
is not a perfect reversal of the process of compiling the query to algebra. It aims to produce equivalent queries - same output. It has to spot patterns because SELECT (expr as ?var)
and SELECT * { ... BIND (expr as ?var)}
are the same algebra.
When translating algebra to syntax, OpAsQuery
is spotting this pattern. If you want all the BIND
, use SELECT *
.
SELECT (?x AS ?y) (?y AS ?z) {}
has two variables, whereas SELECT ?z {}
has one. It's a different query.
from jena.
The problem is that the projection just naively filters the collected assignments without taking dependent expressions into account:
//OpAsQuery.java
level.opProject.getVars().forEach(v -> {
if ( assignments.containsKey(v) ) {
query.addResultVar(v, assignments.get(v)) ;
} else
query.getProjectVars().add(v) ;
}) ;
from jena.
It aims to produce equivalent queries - same output.
Yes, but in the first example with the transitive assignment of the constant 'x'
it fails because the output differs.
In the case where there is a variable based off of a unit table it would be according to the 'same output' contract - though losing those expressions is not really what I expected.
from jena.
IMO the expected result.
I was speaking about this proposal. It is a different query.
This code has built-up over time with lots of opinion. Outputting a query that is not the input will probably cause users problems, generate a support load and we end up going in circles.
from jena.
Oh my, I messed up the expected results because I forgot the projection of ?z - sorry for the confusion.
Of course the output query should be the same as the input one.
I updated the expected results with the projection now.
from jena.
Why not add a detection criterion so that BIND is reversed to a project expression only if the project is safe? This would work down the (extend)
stack with a "while safe" test. Replace that stream with a for-loop, push back remaining level.opExtends
into the pattern.
These short examples hide the fact that in real queries, the BIND are at the end of a long pattern. Only BIND at the end are considered. Adding an extra sub-query - even if the same query - is unexpected by users.
from jena.
Why not add a detection criterion so that BIND is reversed to a project expression only if the project is safe?
Yes, that makes sense.
Adding an extra sub-query - even if the same query - is unexpected by users.
Certainly; I was incorrectly assuming that OpAsQuery due to the 'not perfect reversal'-nature always uses projections but I see it actually does support reversing into BIND. So the detection criterion is what is needed.
from jena.
It'll be easiest in the calculation of level.opExtend
which look like it is processExtend
(which is used twice).
from jena.
Are you working on it already or should I look into it? It's not clear whether your last message was a note to yourself or a hint to me :)
from jena.
I'm not working on it.
from jena.
Fixed by #1370.
from jena.
Also reported as JENA-2335.
from jena.
Related Issues (20)
- How to Add Custom Predicate Support to Apache Jena Fuseki? HOT 1
- LPBRuleEngine's usage of LinkedList for activeInterpreters is a hot spot HOT 3
- org.apache.jena.shared.PrefixMapping$IllegalPrefixException: 😀 HOT 6
- Use PrefixMappingBase for BufferingPrefixMapping
- Update `PrefixMappingImpl` prefix checking rule to align with Turtle and XML 1.1
- a Fuseki Jetty server behind an Apache HTTPd proxy-pass HOT 17
- Remove Fuseki system database
- QueryExec: abort before exec is ignored.
- RDFParserBuilder.toDatasetGraph() is much slower than calling RDFParserBuilder.parse(DatasetGraph) HOT 3
- RDF Patch Binary Reader silently accepts some invalid patch files HOT 4
- Support for multi-variable join keys
- improve arq command line documentation
- Incorrect JoinClassifier results with unbound values.
- Fix broken Fuseki when using a context path in the URL
- Update the lexical space and value space of rdf:XMLLiteral to comply with RDF 1.1 HOT 2
- 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"
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.