Re: [topbraid-users] SPIN rule using Virtuoso bif: functions not working

2015-01-08 Thread Holger Knublauch

I have tested this query

SELECT *
WHERE {
SERVICE http://194.119.214.82:8891/sparql {
GRAPH http://localhost:8891/open-data-trapani {
?that http://any23.org/tmp-musei/Nome ?label2 .
?that http://any23.org/tmp-musei/Latitudine ?lat2 .
?that http://any23.org/tmp-musei/Longitudine ?long2 .
} .
FILTER bif:st_intersects(bif:st_point(xsd:float(?lat1), 
xsd:float(?long1)), bif:st_point(xsd:float(?lat2), xsd:float(?long2)), 
0.08) .

} .
}

and believe you can ignore the function factory warnings - they are 
created unnecessarily in an optimization step ahead of the actual 
service call. I have verified that the correct SPARQL string gets sent 
to AG.


I do not have any further ideas right now - maybe try to narrow it down 
starting with a simpler example such as above.


Holger


On 1/8/2015 20:51, ing.antonino.lo...@gmail.com wrote:

Hi Scott, David,

@Scott, when you say to put the functions in the spin in a file I'm 
not sure how, these functions are Virtuoso Geospatial functions, not 
mine, so I should just use in the context of Virtuoso endpoint I'm 
calling via SERVICE. As far as I know I was aware that when using 
SERVICE keyword in SPARQL the federated query ask the endpoint to 
implement the functions called (this time bif: ).


Regarding the prefix I have defined it into TBC inside the namespace tab.

@David, re brackets I know its strange, when I used that functions 
inside virtuoso endpoint I never put  but just call the function, 
e.g. bif:st_intersects . But when I tried inside TBC SPARQL tab I saw 
that only using the brackets its working, and I can confirm that 
removing the brackets and using the full URI returns the below error:

java.lang.reflect.InvocationTargetException
at org.topbraidcomposer.sparql.view.SPARQLView$12.run(SPARQLView.java:498)
at org.topbraidcomposer.core.util.ThreadUtil$1$1.run(ThreadUtil.java:64)
at java.lang.Thread.run(Thread.java:745)
Caused by: HttpException: 500
While calling the functions like this:

*FILTER* bif:st_intersects(bif:st_point(xsd:float(?lat1), 
xsd:float(?long1)), bif:st_point(xsd:float(?lat2), xsd:float(?long2)), 
0.008) .


Work perfectly under TBC SPARQL window.

The strange and not clear thing is that its not working under TBC 
spin:rule with inference tool. And to me it looks not directly related 
to the prefix thing because even under SPARQL window I get the 
warnings, but the results come out anyway.


Any idea?

Thanks

Antonino

Il giorno mercoledì 7 gennaio 2015 21:44:31 UTC+1, Scott Henninger ha 
scritto:



On 1/7/2015 2:30 PM, David Price wrote:


On 7 Jan 2015, at 20:22, Scott Henninger
shenn...@topquadrant.com javascript: wrote:

David, Antonino;  The prefix syntax is correct as defined, i.e.
*PREFIX* bif: http://www.openlinksw.com/schemas/bif#
http://www.openlinksw.com/schemas/bif#


Yep - that’s defining the prefix. However, using a prefix (e.g.
FILTER bif:st_intersects) is where angle brackets should not be
used.


Yes that's correct - the prefix defines a resource (node)
already.  I.e. given the above prefix definition, the following
are the same URI:
  bif:st_intersects
http://www.openlinksw.com/schemas/bif#st_intersects
http://www.openlinksw.com/schemas/bif#st_intersects

...however, the original statement was the rule I execute is
working under TBC Sparql tab.  Now that David points this out,
I'm not sure how that is possible (?)  The no registered function
factory warning should occur and not results will be found.

-- Scott




On 1/7/2015 2:06 PM, David Price wrote:

Only use angle brackets for full URIs, not when using prefixes.

Cheers,
David

UK +44 7788 561308
US +1 336 283 0606





