Thanks, Holger,

That’s good to know.

Generally, when I’m looking for functions to use, I refer to the “TopBraid 
SPARQL Functions reference” section in TBC Help.

Updating that with either the new afn: functions, or a link to 
http://jena.apache.org/documentation/query/library-function.html in the help 
file would be a good way for users to know what is available.

 

 

- Steve

 

Steven R. Ray, Ph.D.

Distinguished Research Fellow

Carnegie Mellon University

NASA Research Park

Building 23 (MS 23-11)

P.O. Box 1
Moffett Field, CA 94305-0001

Email:    steve....@sv.cmu.edu

Phone: (650) 587-3780

Cell:      (202) 316-6481

Skype: steverayconsulting

cid:A9ED74CE-68DA-4276-847C-3C08B21B97C0@wv.cc.cmu.edu

 

From: topbraid-users@googlegroups.com [mailto:topbraid-users@googlegroups.com] 
On Behalf Of Holger Knublauch
Sent: Tuesday, June 07, 2016 3:52 PM
To: topbraid-users@googlegroups.com
Subject: Re: [topbraid-users] Support for square root

 

Hi Steve,

Jena already includes a number of math functions including afn:sqrt(num), see

http://jena.apache.org/documentation/query/library-function.html

These functions are not however listed in the afn namespace as instances of 
spin:Function and therefore do not show up in auto-complete etc.

Andy also updated me that Jena 3 (with TopBraid 5.2) will include the math 
functions from

https://www.w3.org/TR/xpath-functions-31/

Thanks
Holger




On 7/06/2016 4:40, Steve Ray (CMU) wrote:

Seeing the release of TopBraid 5.1.4 reminded me that I would like to suggest 
the addition of the square root function to your standard library of math 
functions. I know others have bumped into this omission.

 

In the meantime, I went ahead and defined it with the following code:

 

rules:sqrt

  rdf:type spin:Function ;

  spin:constraint [

      rdf:type spl:Argument ;

      spl:predicate sp:arg1 ;

    ] ;

  spin:returnType xsd:float ;

  spinx:javaScriptCode "return Math.sqrt (arg1)"^^xsd:string ;

  rdfs:comment "Compute the square root of a number."^^xsd:string ;

  rdfs:subClassOf spin:Functions ;

 

…which requires importing http://spinrdf.org/spinx (from 
/TopBraid/SPIN/spinx.ttl)

 

I know it’s easy for users to just do this, but many people may not want to 
figure out how to bring in javascript snippets and locate the Math library.

 

Of course, you would use a different prefix than “rules” which I did.

 

 

- Steve

 

Steven R. Ray, Ph.D.

Distinguished Research Fellow

Carnegie Mellon University

NASA Research Park

Building 23 (MS 23-11)

P.O. Box 1
Moffett Field, CA 94305-0001

Email:    steve....@sv.cmu.edu

Phone: (650) 587-3780

Cell:      (202) 316-6481

Skype: steverayconsulting

cid:A9ED74CE-68DA-4276-847C-3C08B21B97C0@wv.cc.cmu.edu

 

-- 
You received this message because you are subscribed to the Google Group 
"TopBraid Suite Users", the topics of which include the TopBraid Suite family 
of products and its base technologies such as SPARQLMotion, SPARQL Web Pages 
and SPIN.
To post to this group, send email to topbraid-users@googlegroups.com
--- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to topbraid-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

-- 
You received this message because you are subscribed to the Google Group 
"TopBraid Suite Users", the topics of which include the TopBraid Suite family 
of products and its base technologies such as SPARQLMotion, SPARQL Web Pages 
and SPIN.
To post to this group, send email to topbraid-users@googlegroups.com
--- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to topbraid-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Group 
"TopBraid Suite Users", the topics of which include the TopBraid Suite family 
of products and its base technologies such as SPARQLMotion, SPARQL Web Pages 
and SPIN.
To post to this group, send email to topbraid-users@googlegroups.com
--- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to topbraid-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to