You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Chris Dollin <ch...@epimorphics.com> on 2017/11/21 12:05:57 UTC

problem with VALUES querybuilder

Dear All

I'm missing something with use of the query builder to create VALUES
clauses.
The code

    @Test public void buildValues() {
        SelectBuilder sb = new SelectBuilder();
        sb.addValueVar("item",  "spoo", "flarn");
        System.err.println(sb.buildString());
    }

generates

  SELECT  *
  WHERE
    {  }
  VALUES ?item { "spoo" "flarn" }

which I believe to be syntactically incorrect but in any case I want the
generated VALUES clause to be inside the WHERE {} ie

  SELECT * WHERE {VALUES ?item {"spoo" "flarn"}}}

What should I be doing and how should I have known that?

Chris

PS please to excuse the misuse of @Test here ... exploratory use only.

-- 
"What I don't understand is this ..."   Trevor Chaplin, /The Beiderbeck
Affair/

Epimorphics Ltd, http://www.epimorphics.com
Registered address: Court Lodge, 105 High Street, Portishead, Bristol BS20
6PT
Epimorphics Ltd. is a limited company registered in England (number 7016688)

Re: problem with VALUES querybuilder

Posted by Claude Warren <cl...@xenei.com>.
I have added options to add values inside the graph patterns but have not
had time to write the test cases yet.

I expect to have the additional features added and tested tomorrow night.

I am also add a series of addGraph( graph, [ some sort of triple here ] )
methods to create simple graphs queries where a single triple is all that
is requested.  I found I wanted this while I was working on some other code
today. ;)

Claude

On Tue, Nov 21, 2017 at 2:52 PM, Andy Seaborne <an...@apache.org> wrote:

> Yes, there is a difference.
>
> It (the join) happens just before project and after any GROUP BY.
>
> See the algebra at http://www.sparql.org/query-validator.html
>
>     Andy
>
>
> On 21/11/17 14:46, Claude Warren wrote:
>
>> based on https://www.w3.org/TR/sparql11-query/#inline-data-examples
>>
>> there is no difference between values  blocks inside or outside a graph
>> pattern.
>>
>> On Tue, Nov 21, 2017 at 2:35 PM, Claude Warren <cl...@xenei.com> wrote:
>>
>> Currently the values are always placed in the top level of the query.
>>>
>>> Q: does it make a difference to exeuction?  (I suspect it does but I want
>>> to make sure before I proceed to add a method to place it inside the
>>> graph
>>> pattern.
>>>
>>> Claude
>>>
>>> On Tue, Nov 21, 2017 at 1:20 PM, Rob Vesse <rv...@dotnetrdf.org> wrote:
>>>
>>> The output you get is syntactically valid - VALUES is allowed at the top
>>>> level of the query as well as within graph patterns
>>>>
>>>>   It is not clear to me if the latter this Is actually possible with the
>>>> current query builder, Claude can probably give you a more detailed
>>>> answer
>>>>
>>>> Rob
>>>>
>>>>
>>>> On 21/11/2017, 12:05, "Chris Dollin" <ch...@epimorphics.com>
>>>> wrote:
>>>>
>>>>      Dear All
>>>>
>>>>      I'm missing something with use of the query builder to create
>>>> VALUES
>>>>      clauses.
>>>>      The code
>>>>
>>>>          @Test public void buildValues() {
>>>>              SelectBuilder sb = new SelectBuilder();
>>>>              sb.addValueVar("item",  "spoo", "flarn");
>>>>              System.err.println(sb.buildString());
>>>>          }
>>>>
>>>>      generates
>>>>
>>>>        SELECT  *
>>>>        WHERE
>>>>          {  }
>>>>        VALUES ?item { "spoo" "flarn" }
>>>>
>>>>      which I believe to be syntactically incorrect but in any case I
>>>> want
>>>> the
>>>>      generated VALUES clause to be inside the WHERE {} ie
>>>>
>>>>        SELECT * WHERE {VALUES ?item {"spoo" "flarn"}}}
>>>>
>>>>      What should I be doing and how should I have known that?
>>>>
>>>>      Chris
>>>>
>>>>      PS please to excuse the misuse of @Test here ... exploratory use
>>>> only.
>>>>
>>>>      --
>>>>      "What I don't understand is this ..."   Trevor Chaplin, /The
>>>> Beiderbeck
>>>>      Affair/
>>>>
>>>>      Epimorphics Ltd, http://www.epimorphics.com
>>>>      Registered address: Court Lodge, 105 High Street, Portishead,
>>>> Bristol
>>>> BS20
>>>>      6PT
>>>>      Epimorphics Ltd. is a limited company registered in England (number
>>>> 7016688)
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>> --
>>> I like: Like Like - The likeliest place on the web
>>> <http://like-like.xenei.com>
>>> LinkedIn: http://www.linkedin.com/in/claudewarren
>>>
>>>
>>
>>
>>


