On 6/29/2012 8:08, Martynas Jusevicius wrote:
Holger,

I've built a QueryBuilder class as part of Graphity:
https://github.com/Graphity/graphity-browser/blob/master/src/main/java/org/graphity/util/QueryBuilder.java

I think it could be useful for many working with Jena and/or SPIN queries, but I lack expertise of SPIN API to make it robust.

I cannot tell why the removeAll would not work - it looks correct to me (except that you leave orphan bnodes hanging around). But I do not understand why you create another bnode with sp:expression and then wrap this into a list - why not use the Variable directly in line 234/5.

Overall the result should be triples like

[ a       sp:Select ;
                sp:orderBy ([ sp:varName "a"^^xsd:string
                          ]) ;

I still believe it may be easier to go with a new Jena Query object each time and do the manipulation there.

Cheers
Holger



Here's where I use it:
https://github.com/Graphity/graphity-browser/blob/master/src/main/java/org/graphity/browser/Resource.java

Could you help me out with this?

Martynas
graphity.org

On Wednesday, June 27, 2012 2:15:55 AM UTC+2, Holger Knublauch wrote:

    On 6/26/2012 20:26, Martynas wrote:
    Holger,

    I have a SPIN query for which I want to change the ORDER BY
    expression -- say change the ?var name, or change ASC to DESC for
    example.

    I have implemented the following method:

        public QueryBuilder orderBy(Variable var, boolean desc)
        {
    spinQuery.removeAll(SP.orderBy); // does not have effect??

    If not, then are you perhaps in a MultiUnion graph where the
    triple is not in the base graph? Also note that the removeAll
    won't delete any rdf:List triples, so they may be left as orphans.

    Hard to say without the full source code.

    In general, have you thought about using the Jena Query model API
    instead here, i.e. manipulate the Jena objects and then use
    ARQ2SPIN to replace the bnodes of the select?

    Holger

-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary Network (EVN), TopBraid Composer, TopBraid Live,
TopBraid Ensemble, SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en


-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary 
Network (EVN), TopBraid Composer, TopBraid Live,
TopBraid Ensemble, SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en

Reply via email to