Parsing QueryResults

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Parsing QueryResults

Alex K.
Hi ,

I created a very simple owl and now I want to query that by using SPARQL lang. But I can't cast the associated object to a particular key.
The following code shows how I try to do it ! Would anyone please help me what am I doing wronge here ?

// The result of this query is {prs=SimpleInstance(Alice of [Cls(Person, FrameID(1:29922 1))])}

    QueryResults qr = owlModel.executeSPARQLQuery(query);
    while (qr.hasNext()){
          Map map = qr.next();
         System.out.println(map.toString());  
         if (map.containsKey("prs"))
              ??? = (???)map.get("prs"); // ??? Problem
            }

Thanks


Alex          
Reply | Threaded
Open this post in threaded view
|

[protege-owl] Re: Parsing QueryResults

Massimo Coletti
Hi Alex,

you can look at an example here:
http://protege.cim3.net/cgi-bin/wiki.pl?RunSPARQLQueryAPI

Massimo

Alex K. ha scritto:

> Hi ,
>
> I created a very simple owl and now I want to query that by using
> SPARQL lang. But I can't cast the associated object to a particular key.
> The following code shows how I try to do it ! Would anyone please help
> me what am I doing wronge here ?
>
> // The result of this query is {prs=SimpleInstance(Alice of
> [Cls(Person, FrameID(1:29922 1))])}
>
>     QueryResults qr = owlModel.executeSPARQLQuery(query);
>     while (qr.hasNext()){
>           Map map = qr.next();
>          System.out.println(map.toString());  
>          if (map.containsKey("prs"))
>               ??? = (???)map.get("prs"); // ??? Problem
>             }
>
> Thanks
>
>
> Alex          

-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html