-- 
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren

Re: problem with VALUES querybuilder

Posted by Martynas Jusevičius <ma...@atomgraph.com>.
You should start a new thread instead of adding to an unrelated one.

On Thu, Nov 23, 2017 at 2:20 AM, Neda Alipanah <ne...@gmail.com>
wrote:

> Hello there,
> I have a quick question. I am loading a 25 Meg Owl file to the memory
> using the following commands. My code is working fine through the
> IDE(IntelliJ), but when I create a runnable Jar, it does not find the file.
> I already put the owl file directory in the class path but I get Exception
> In Initializer error.
>
> // Create an empty model
> model = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM);
>
> // Use the FileManager to find the input file
> InputStream in = FileManager.get().open(inPath);
>
> [image: Inline image 1]
>
> Really appreciate if you can provide a solution for the problem.
>
>
> Best Regards,
>
> Neda
>
>
> On Tue, Nov 21, 2017 at 6:52 AM, Andy Seaborne <an...@apache.org> wrote:
>
>> Yes, there is a difference.
>>
>> It (the join) happens just before project and after any GROUP BY.
>>
>> See the algebra at http://www.sparql.org/query-validator.html
>>
>>     Andy
>>
>>
>> On 21/11/17 14:46, Claude Warren wrote:
>>
>>> based on https://www.w3.org/TR/sparql11-query/#inline-data-examples
>>>
>>> there is no difference between values  blocks inside or outside a graph
>>> pattern.
>>>
>>> On Tue, Nov 21, 2017 at 2:35 PM, Claude Warren <cl...@xenei.com> wrote:
>>>
>>> Currently the values are always placed in the top level of the query.
>>>>
>>>> Q: does it make a difference to exeuction?  (I suspect it does but I
>>>> want
>>>> to make sure before I proceed to add a method to place it inside the
>>>> graph
>>>> pattern.
>>>>
>>>> Claude
>>>>
>>>> On Tue, Nov 21, 2017 at 1:20 PM, Rob Vesse <rv...@dotnetrdf.org>
>>>> wrote:
>>>>
>>>> The output you get is syntactically valid - VALUES is allowed at the top
>>>>> level of the query as well as within graph patterns
>>>>>
>>>>>   It is not clear to me if the latter this Is actually possible with
>>>>> the
>>>>> current query builder, Claude can probably give you a more detailed
>>>>> answer
>>>>>
>>>>> Rob
>>>>>
>>>>>
>>>>> On 21/11/2017, 12:05, "Chris Dollin" <ch...@epimorphics.com>
>>>>> wrote:
>>>>>
>>>>>      Dear All
>>>>>
>>>>>      I'm missing something with use of the query builder to create
>>>>> VALUES
>>>>>      clauses.
>>>>>      The code
>>>>>
>>>>>          @Test public void buildValues() {
>>>>>              SelectBuilder sb = new SelectBuilder();
>>>>>              sb.addValueVar("item",  "spoo", "flarn");
>>>>>              System.err.println(sb.buildString());
>>>>>          }
>>>>>
>>>>>      generates
>>>>>
>>>>>        SELECT  *
>>>>>        WHERE
>>>>>          {  }
>>>>>        VALUES ?item { "spoo" "flarn" }
>>>>>
>>>>>      which I believe to be syntactically incorrect but in any case I
>>>>> want
>>>>> the
>>>>>      generated VALUES clause to be inside the WHERE {} ie
>>>>>
>>>>>        SELECT * WHERE {VALUES ?item {"spoo" "flarn"}}}
>>>>>
>>>>>      What should I be doing and how should I have known that?
>>>>>
>>>>>      Chris
>>>>>
>>>>>      PS please to excuse the misuse of @Test here ... exploratory use
>>>>> only.
>>>>>
>>>>>      --
>>>>>      "What I don't understand is this ..."   Trevor Chaplin, /The
>>>>> Beiderbeck
>>>>>      Affair/
>>>>>
>>>>>      Epimorphics Ltd, http://www.epimorphics.com
>>>>>      Registered address: Court Lodge, 105 High Street, Portishead,
>>>>> Bristol
>>>>> <https://maps.google.com/?q=105+High+Street,+Portishead,+Bristol+%0D+BS20+%0D+%C2%A0+%C2%A0+%C2%A06PT&entry=gmail&source=g>
>>>>> BS20
>>>>>      6PT
>>>>>      Epimorphics Ltd. is a limited company registered in England
>>>>> (number
>>>>> 7016688)
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> I like: Like Like - The likeliest place on the web
>>>> <http://like-like.xenei.com>
>>>> LinkedIn: http://www.linkedin.com/in/claudewarren
>>>>
>>>>
>>>
>>>
>>>
>