On 7 Jan 2015, at 14:31, ing.anton...@gmail.com javascript:
wrote:

Hi all,

I'm enjoying experimenting SPIN rules as federated queries to
Linked Data cloud and local Virtuoso stored datasets. The
queries I'm trying to implement in SPIN are CONSTRUCT with
bif: geospatial functions usage.
I have tried this in TBC FE 4.6 but I get a strange behaviour:

the rule I execute is working under TBC Sparql tab (even if
raising - URI bif:st_point has no registered function
factory warnings) producing the expected inference outcome.
If I try to execute the same as a spin:rule attached to a
class with Run Inference I get no results, also Im unable to
add the row *PREFIX* bif:
http://www.openlinksw.com/schemas/bif#
http://www.openlinksw.com/schemas/bif#  to the rule, this
is being deleted after clicking enter.

Query is like:
CONSTRUCT {
?this owl:sameAs ?that .
}
WHERE {
?this foaf:name ?label1 .
?this geo:lat ?lat1 .
?this geo:long ?long1 .
SERVICE http://194.119.214.82:8891/sparql
http://194.119.214.82:8891/sparql {

[topbraid-users] User-defined SPIN function: no factory

2015-01-08 Thread Rich Keller
Hi. I am getting the following error when performing inferencing:

 WARN [Thread-25] (E_Function.java:89) - URI 
http://INSERT-PATH-HERE/data#dailyWITIcalc has no registered function 
factory

The function data:dailyWITIcalc is SPIN function that I created. Presumably 
it is not properly defined. How do I go about debugging this error?

I am using TBC-SE v.4.5.0 on a Mac.

Thanks, Rich

PS: The function definition is below.

data:dailyWITIcalc  aowl:Class ;
rdfs:label   dailyWITIcalc^^xsd:string ;
rdfs:subClassOf  spin:Functions ;
spin:body[ a   sp:Select ;
   sp:resultVariables  ( [ sp:expression  [ 
a  sp:Sum ;

sp:expression  [ sp:varName  hourlyWITI^^xsd:string ]
  ] ;
   sp:varName 
dailyWITI^^xsd:string
 ] ) ;
   sp:where( [ sp:object 
data:ASPMhourlyARecord ;
   sp:predicate  rdf:type ;
   sp:subject[ 
sp:varName  hourlyData^^xsd:string ]
 ] [ sp:object [ 
sp:varName  nasday^^xsd:string ] ;
 sp:predicate  
data:reportingNday ;
 sp:subject
spin:_arg1
   ] [ sp:object 
spin:_arg1 ;
   sp:predicate  
data:hasWITIdata ;
   sp:subject[ 
sp:varName  air^^xsd:string ]
 ] [ sp:object [ 
sp:varName  hourlyData^^xsd:string ] ;
 sp:predicate  
data:hasASPMhourlyData ;
 sp:subject[ 
sp:varName  air^^xsd:string ]
   ] [ sp:object [ 
sp:varName  nasday^^xsd:string ] ;
   sp:predicate  
data:reportingNday ;
   sp:subject[ 
sp:varName  hourlyData^^xsd:string ]
 ] [ sp:object 
[ sp:varName  hourlyWITI^^xsd:string ] ;
 sp:predicate  
spin:_arg2 ;
 sp:subject
[ sp:varName  hourlyData^^xsd:string ]
   ] )
 ] ;
spin:constraint  [ a  spl:Argument ;
   spl:predicate  sp:arg1
 ] ;
spin:constraint  [ a  spl:Argument ;
   spl:predicate  sp:arg2
 ] .


-- 
You received this message because you are subscribed to the Google Group 
TopBraid Suite Users, the topics of which include Enterprise Vocabulary 
Network (EVN), Reference Data Manager (RDM), TopBraid Composer, TopBraid Live, 
TopBraid Insight, 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.


Re: [topbraid-users] Some feedback on TBC and SPIN API

2015-01-08 Thread Martynas Jusevicius
Also looking forward to see SPIN API code on GitHub.

On Wednesday, January 7, 2015 at 12:13:27 AM UTC+1, Holger Knublauch wrote:

  On 1/6/2015 19:39, Wim wrote:
  
 Hi,

 I'm enjoying TBC 4.6 a lot (I really like the features and the UI), as 
 well as the SPIN java API which is a great companion for automating some 
 tasks. But there are a couple of (minor) things I've noticed which, at 
 least from my perspective, would be useful to fix/enhance:
  

 Thanks for your feedback!


  
- When I specify rules in TBC that contain nodes of the default 
namespace (i.e. :myNode instead of myNS:myNode) then SPIN API complains 
about these rules. Don't know if this is a problem of TBC (should sp:text 
only contain fully qualified nodes?) or of SPIN API. 

  
 What error message are you getting when you use the default namespace? In 
 general, I would advise anyone against using default namespaces, because 
 they can easily lead to confusion depending on the order of subgraphs in a 
 union graph. It is also often confusing to the algorithms to pick the right 
 choice when a namespace is abbreviated both with  and another prefix.

  
