There are LET functions that return math constants. For example:
pi
URL: afn:pi
Description: Returns the value of pi, as an xsd:double.
Arguments:
Returns: xsd:double
You can look these up in TBC help.
You can do simple arithmetic operations using LET functions as in
SELECT ?area
WHERE {
?x rdf:type :Rectangle ;
:height ?h ;
:width ?w .
LET (?area := ?h * ?w) .
}
All four arithmetic operators are part of SPARQL spec, but more advanced
operations such as square root are not. To use these, you would need
extension functions.
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Arthur Keen
Sent: Wednesday, January 13, 2010 8:45 PM
To: TopBraid Composer Users
Subject: [tbc-users] Math functions in SPARQL or SPIN
I need to use expressions containing math functions like sqrt, power ,etc.,
and constants like pi and e in the LET part of my spin rules. I came across
some examples on the web that use a math: namespace, Is there a library that
I can access? I vaguely recollect a discussion in the group a long time
back on doing this using javascript?
Arthur
--
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.