Re: problem with VALUES querybuilder

Posted by Neda Alipanah <ne...@gmail.com>.
Hello there,
I have a quick question. I am loading a 25 Meg Owl file to the memory using
the following commands. My code is working fine through the IDE(IntelliJ),
but when I create a runnable Jar, it does not find the file. I already put
the owl file directory in the class path but I get Exception In Initializer
error.

// Create an empty model
model = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM);

// Use the FileManager to find the input file
InputStream in = FileManager.get().open(inPath);

[image: Inline image 1]

Really appreciate if you can provide a solution for the problem.


Best Regards,

Neda


On Tue, Nov 21, 2017 at 6:52 AM, Andy Seaborne <an...@apache.org> wrote:

> Yes, there is a difference.
>
> It (the join) happens just before project and after any GROUP BY.
>
> See the algebra at http://www.sparql.org/query-validator.html
>
>     Andy
>
>
> On 21/11/17 14:46, Claude Warren wrote:
>
>> based on https://www.w3.org/TR/sparql11-query/#inline-data-examples
>>
>> there is no difference between values  blocks inside or outside a graph
>> pattern.
>>
>> On Tue, Nov 21, 2017 at 2:35 PM, Claude Warren <cl...@xenei.com> wrote:
>>
>> Currently the values are always placed in the top level of the query.
>>>
>>> Q: does it make a difference to exeuction?  (I suspect it does but I want
>>> to make sure before I proceed to add a method to place it inside the
>>> graph
>>> pattern.
>>>
>>> Claude
>>>
>>> On Tue, Nov 21, 2017 at 1:20 PM, Rob Vesse <rv...@dotnetrdf.org> wrote:
>>>
>>> The output you get is syntactically valid - VALUES is allowed at the top
>>>> level of the query as well as within graph patterns
>>>>
>>>>   It is not clear to me if the latter this Is actually possible with the
>>>> current query builder, Claude can probably give you a more detailed
>>>> answer
>>>>
>>>> Rob
>>>>
>>>>
>>>> On 21/11/2017, 12:05, "Chris Dollin" <ch...@epimorphics.com>
>>>> wrote:
>>>>
>>>>      Dear All
>>>>
>>>>      I'm missing something with use of the query builder to create
>>>> VALUES
>>>>      clauses.
>>>>      The code
>>>>
>>>>          @Test public void buildValues() {
>>>>              SelectBuilder sb = new SelectBuilder();
>>>>              sb.addValueVar("item",  "spoo", "flarn");
>>>>              System.err.println(sb.buildString());
>>>>          }
>>>>
>>>>      generates
>>>>
>>>>        SELECT  *
>>>>        WHERE
>>>>          {  }
>>>>        VALUES ?item { "spoo" "flarn" }
>>>>
>>>>      which I believe to be syntactically incorrect but in any case I
>>>> want
>>>> the
>>>>      generated VALUES clause to be inside the WHERE {} ie
>>>>
>>>>        SELECT * WHERE {VALUES ?item {"spoo" "flarn"}}}
>>>>
>>>>      What should I be doing and how should I have known that?
>>>>
>>>>      Chris
>>>>
>>>>      PS please to excuse the misuse of @Test here ... exploratory use
>>>> only.
>>>>
>>>>      --
>>>>      "What I don't understand is this ..."   Trevor Chaplin, /The
>>>> Beiderbeck
>>>>      Affair/
>>>>
>>>>      Epimorphics Ltd, http://www.epimorphics.com
>>>>      Registered address: Court Lodge, 105 High Street, Portishead,
>>>> Bristol
>>>> BS20
>>>>      6PT
>>>>      Epimorphics Ltd. is a limited company registered in England (number
>>>> 7016688)
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>> --
>>> I like: Like Like - The likeliest place on the web
>>> <http://like-like.xenei.com>
>>> LinkedIn: http://www.linkedin.com/in/claudewarren
>>>
>>>
>>
>>
>>

