default (empty) prefix issue

43 views
Skip to first unread message

Conrad Leonard

unread,
Jan 27, 2015, 9:39:38 PM1/27/15
to empir...@googlegroups.com
Hi;
I have an issue with a bean that is annotated with the following @Namespaces:


aManager.createQuery("where {?result a :SequencingRun; :wasAssociatedWith [a foaf:Person; foaf:accountName 'JohnPe']}")

I get the exception:

java.lang.IllegalArgumentException: Invalid query: PREFIX skos2: <http://www.w3.org/2008/05/skos#>

select ?result where {?result a :sequencingrun; :wasassociatedwith [a foaf:person; foaf:accountname 'johnpe']}
at com.clarkparsia.empire.impl.sparql.SPARQLDialect.validateQueryFormat(SPARQLDialect.java:111)
at com.clarkparsia.empire.impl.RdfQuery.<init>(RdfQuery.java:172)
at com.clarkparsia.empire.impl.RdfQueryFactory.newQuery(RdfQueryFactory.java:104)
at com.clarkparsia.empire.impl.RdfQueryFactory.createQuery(RdfQueryFactory.java:136)
at com.clarkparsia.empire.impl.EntityManagerImpl.createQuery(EntityManagerImpl.java:254)
at EmpireTest.main(wrapper.groovy:31)
Caused by: org.openrdf.query.MalformedQueryException: org.openrdf.query.parser.sparql.ast.VisitorException: QName ':sequencingrun' uses an undefined prefix


From the trace it looks like the constructed query is missing the line I would expect declaring the empty qname, i.e.

PREFIX : <http://purl.org/net/grafli#>

so it is not being registered when the beans are inspected, or something? I tried moving that prefix/namespace pair to different location in the @Namespaces initializer but to no avail.  Am I doing something unexpected?

Thanks for Empire, b.t.w; it's a great library.

Mike Grove

unread,
Jan 29, 2015, 8:52:08 AM1/29/15
to empir...@googlegroups.com
No, that ought to work.  I guess it's eating it because it's the default namespace.  If you give it a specific prefix, does it work?
 

Thanks for Empire, b.t.w; it's a great library.

Thanks!

Mike
 

--
You received this message because you are subscribed to the Google Groups "Empire" group.
To unsubscribe from this group and stop receiving emails from it, send an email to empire-rdf+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Conrad Leonard

unread,
Jan 30, 2015, 9:02:36 AM1/30/15
to empir...@googlegroups.com
Hi Mike;

Yes, if I give the namespace anything other than the empty prefix name, the query is constructed correctly with the appropriate @PREFIX statement, and returns results.

Mike Grove

unread,
Jan 30, 2015, 9:20:53 AM1/30/15
to empir...@googlegroups.com
Ah, ok.  Thanks for pointing this out.

I've created an issue for this [1].

Cheers,

Mike


Conrad Leonard

unread,
Jan 30, 2015, 9:27:50 PM1/30/15
to empir...@googlegroups.com
Inspecting the contents of PrefixManager.GLOBAL immediately before constructing the query, the default namespace (empty prefix) is certainly present; I think the immediate cause of its absence in the constructed query is the block that explicitly excludes the empty prefix in
com.clarkparsia.empire.impl.sparql.SPARQLDialect.insertNamespaces():
        if (aPrefix.trim().equals("")) {
               
continue;
       
}
But I don't know why that is there so I'm not going to mess with it :)


in com.clarkparsia.empire.impl.sparql.SPARQLDialect.insertNamespaces()
Reply all
Reply to author
Forward
0 new messages