- It would be nice if more useable information is sent to the SPIN 
API ProgressMonitor, such as the iteration number as an integer and rule 
name as a string. Now the only way to extract this information, seems to 
parse the so-called subtask label. 

  
 Good idea, now recorded on our bug tracker.

  
- Inferencing with SPIN API is a lot faster than inferencing with TBC 
(factor 8 or so). Perhaps the constant updating of the TBC progress widget 
is the culprit? If this is the case, maybe it makes sense to provide the 
possibility to turn off these widget updates? Or better yet, perhaps a 
 more 
advanced progress widget would allow the possibility to show only high 
level information such as the current iteration number, and would show 
additional information such as a progress bar, busy time, etc.?
 
  
 Weird, we will investigate.

  
- In TBC, suppose you create a new ontology that imports other 
ontologies, and you create subclasses of existing (imported) classes. In 
this case, it would be nice to visualize in the Classes View which paths 
contain subclasses of the currently active ontology, and which don't. Just 
like individuals can be found very easily due to the (number) suffix, 
it would be nice to see which classes lead to subclasses of the currently 
active ontology, and which don't. Perhaps the imported classes that don't 
contain subclasses of the currently active ontology could have a gray font 
instead of a black one? 

  
 In addition to the suggestion by Irene you may also find Model  Find all 
 locally defined resources useful.

  
- Not sure if it's a legitimate remark or not, but I for one wouldn't 
be unhappy to see SPIN API appearing on GitHub...
 
  
 Absolutely. I have recently started work on a next generation of SPIN as a 
 candidate proposal for the ongoing Shapes W3C group, and plan to publish 
 that version as a public github project once the group signals interest in 
 this work. The complication is that we also need a copy of this for the 
 TopBraid code base, and branching etc would become very complicating if 
 this were spanning multiple github projects. My approach would be to make 
 the edits on the TopBraid code base first, and periodically copy over the 
 changed files to the public repository. This will hopefully also allow us 
 to more easily receive external contributions.

 But for now I need to ask for patience until the W3C direction has been 
 clarified.

 Thanks again,
 Holger

  

-- 
You received this message because you are subscribed to the Google Group 
TopBraid Suite Users, the topics of which include Enterprise Vocabulary 
Network (EVN), Reference Data Manager (RDM), TopBraid Composer, TopBraid Live, 
TopBraid Insight, 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.


Re: [topbraid-users] User-defined SPIN function: no factory

2015-01-08 Thread Holger Knublauch
First you should make sure that the SPIN function is stored in a file 
ending with .spin.* so that it will be picked up when the system starts. 
To make sure it got registered, a restart also helps.


Also the function must be an instance of spin:Function, not rdf:type 
owl:Class (first row of your Turtle snippet below).


Please get back to us if this does not resolve the issue.

Thanks,
Holger


On 1/9/15, 9:23 AM, Rich Keller wrote:

Hi. I am getting the following error when performing inferencing:

 WARN [Thread-25] (E_Function.java:89) - URI 