Re: problem with VALUES querybuilder

Posted by Andy Seaborne <an...@apache.org>.
Yes, there is a difference.

It (the join) happens just before project and after any GROUP BY.

See the algebra at http://www.sparql.org/query-validator.html

     Andy

On 21/11/17 14:46, Claude Warren wrote:
> based on https://www.w3.org/TR/sparql11-query/#inline-data-examples
> 
> there is no difference between values  blocks inside or outside a graph
> pattern.
> 
> On Tue, Nov 21, 2017 at 2:35 PM, Claude Warren <cl...@xenei.com> wrote:
> 
>> Currently the values are always placed in the top level of the query.
>>
>> Q: does it make a difference to exeuction?  (I suspect it does but I want
>> to make sure before I proceed to add a method to place it inside the graph
>> pattern.
>>
>> Claude
>>
>> On Tue, Nov 21, 2017 at 1:20 PM, Rob Vesse <rv...@dotnetrdf.org> wrote:
>>
>>> The output you get is syntactically valid - VALUES is allowed at the top
>>> level of the query as well as within graph patterns
>>>
>>>   It is not clear to me if the latter this Is actually possible with the
>>> current query builder, Claude can probably give you a more detailed answer
>>>
>>> Rob
>>>
>>>
>>> On 21/11/2017, 12:05, "Chris Dollin" <ch...@epimorphics.com>
>>> wrote:
>>>
>>>      Dear All
>>>
>>>      I'm missing something with use of the query builder to create VALUES
>>>      clauses.
>>>      The code
>>>
>>>          @Test public void buildValues() {
>>>              SelectBuilder sb = new SelectBuilder();
>>>              sb.addValueVar("item",  "spoo", "flarn");
>>>              System.err.println(sb.buildString());
>>>          }
>>>
>>>      generates
>>>
>>>        SELECT  *
>>>        WHERE
>>>          {  }
>>>        VALUES ?item { "spoo" "flarn" }
>>>
>>>      which I believe to be syntactically incorrect but in any case I want
>>> the
>>>      generated VALUES clause to be inside the WHERE {} ie
>>>
>>>        SELECT * WHERE {VALUES ?item {"spoo" "flarn"}}}
>>>
>>>      What should I be doing and how should I have known that?
>>>
>>>      Chris
>>>
>>>      PS please to excuse the misuse of @Test here ... exploratory use only.
>>>
>>>      --
>>>      "What I don't understand is this ..."   Trevor Chaplin, /The
>>> Beiderbeck
>>>      Affair/
>>>
>>>      Epimorphics Ltd, http://www.epimorphics.com
>>>      Registered address: Court Lodge, 105 High Street, Portishead, Bristol
>>> BS20
>>>      6PT
>>>      Epimorphics Ltd. is a limited company registered in England (number
>>> 7016688)
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>> --
>> I like: Like Like - The likeliest place on the web
>> <http://like-like.xenei.com>
>> LinkedIn: http://www.linkedin.com/in/claudewarren
>>
> 
> 
> 

