On 19/11/11 06:10, ajaz shaik wrote:
Hi, I dont know whats going wrong I am still having problems in
converting/manipulating :( ..
It all started with just aliasing problem and it still exists in my brain.
well here is what I found.... hope any one can help me....
Problem 1 :
Test Original Query 1 --------------------------------------------------
...
Test Original Query 2 --------------------------------------------------
PREFIX movie:<http://data.linkedmdb.org/resource/movie/>
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX fn:<java:facet.>
SELECT ?fpredicate (count(distinct ?instance) AS ?ficount) (count(distinct
?object) AS ?focount) (fn:weights3(count(distinct ?instance), count(distinct
?object), 85620) AS ?coverage)
WHERE
{ ?instance rdf:type movie:film .
?instance ?fpredicate ?object
FILTER regex(str(?fpredicate), "http://data.linkedmdb.org/resource/", "i")
}
GROUP BY ?fpredicate
Test Original Query 2 Algebra ---------------------------------------------
(project (?fpredicate ?ficount ?focount ?coverage)
(extend ((?ficount ?.0) (?focount ?.1) (?coverage (<java:facet.weights3>
?.0 ?.1 85620)))
(group (?fpredicate) ((?.0 (count distinct ?instance)) (?.1 (count
distinct ?object)))
(filter (regex (str ?fpredicate) "http://data.linkedmdb.org/resource/"
"i")
(bgp
(triple ?instance<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<http://data.linkedmdb.org/resource/movie/film>)
(triple ?instance ?fpredicate ?object)
)))))
Test OpAsQuery Query 2 --------------------------------------------------
Exception in thread "main" com.hp.hpl.jena.sparql.ARQNotImplemented: Expected
simple assignment for group
at com.hp.hpl.jena.sparql.algebra.OpAsQuery$Converter.visit(OpAsQuery.java:385)
at com.hp.hpl.jena.sparql.algebra.op.OpExtend.visit(OpExtend.java:107)
at com.hp.hpl.jena.sparql.algebra.OpAsQuery$Converter.visit(OpAsQuery.java:417)
at com.hp.hpl.jena.sparql.algebra.op.OpProject.visit(OpProject.java:34)
at com.hp.hpl.jena.sparql.algebra.OpAsQuery.asQuery(OpAsQuery.java:45)
at test.Temp.main(Temp.java:145)
Can any body help me with this exception ...
Could you please reduce this to a simple query that goes wrong. It's
very hard to see what's happening with all the query features. Extract
the difference between query 1 and query 2, make it as simple as possible.
Problem 3:
Aggregator agg1 = new AggCountVarDistinct(ev1);
VarAlloc va = new VarAlloc(ARQConstants.allocVarMarker);
Var temp1 = va.allocVar();
Expr extemp1 = new ExprVar(temp1);
ExprAggregator eagg1 = new ExprAggregator(temp1, agg1);
aggrelist.add(eagg1);
When there are count expressions in my projection, Is It Mandatory to have
Temporary
Variables
to define implicit grouping of variables when I am building Algebra of query?
Probably not but it might make it impossible to run OpAsQuery.
You can build queries in the algebra that have no exact SPARQL syntax form.
Problem 4:
Dataset dataset = TDBFactory.createDataset(directory) ;
PrefixMapping premap =
dataset.asDatasetGraph().getDefaultGraph().getPrefixMapping();
It does not return any prefix entries ,...... I asked this before but
when I tried The result is 0;
Maybe there are no prefixes in the data.
Complete, minimal example please.
Pardon me I could not follow properly .. :/
Question General :
Can I make TDB use customize StageGenerator than its native
StageGeneratorDirectTDB ?
"StageGenerator"s are used by ARQ.
You can register your own - although TDB installs it's own query engine
factory and executor (OpExecutorTDB). StageGeneratorDirectTDB is only
used if a TDB-backed model is placed in a generate dataset, not one
obtained from TDBFactory.
I debugged a bit and found out that its not using customized one.
Thanks,
Regards,
aj