Support for square root

24 views
Skip to first unread message

Steve Ray (CMU)

unread,
Jun 6, 2016, 2:41:00 PM6/6/16
to topbrai...@googlegroups.com

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:    stev...@sv.cmu.edu

Phone: (650) 587-3780

Cell:      (202) 316-6481

Skype: steverayconsulting

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

 

image001.png

Pat Doyle

unread,
Jun 6, 2016, 2:51:33 PM6/6/16
to topbrai...@googlegroups.com
Thanks for the request, Steve.  I've gone ahead and forwarded it along to the development team to look at getting this added in the next release.  The tracking ID is TBC-470.

Regards,
Pat Doyle

--
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 topbrai...@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-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Holger Knublauch

unread,
Jun 7, 2016, 6:52:02 PM6/7/16
to topbrai...@googlegroups.com
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
--

Steve Ray

unread,
Jun 7, 2016, 7:00:07 PM6/7/16
to topbrai...@googlegroups.com

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:    stev...@sv.cmu.edu

Phone: (650) 587-3780

Cell:      (202) 316-6481

Skype: steverayconsulting

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

 

image001.png
Reply all
Reply to author
Forward
0 new messages