Re: problem with VALUES querybuilder

Posted by Claude Warren <cl...@xenei.com>.
based on https://www.w3.org/TR/sparql11-query/#inline-data-examples

there is no difference between values  blocks inside or outside a graph
pattern.

On Tue, Nov 21, 2017 at 2:35 PM, Claude Warren <cl...@xenei.com> wrote:

> Currently the values are always placed in the top level of the query.
>
> Q: does it make a difference to exeuction?  (I suspect it does but I want
> to make sure before I proceed to add a method to place it inside the graph
> pattern.
>
> Claude
>
> On Tue, Nov 21, 2017 at 1:20 PM, Rob Vesse <rv...@dotnetrdf.org> wrote:
>
>> The output you get is syntactically valid - VALUES is allowed at the top
>> level of the query as well as within graph patterns
>>
>>  It is not clear to me if the latter this Is actually possible with the
>> current query builder, Claude can probably give you a more detailed answer
>>
>> Rob
>>
>>
>> On 21/11/2017, 12:05, "Chris Dollin" <ch...@epimorphics.com>
>> wrote:
>>
>>     Dear All
>>
>>     I'm missing something with use of the query builder to create VALUES
>>     clauses.
>>     The code
>>
>>         @Test public void buildValues() {
>>             SelectBuilder sb = new SelectBuilder();
>>             sb.addValueVar("item",  "spoo", "flarn");
>>             System.err.println(sb.buildString());
>>         }
>>
>>     generates
>>
>>       SELECT  *
>>       WHERE
>>         {  }
>>       VALUES ?item { "spoo" "flarn" }
>>
>>     which I believe to be syntactically incorrect but in any case I want
>> the
>>     generated VALUES clause to be inside the WHERE {} ie
>>
>>       SELECT * WHERE {VALUES ?item {"spoo" "flarn"}}}
>>
>>     What should I be doing and how should I have known that?
>>
>>     Chris
>>
>>     PS please to excuse the misuse of @Test here ... exploratory use only.
>>
>>     --
>>     "What I don't understand is this ..."   Trevor Chaplin, /The
>> Beiderbeck
>>     Affair/
>>
>>     Epimorphics Ltd, http://www.epimorphics.com
>>     Registered address: Court Lodge, 105 High Street, Portishead, Bristol
>> BS20
>>     6PT
>>     Epimorphics Ltd. is a limited company registered in England (number
>> 7016688)
>>
>>
>>
>>
>>
>>
>
>
> --
> I like: Like Like - The likeliest place on the web
> <http://like-like.xenei.com>
> LinkedIn: http://www.linkedin.com/in/claudewarren
>



-- 
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren

Re: problem with VALUES querybuilder

Posted by Claude Warren <cl...@xenei.com>.
Currently the values are always placed in the top level of the query.

