[Neo] VerboseQuadStore and spaql
Lyudmila Balakireva
ludab at lanl.gov
Fri Jan 30 18:39:07 CET 2009
thank you for looking , my query snippet:
try
{
sail.initialize();
Repository repo = new SailRepository( sail );
RepositoryConnection rc = repo.getConnection();
ValueFactory f = repo.getValueFactory();
//SailConnection sc = sail.getConnection();
String queryStr = "PREFIX
ore:<http://www.openarchives.org/ore/terms/>\n " +
"PREFIX
rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n " +
"PREFIX
orex:<http://library.lanl.gov/orex/terms/> \n" +
"PREFIX dc:<http://purl.org/dc/elements/1.1/>\n "+
" SELECT ?photo WHERE { " +
"?s ?p \""+ tag +"\" ."+
" ?photo ?x ?s . " +
" ?photo ?y \"photo\" . " +
// " ?photo
ore:aggregates ?i ." + //this is does not work
" } ; // LIMIT " +limit + " OFFSET " + offset ;
System.out.println("queryStr:" + queryStr);
// query = parser.parseQuery(
queryStr, baseURI ); // tryed as in test example same result
TupleQuery tupleQuery =
rc.prepareTupleQuery(QueryLanguage.SPARQL,queryStr);
TupleQueryResult result_s = tupleQuery.evaluate();
// results = sc.evaluate( query.getTupleExpr(),
query.getDataset(),bindings, false );
while ( result_s.hasNext() )
{
BindingSet set = result_s.next();
Value photo_ = ( Value ) set.getValue( "photo" );
String P =photo_.toString();
Photo photoobj = new Photo();
photoobj.setPhotoUrl(P);
setURI(P,photoobj,rc,f);
photoes.add(photoobj);
}
result_s.close();
//sc.close();
rc.commit();
rc.close();
public void setURI (String photouri, Photo photoobj,RepositoryConnection
rc,ValueFactory f) throws RepositoryException {
RepositoryResult<Statement> resultt
=
rc.getStatements(f.createURI(photouri),f.createURI("ore:aggregates"),
null, true); //same stuff working
while (resultt.hasNext()) {
Statement st = resultt.next();
Resource s = st.getSubject();
Resource p = st.getPredicate();
Value o = st.getObject();
if (o.toString().contains("_t")) {
photoobj.setThumb(o.stringValue());
System.out.println(s.toString()+","+
p.toString()+","+o.toString());
}
if (o.toString().contains("_m")) {
photoobj.setFull(o.stringValue());
System.out.println(s.toString()+","+
p.toString()+","+o.toString());
}
// System.out.println(s.toString()+","+
p.toString()+","+o.toString());
}
resultt.close();
}
At 09:31 AM 1/30/2009, you wrote:
>Hi Lyudmila, as Emil pointed out our sparql
>support doesn't yet support all possible cases,
>but according to my knowledge a ?S P ?O
>construct is supported and tests in the sparql
>engine verifies that. It can however depend on
>what other triple constraints your query has.
>The neo sparql engine needs (as of now, at
>least) some kind of reasonable starting point;
>somewhere to start the traversing from and it
>may be that decision which is causing your
>problems. If you could send your sparql query I
>could make a much better conclusion as to the
>source of the problem. Best, Mattias 2009/1/30
>Emil Eifrem <emil at neotechnology.com>: > On Thu,
>Jan 29, 2009 at 9:54 PM, Lyudmila Balakireva
><ludab at lanl.gov> wrote: >> Hello, >> I was
>testing sail rdf component and I made test
>store based >> on VerboseQuadStore . >> I
>have problem with predicate in sparql . If
>I specify predicate >> like ?x dc:type
>?z the query does not returning anything. (I
>do >> have dc namespace prefix). It is work if
>I do (?x?y?z) or (?x ?y >> "snow") or url in
>subject or object position. >> It is work with
>specific predicate if I do getStatements(). >>
>Any clue would be great. > > Hi Luda, > > Our
>Sparql support is so-so: it's optimized *enough*
>for the > particular commercial use cases that
>our Sparql-swinging customers > have required so
>far. And the ?s predicate ?o pattern may very
>well be > one that hasn't been required (yet).
>But Mattias would know more about > this than
>me. Mattias? > > It's weird though that it works
>in getStatements(). How have you > configured
>and assembled your components? Also, do you
>use > Sparql-over-SAIL or the Neo4j Sparql
>engine? > > Cheers, > > -- > Emil Eifrém, CEO
>[emil at neotechnology.com] > Neo Technology,
>www.neotechnology.com > Cell: +46 733 462 271 |
>US: 206 403 8808 >
>_______________________________________________ >
> Neo mailing list > User at lists.neo4j.org >
>https://lists.neo4j.org/mailman/listinfo/user >
>-- Mattias Persson, [mattias at neotechnology.com]
>Neo Technology, www.neotechnology.com
>_______________________________________________
>Neo mailing list User at lists.neo4j.org
>https://lists.neo4j.org/mailman/listinfo/user
More information about the User
mailing list