SPARQL subquery in Protege SNAP-SPARQL tab

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

SPARQL subquery in Protege SNAP-SPARQL tab

Blais, Curtis (Curt) (CIV)

I’m trying to get a subquery structure to work in the Protégé SNAP-SPARQL tab. I’m using the query structure from https://www.w3.org/2009/sparql/wiki/Design:SubSelect#Algebra_operator:

 

SELECT ?y ?name

WHERE {  

  ?x foaf:knows ?y .

  {

    SELECT ?y SAMPLE(?name)

    WHERE {  

      ?x foaf:name ?name .

    }

    ORDER BY ?x

    GROUP BY ?name

  }

}

 

The second SELECT is flagged as erroneous in the tab:

 

(I left off the prefix declarations so the line number is off, but you get the idea)

 

Can this subquery structure be handled in this tab or has the syntax changed since that site was posted (2009)?

 

Thanks.

 

Curt

 

NPS MOVES Institute


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: SPARQL subquery in Protege SNAP-SPARQL tab

Lorenz Buehmann

The syntax is indeed still valid for SPARQL 1.1


The problem is, Snap SPARQL does not support this feature (yet) [1] - and I doubt Matthew will have time to add more features. Not sure if there are any plans.

The alternative way - and yes it's a bit cumbersome - you could materialize the inferences first into a new ontology (export inferred axioms) and then use the SPARQL tab on the exported ontology. At least I think it does already support subquery.


[1] https://github.com/protegeproject/snap-sparql-query/issues/10

On 03.03.20 00:14, Blais, Curtis (Curt) (CIV) wrote:

I’m trying to get a subquery structure to work in the Protégé SNAP-SPARQL tab. I’m using the query structure from https://www.w3.org/2009/sparql/wiki/Design:SubSelect#Algebra_operator:

 

SELECT ?y ?name

WHERE {  

  ?x foaf:knows ?y .

  {

    SELECT ?y SAMPLE(?name)

    WHERE {  

      ?x foaf:name ?name .

    }

    ORDER BY ?x

    GROUP BY ?name

  }

}

 

The second SELECT is flagged as erroneous in the tab:

 

(I left off the prefix declarations so the line number is off, but you get the idea)

 

Can this subquery structure be handled in this tab or has the syntax changed since that site was posted (2009)?

 

Thanks.

 

Curt

 

NPS MOVES Institute


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: SPARQL subquery in Protege SNAP-SPARQL tab

Blais, Curtis (Curt) (CIV)

Understood, thank you. I’ll try your suggestion or see if ARQ can run the query.

 

Curt

 

 

From: protege-user <[hidden email]> On Behalf Of Lorenz Buehmann
Sent: Monday, March 2, 2020 10:59 PM
To: [hidden email]
Subject: Re: [protege-user] SPARQL subquery in Protege SNAP-SPARQL tab

 

The syntax is indeed still valid for SPARQL 1.1

 

The problem is, Snap SPARQL does not support this feature (yet) [1] - and I doubt Matthew will have time to add more features. Not sure if there are any plans.

The alternative way - and yes it's a bit cumbersome - you could materialize the inferences first into a new ontology (export inferred axioms) and then use the SPARQL tab on the exported ontology. At least I think it does already support subquery.

 

[1] https://github.com/protegeproject/snap-sparql-query/issues/10

On 03.03.20 00:14, Blais, Curtis (Curt) (CIV) wrote:

I’m trying to get a subquery structure to work in the Protégé SNAP-SPARQL tab. I’m using the query structure from https://www.w3.org/2009/sparql/wiki/Design:SubSelect#Algebra_operator:

 

SELECT ?y ?name

WHERE {  

  ?x foaf:knows ?y .

  {

    SELECT ?y SAMPLE(?name)

    WHERE {  

      ?x foaf:name ?name .

    }

    ORDER BY ?x

    GROUP BY ?name

  }

}

 

The second SELECT is flagged as erroneous in the tab:

 

(I left off the prefix declarations so the line number is off, but you get the idea)

 

Can this subquery structure be handled in this tab or has the syntax changed since that site was posted (2009)?

 

Thanks.

 

Curt

 

NPS MOVES Institute



_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: SPARQL subquery in Protege SNAP-SPARQL tab

Blais, Curtis (Curt) (CIV)
In reply to this post by Lorenz Buehmann

Just to close the loop on this, yes, you are right. I saved out the inferred axioms into a new ontology file and was able to run the subquery structure in the Sparql query tab (not the SNAP-Sparql query tab) to obtain expected results.

 

Going back to the original situation, after running a reasoner on the asserted axioms, it is interesting to me that the Sparql query tab does not execute against the asserted and inferred axioms but SNAP-Sparql does. Is SNAP using the inferences made by the active reasoner (e.g., Hermit) or does SNAP run its own reasoner? Just curious.

 

Thanks.

 

 

Curt

 

 

From: protege-user <[hidden email]> On Behalf Of Lorenz Buehmann
Sent: Monday, March 2, 2020 10:59 PM
To: [hidden email]
Subject: Re: [protege-user] SPARQL subquery in Protege SNAP-SPARQL tab

 

The syntax is indeed still valid for SPARQL 1.1

 

The problem is, Snap SPARQL does not support this feature (yet) [1] - and I doubt Matthew will have time to add more features. Not sure if there are any plans.

The alternative way - and yes it's a bit cumbersome - you could materialize the inferences first into a new ontology (export inferred axioms) and then use the SPARQL tab on the exported ontology. At least I think it does already support subquery.

 

[1] https://github.com/protegeproject/snap-sparql-query/issues/10

On 03.03.20 00:14, Blais, Curtis (Curt) (CIV) wrote:

I’m trying to get a subquery structure to work in the Protégé SNAP-SPARQL tab. I’m using the query structure from https://www.w3.org/2009/sparql/wiki/Design:SubSelect#Algebra_operator:

 

SELECT ?y ?name

WHERE {  

  ?x foaf:knows ?y .

  {

    SELECT ?y SAMPLE(?name)

    WHERE {  

      ?x foaf:name ?name .

    }

    ORDER BY ?x

    GROUP BY ?name

  }

}

 

The second SELECT is flagged as erroneous in the tab:

 

(I left off the prefix declarations so the line number is off, but you get the idea)

 

Can this subquery structure be handled in this tab or has the syntax changed since that site was posted (2009)?

 

Thanks.

 

Curt

 

NPS MOVES Institute



_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: SPARQL subquery in Protege SNAP-SPARQL tab

samsontu


On Mar 3, 2020, at 11:21 AM, Blais, Curtis (Curt) (CIV) <[hidden email]> wrote:

Is SNAP using the inferences made by the active reasoner (e.g., Hermit) or does SNAP run its own reasoner? Just curious.
 

SNAP uses the inferences made by the active reasoner.

With best regards,
Samson



_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user