Sofia,
You're welcome. The set of SPARQL 1.1 functions and operators can be
found here:
http://www.w3.org/TR/sparql11-query/#SparqlOps
However, we support as much as ARQ (Jena's SPARQL engine) supports. ARQ
has also its own property functions and filter functions. You can also
look at the ARQ page:
http://jena.sourceforge.net/ARQ/documentation.html
All the TopBraid Suite SPARQL functions are described at the Help page,
under TopBraid Composer > Reference. tops:foreach is described under
there in TopBraid's SPARQL Property Functions.
Gokhan
On 5/18/2011 2:40 AM, sofiangeletou wrote:
Dear Gokhan,
thanks very much for your detailed reply!! Nested if is the best
solution also from a performance perspective, i.e., I can place the
least expensive ns:fn_isX in the higher lever aiming to avoid the
computation of all of them if this returns true. Also very good
pointers to coalesce and foreach. Where can I find more of these? I am
only aware of the sparql motion built in functions.
Many thanks again!
Sofia
On May 17, 10:00 pm, Gokhan Soydan<[email protected]> wrote:
There can be three solutions:
1-) Use IF (or smf:if)
SELECT?type ?input
WHERE {
LET( ?type := IF( ns:fn_isE(?input), E, IF( ns:fn_isT(?input), T,
IF( ns:fn_isG(?input), G, J ) ) ) )
}
2-) Use COALESCE. For COALESCE to work, the partial functions should
only return a type value if the input is an instance of it, otherwise
return value should be unbound. So, a functon like ns:fn_getE(?input)
should return E if ?input is an instance of E, and otherwise nothing.
COALESCE gets the first bound variable in a list of input variables.
SELECT ?type ?input
WHERE {
LET( ?type := COALESCE( ns:fn_getE(?input), ns:fn_getT(?input),
ns:fn_getG(?input), ns:fn_getJ(?input) ) )
}
3-) Use tops:foreach property function. This property function takes a
list of input values on the right, and binds them one at a time to the
variable on the left. No need for partial functions then.
SELECT *
WHERE {
?type tops:foreach ( E T G J ) .
?input a ?type .
}
Gokhan
On 5/17/2011 12:44 PM, sofiangeletou wrote:
Thank you for your reply Gokhan,
however this is not what I am trying to achieve. I already know the
rdf:type of all individuals A but I want to further infer that they
belong to one of the four aforementioned categories based on the
values of their properties using spin. I hope that it is clearer now.
Thanks,
Sofia
On May 17, 8:24 pm, Gokhan Soydan<[email protected]> wrote:
Sofia,
The simplest solution to your question would be:
SELECT ?type ?input
WHERE {
?input a ?type .
}
This is how you would get the type of an instance. What is your intended
result?
Gokhan
On 5/17/2011 6:47 AM, sofiangeletou wrote:
Hello there,
I have an instance A for which I want to decide if it is of one of the
following types E, T, G, J. At the moment I have created boolean
functions that tell me if A is one of these types or not. Yet I want
to have one function e.g., getType(A) that based on the boolean result
of each of the partial functions returns a type. Something like the
switch function of java or multiple-clause if-then-else.
The maximum I have reached is the following:
select ?e ?t ?g ?j ?input
where {
LET (?e:= ns:fn_isE(?input)).
LET (?t:= ns:fn_isT(?input)).
LET (?g:= ns:fn_isG(?input)).
LET (?j:= ns:fn_isJ(?input)).
}
which returns
true false false false ?input1
false true false false ?input2
........
I would greatly appreciate your help,
Many thanks in advance,
Sofia
--
You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include TopBraid Composer,
TopBraid Live, TopBraid Ensemble, SPARQLMotion and SPIN.
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-users?hl=en