http://INSERT-PATH-HERE/data#dailyWITIcalc has no registered 
function factory


The function data:dailyWITIcalc is SPIN function that I created. 
Presumably it is not properly defined. How do I go about debugging 
this error?


I am using TBC-SE v.4.5.0 on a Mac.

Thanks, Rich

PS: The function definition is below.

data:dailyWITIcalc  aowl:Class ;
rdfs:label   dailyWITIcalc^^xsd:string ;
rdfs:subClassOf  spin:Functions ;
spin:body[ a   sp:Select ;
   sp:resultVariables  ( [ sp:expression  [ 
a  sp:Sum ;

sp:expression  [ sp:varName  hourlyWITI^^xsd:string ]
] ;
sp:varName dailyWITI^^xsd:string
 ] ) ;
   sp:where( [ sp:object 
data:ASPMhourlyARecord ;

   sp:predicate rdf:type ;
   sp:subject [ 
sp:varName  hourlyData^^xsd:string ]
 ] [ sp:object [ 
sp:varName  nasday^^xsd:string ] ;

sp:predicate  data:reportingNday ;
sp:subjectspin:_arg1
   ] [ sp:object 
spin:_arg1 ;

sp:predicate  data:hasWITIdata ;
sp:subject[ sp:varName  air^^xsd:string ]
 ] [ sp:object 
[ sp:varName  hourlyData^^xsd:string ] ;

sp:predicate  data:hasASPMhourlyData ;
sp:subject[ sp:varName  air^^xsd:string ]
   ] [ 
sp:object [ sp:varName  nasday^^xsd:string ] ;

sp:predicate  data:reportingNday ;
sp:subject[ sp:varName  hourlyData^^xsd:string ]
 ] [ 
sp:object [ sp:varName  hourlyWITI^^xsd:string ] ;

sp:predicate  spin:_arg2 ;
sp:subject[ sp:varName  hourlyData^^xsd:string ]
   ] )
 ] ;
spin:constraint  [ a  spl:Argument ;
   spl:predicate  sp:arg1
 ] ;
spin:constraint  [ a  spl:Argument ;
   spl:predicate  sp:arg2
 ] .


--
You received this message because you are subscribed to the Google 
Group TopBraid Suite Users, the topics of which include Enterprise 
Vocabulary Network (EVN), Reference Data Manager (RDM), TopBraid 
Composer, TopBraid Live, TopBraid Insight, 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 
mailto: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 Enterprise Vocabulary Network (EVN), 
Reference Data Manager (RDM), TopBraid Composer, TopBraid Live, TopBraid Insight, 
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.


Re: [topbraid-users] SPIN rule using Virtuoso bif: functions not working

2015-01-08 Thread ing . antonino . lobue
Hi Scott, David,

@Scott, when you say to put the functions in the spin in a file I'm not 
sure how, these functions are Virtuoso Geospatial functions, not mine, so I 
should just use in the context of Virtuoso endpoint I'm calling via 
SERVICE. As far as I know I was aware that when using SERVICE keyword in 
SPARQL the federated query ask the endpoint to implement the functions 
called (this time bif: ).

Regarding the prefix I have defined it into TBC inside the namespace tab.

@David, re brackets I know its strange, when I used that functions inside 
virtuoso endpoint I never put  but just call the function, e.g. 
bif:st_intersects . But when I tried inside TBC SPARQL tab I saw that only 
using the brackets its working, and I can confirm that removing the 
brackets and using the full URI returns the below error:
java.lang.reflect.InvocationTargetException
at org.topbraidcomposer.sparql.view.SPARQLView$12.run(SPARQLView.java:498)
at org.topbraidcomposer.core.util.ThreadUtil$1$1.run(ThreadUtil.java:64)
at java.lang.Thread.run(Thread.java:745)
Caused by: HttpException: 500
While calling the functions like this:

