Steve; There are probably lots of different ways to do these. I'll
give some possibilities below that may need adjusting depending on the
details of you ontology:
<Case #1: From the query above, we want to also restrict the tools to
prices under $5000.>
Use FILTER, e.g.:
?tool :price ?price .
FILTER (?price < 5000)
<Case #2: From the query above, we wish to do a "UNION" or an "OR"
where we can get all the direct children of the tools (in addition to
the parent, which the above clause does) selected.>
For this, you can just add the triple pattern:
?child rdfs:subClassOf ?tool
<Case #3: From the query above, we want to select multiple different
properties, so instead of just the ?givenClass rdfs:label "integer
programming", we would want something like ?givenClass rdfs:label
"integer programming" OR ?givenClass rdfs:label "simple additive
method", so that we could in one dataset get tools and their parents
that implement either of these two methods.>
Something like the below should work
SELECT *
WHERE {
{ ?givenClass rdfs:label "integer programming"^^xsd:string .
}
UNION
{ ?givenClass rdfs:label "simple additive method"^^xsd:string .
}
?givenClass rdfs:subClassOf ?parentClass .
?tool :implements ?parentClass .
?tool rdfs:label ?label .
}
On Apr 29, 1:19 pm, dalguy72 <[email protected]> wrote:
> If we need to perform a query, in which we need to use an "AND" or
> "OR" operation or UNION operation or even an equivalent operation, how
> would we do this within sparql with topbraid. In an example, we have
> a Tools ontology, and we built a sparql query to retrieve the parents
> of the tool that implements a given property (in this case the label
> called "Methods and Techniques").
>
> SELECT *
> WHERE {
> ?givenClass rdfs:label "integer programming"^^xsd:string .
> ?givenClass rdfs:subClassOf ?parentClass .
> ?tool SDSSTool:implements ?parentClass .
> ?tool rdfs:label ?label .
> }
>
> However, in the result set, we have several set of cases where want
> want to either expand what is returned or have a more explicity
> setting. I am beginner with sparql, and would appreciate any help
> with figuring it out.
>
> Case #1: From the query above, we want to also restrict the tools to
> prices under $5000.
>
> Case #2: From the query above, we wish to do a "UNION" or an "OR"
> where we can get all the direct children of the tools (in addition to
> the parent, which the above clause does) selected.
>
> Case #3: From the query above, we want to select multiple different
> properties, so instead of just the ?givenClass rdfs:label "integer
> programming", we would want something like ?givenClass rdfs:label
> "integer programming" OR ?givenClass rdfs:label "simple additive
> method", so that we could in one dataset get tools and their parents
> that implement either of these two methods.
>
> Thank you for any help.
>
> Steve
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TopBraid Composer Users" group.
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-composer-users?hl=en
-~----------~----~----~----~------~----~------~--~---