Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-owl] SparQL and Optional

Massimo Coletti mailing.coletti at finnat.it
Wed Sep 6 03:38:03 PDT 2006


I tried also to use the API from Java, but the result is:

java.lang.NullPointerException
    at
edu.stanford.smi.protegex.owl.model.query.SPARQLQueryResults.next(Unknown
Source)

when a variable from an OPTIONAL block is unbound.

Maybe, in the code block:

       for (int i = 0; i < vars.size(); i++) {
            String varName = (String) vars.get(i);
            RDFNode varNode = soln.get(varName);

after assigning varNode, a null test is required.

Massimo Coletti

Mark Feblowitz ha scritto:
> I've seen the same behavior.
>
> Reading both the SPARQL doc and the ARQ doc, it appears as though this 
> ought to work. I'm wondering if it's a problem with Protege-Owl's 
> display mechanism, which may be expecting bindings for all SELECTed 
> variables.
>
> Mark
>
>
> At 12:40 PM 2/15/2006, Scott L Holmes wrote:
>> I'm just not getting it. I think there's an issue. Or perhaps someone 
>> can point out my error.
>>
>> In using the Pizza Ontology that ships with Protege-OWL 2.2.
>>
>> Create a NamedPizza NamedPizza_3
>> Create DeepPanBase DeepPanBase_6
>> NamedPizza_3 hasBase DeepPanBase_6
>>
>> Create a NamedPizza NamedPizza_4
>> Create a ThinAndCrispyBase ThinAndCrispyBase_7
>> NamedPizza_4 hasBase ThinAndCrispyBase_7
>>
>> Create a PizzaTopping PizzaTopping_1
>> NamedPizza_4 hasTopping PizzaTopping_1
>>
>> SELECT ?Pizza ?Base ?Topping
>> WHERE {
>>  ?Pizza :hasBase ?Base.
>>  ?Pizza :hasTopping ?Topping.
>> }
>>
>> NamedPizza_4 ThinAndCrispyBase_7 PizzaTopping_1
>>
>> SELECT ?Pizza ?Base ?Topping
>> WHERE {
>>  ?Pizza :hasBase ?Base.
>> OPTIONAL{ ?Pizza :hasTopping ?Topping.}
>> }
>>
>> Query Failed: Null
>> I would expect to see
>> NamedPizza_3 ThinAndCrispyBase_6 _nothing_
>> NamedPizza_4 ThinAndCrispyBase_7 PizzaTopping_1
>>
>> Any advice would be greatly appreciated. It would be like opening a 
>> door!
>>
>> Scott
>
> -------------------------------------------------------------------------
> To unsubscribe go to http://protege.stanford.edu/community/subscribe.html
>




This e-mail and any attachments may contain confidential and
privileged information. If you are not the intended recipient,
please notify the sender immediately by return e-mail, delete this
e-mail and destroy any copies. Any dissemination or use of this
information by a person other than the intended recipient is
unauthorized and may be illegal.



More information about the protege-owl mailing list