*FILTER* bif:st_intersects(bif:st_point(xsd:float(?lat1), xsd:float(?long1)), 
bif:st_point(xsd:float(?lat2), xsd:float(?long2)), 0.008) .
Work perfectly under TBC SPARQL window.

The strange and not clear thing is that its not working under TBC spin:rule 
with inference tool. And to me it looks not directly related to the prefix 
thing because even under SPARQL window I get the warnings, but the results 
come out anyway.

Any idea?

Thanks

Antonino 

Il giorno mercoledì 7 gennaio 2015 21:44:31 UTC+1, Scott Henninger ha 
scritto:

  
 On 1/7/2015 2:30 PM, David Price wrote:
  
  
 On 7 Jan 2015, at 20:22, Scott Henninger shenn...@topquadrant.com 
 javascript: wrote:

  David, Antonino;  The prefix syntax is correct as defined, i.e.
   *PREFIX* bif: http://www.openlinksw.com/schemas/bif#
  

  Yep - that’s defining the prefix. However, using a prefix (e.g. FILTER 
 bif:st_intersects) is where angle brackets should not be used.
  

 Yes that's correct - the prefix defines a resource (node) already.  I.e. 
 given the above prefix definition, the following are the same URI:
   bif:st_intersects
   http://www.openlinksw.com/schemas/bif#st_intersects 
 http://www.openlinksw.com/schemas/bif#st_intersects

 ...however, the original statement was the rule I execute is working 
 under TBC Sparql tab.  Now that David points this out, I'm not sure how 
 that is possible (?)  The no registered function factory warning should 
 occur and not results will be found.

 -- Scott

  
   On 1/7/2015 2:06 PM, David Price wrote:
  
 Only use angle brackets for full URIs, not when using prefixes. 

  Cheers,
 David
   
 UK +44 7788 561308
 US +1 336 283 0606

  

  
  On 7 Jan 2015, at 14:31, ing.anton...@gmail.com javascript: wrote:

  Hi all, 

  I'm enjoying experimenting SPIN rules as federated queries to Linked 
 Data cloud and local Virtuoso stored datasets. The queries I'm trying to 
 implement in SPIN are CONSTRUCT with bif: geospatial functions usage.
 I have tried this in TBC FE 4.6 but I get a strange behaviour:

  the rule I execute is working under TBC Sparql tab (even if raising - 
 URI bif:st_point has no registered function factory warnings) producing 
 the expected inference outcome. If I try to execute the same as a spin:rule 
 attached to a class with Run Inference I get no results, also Im unable to 
 add the row  *PREFIX* bif: http://www.openlinksw.com/schemas/bif#  to 
 the rule, this is being deleted after clicking enter.

  Query is like:
 CONSTRUCT {
 ?this owl:sameAs ?that .
 }
 WHERE {
 
 ?this foaf:name ?label1 .
 ?this geo:lat ?lat1 .
 ?this geo:long ?long1 .
 SERVICE http://194.119.214.82:8891/sparql {
 GRAPH http://localhost:8891/open-data-trapani {
 ?that http://any23.org/tmp-musei/Nome ?label2 .
 ?that http://any23.org/tmp-musei/Latitudine ?lat2 .
 ?that http://any23.org/tmp-musei/Longitudine ?long2 .
 } .
 FILTER bif:st_intersects(bif:st_point(xsd:float(?lat1), 
 xsd:float(?long1)), bif:st_point(xsd:float(?lat2), xsd:float(?long2)), 
 0.08) .
 } .
 } 
  
 * Any suggestion? *

  *Thanks*

  *Antonino Lo Bue*
 *CNR-ICAR Palermo*
  
  -- 
 You received this message because you are subscribed to the Google Group 
 TopBraid Suite Users, the topics of which include Enterprise Vocabulary 
 Network (EVN), Reference Data Manager (RDM), TopBraid Composer, TopBraid 
 Live, TopBraid Insight, SPARQLMotion, SPARQL Web Pages and SPIN.
 To post to this group, send email to topbrai...@googlegroups.com 
 javascript:
 --- 
 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 javascript:.
 For more options, visit