Q: does it make a difference to exeuction?  (I suspect it does but I want
to make sure before I proceed to add a method to place it inside the graph
pattern.

Claude

On Tue, Nov 21, 2017 at 1:20 PM, Rob Vesse <rv...@dotnetrdf.org> wrote:

> The output you get is syntactically valid - VALUES is allowed at the top
> level of the query as well as within graph patterns
>
>  It is not clear to me if the latter this Is actually possible with the
> current query builder, Claude can probably give you a more detailed answer
>
> Rob
>
>
> On 21/11/2017, 12:05, "Chris Dollin" <ch...@epimorphics.com> wrote:
>
>     Dear All
>
>     I'm missing something with use of the query builder to create VALUES
>     clauses.
>     The code
>
>         @Test public void buildValues() {
>             SelectBuilder sb = new SelectBuilder();
>             sb.addValueVar("item",  "spoo", "flarn");
>             System.err.println(sb.buildString());
>         }
>
>     generates
>
>       SELECT  *
>       WHERE
>         {  }
>       VALUES ?item { "spoo" "flarn" }
>
>     which I believe to be syntactically incorrect but in any case I want
> the
>     generated VALUES clause to be inside the WHERE {} ie
>
>       SELECT * WHERE {VALUES ?item {"spoo" "flarn"}}}
>
>     What should I be doing and how should I have known that?
>
>     Chris
>
>     PS please to excuse the misuse of @Test here ... exploratory use only.
>
>     --
>     "What I don't understand is this ..."   Trevor Chaplin, /The Beiderbeck
>     Affair/
>
>     Epimorphics Ltd, http://www.epimorphics.com
>     Registered address: Court Lodge, 105 High Street, Portishead, Bristol
> BS20
>     6PT
>     Epimorphics Ltd. is a limited company registered in England (number
> 7016688)
>
>
>
>
>
>


-- 
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren

Re: problem with VALUES querybuilder

Posted by Rob Vesse <rv...@dotnetrdf.org>.
The output you get is syntactically valid - VALUES is allowed at the top level of the query as well as within graph patterns

 It is not clear to me if the latter this Is actually possible with the current query builder, Claude can probably give you a more detailed answer

Rob


On 21/11/2017, 12:05, "Chris Dollin" <ch...@epimorphics.com> wrote:

    Dear All
    
    I'm missing something with use of the query builder to create VALUES
    clauses.
    The code
    
        @Test public void buildValues() {
            SelectBuilder sb = new SelectBuilder();
            sb.addValueVar("item",  "spoo", "flarn");
            System.err.println(sb.buildString());
        }
    
    generates
    
      SELECT  *
      WHERE
        {  }
      VALUES ?item { "spoo" "flarn" }
    
    which I believe to be syntactically incorrect but in any case I want the
    generated VALUES clause to be inside the WHERE {} ie
    
      SELECT * WHERE {VALUES ?item {"spoo" "flarn"}}}
    
    What should I be doing and how should I have known that?
    
    Chris
    
    PS please to excuse the misuse of @Test here ... exploratory use only.
    
    -- 
    "What I don't understand is this ..."   Trevor Chaplin, /The Beiderbeck
    Affair/
    
    Epimorphics Ltd, http://www.epimorphics.com
    Registered address: Court Lodge, 105 High Street, Portishead, Bristol BS20
    6PT
    Epimorphics Ltd. is a limited company registered in England (number 7016688)
    





Re: problem with VALUES querybuilder

Posted by Andy Seaborne <an...@apache.org>.
You can check syntax at:

http://www.sparql.org/query-validator.html

On 21/11/17 12:05, Chris Dollin wrote:
> Dear All
> 
> I'm missing something with use of the query builder to create VALUES
> clauses.
> The code
> 
>      @Test public void buildValues() {
>          SelectBuilder sb = new SelectBuilder();
>          sb.addValueVar("item",  "spoo", "flarn");
>          System.err.println(sb.buildString());
>      }
> 
> generates
> 
>    SELECT  *
>    WHERE
>      {  }
>    VALUES ?item { "spoo" "flarn" }
> 
> which I believe to be syntactically incorrect but in any case I want the
> generated VALUES clause to be inside the WHERE {} ie
> 
>    SELECT * WHERE {VALUES ?item {"spoo" "flarn"}}}
> 
> What should I be doing and how should I have known that?
> 
> Chris
> 
> PS please to excuse the misuse of @Test here ... exploratory use only.
>