Re: [topbraid-users] Re: Best way to modify existing data

2014-07-19 Thread Scott Henninger
Barton, the message is stating that the script is undefined.  Given that the 
script URL is http:///endpoints#ModifyForm, it seems you need to 
replace  with the name of your server.

If working with TBC-ME, when you first define a SPARQLMotion service or change 
it's signature, you will need to perform a 'Refresh/Display SPARQLMotion 
functions...' action from the Scripts menu.

-- Scott

> On Jul 18, 2014, at 4:18 PM, Barton Petersen  wrote:
> 
> Hey Scott,
> 
> Thank you very much for the reply.  I deleted the apply construct and I'm 
> able to debug the sparql motion successfully!  Now, I'm getting the following 
> error when I try to hit it from the webservice url:
> 
> An internal error has been reported by the SPARQLMotion engine of TopBraid 
> Live.
> 
> Summary: [Undefined service with script http:///endpoints#ModifyForm]
> 
> Details: org.topbraidlive.server.servlet.RecoverableClientException: 
> Undefined service with script http:///endpoints#ModifyForm
>   at 
> org.topbraidlive.sparqlmotion.servlets.sparqlmotion.SPARQLMotionServlet.getService(SPARQLMotionServlet.java:206)
>   at 
> org.topbraidlive.sparqlmotion.servlets.sparqlmotion.SPARQLMotionServlet.run(SPARQLMotionServlet.java:267)
>   at 
> org.topbraidlive.sparqlmotion.servlets.sparqlmotion.SPARQLMotionServlet.doGet(SPARQLMotionServlet.java:245)
>   at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
>   at 
> org.topbraid.auth.servlet.TBAuthEnabledServlet.service(TBAuthEnabledServlet.java:38)
>   at 
> org.topbraid.eclipsex.servlet.TBHttpServlet.service(TBHttpServlet.java:125)
>   at 
> org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180)
>   at 
> org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
>   at 
> org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
>   at 
> org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:60)
>   at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
>   at 
> org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:386)
>   at 
> org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:669)
>   at 
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:457)
>   at 
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:229)
>   at 
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1075)
>   at 
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384)
>   at 
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
>   at 
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1009)
>   at 
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
>   at 
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
>   at org.eclipse.jetty.server.Server.handle(Server.java:368)
>   at 
> org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
>   at 
> org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:942)
>   at 
> org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1004)
>   at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:640)
>   at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
>   at 
> org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
>   at 
> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)
>   at 
> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
>   at 
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
>   at 
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
>   at java.lang.Thread.run(Unknown Source)
> 
> 
> 
>> On Friday, July 18, 2014 9:16:01 AM UTC-6, Barton Petersen wrote:
>> I'm trying to expose a service to allow modification of some information, 
>> say a name.  I want to allow them to modify *some* name information.  
>> Specifically the ones in the argument list for the service.
>> 
>> For example, I want them to be able to modify their contact information.  So 
>> the service passes in the arguments and I have an 'apply contruct' action 
>> which then passes the created triples to an 'apply update' action.  At this 
>> point I have a DELETE INSERT statement.  The insert seems to work, that is, 
>> I get the updated information.  However, the old information remains (two 
>> email triples now instead of just the new one).  So it's as if the Insert 
>> part of the DELETE/ INSERT is working, b

[topbraid-users] Programmattically define a function using the SPIN API and run it as part of a query

2014-07-19 Thread Monika Solanki
I am fairly new to SPIN and the SPIN API. I am looking for examples that 
show how to create a user defined function using the SPIN API and use it 
within a query that runs over a model. I am mostly aware of how I could 
develop the second part, but I would like help on programmatically creating 
the user defined function.

Many Thanks,

Monika

-- 
-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary 
Network (EVN), TopBraid Composer, TopBraid Live, TopBraid Insight, 
SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to
topbraid-users@googlegroups.com
To unsubscribe from this group, send email to
topbraid-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en
--- 
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.


[topbraid-users] SPINMapping properties that are lists

2014-07-19 Thread Steve Ray (CMU)
I have what I think must be a common problem: 

 

Assume I have a source class with property A, and its value is a list of
strings.

I want to map this to a destination class with multiple instances of
property B, each derived from one of the strings in the list.

 

My problem is that SPINMap can only call functions, and a function can only
return a single value. To my knowledge, you cannot do something tricky with
magic properties in a SPINMap mapping, right? So defining my own function
doesn't help.

 

The only workaround I can think of is to just map it over using
spinmap:equals, and then write a SPIN rule for the destination class that
goes in and uses a pattern like

 

?list (rdf:rest)*/rdf:first ?item .

 

.to assert the individual items. This isn't very elegant, and in fact I'm
having trouble having the rule clean up after itself and deleting the
unwanted list without throwing itself into an infinite loop, so I'm hoping
I'm just unaware of some obvious approach to this.

 

(For what it's worth, my SPIN rule that ran on forever was the following) 

 

# Convert lists of keywords to individual instances of keywords

DELETE {

?this or:hasKeyword ?listOrItem .

}

INSERT {

?this or:hasKeyword ?item .

}

WHERE {

?this or:hasKeyword ?listOrItem .

FILTER (!spl:instanceOf( ?listOrItem , xsd:string)) .

?listOrItem (rdf:rest)*/rdf:first ?item .

}

 

What I'd really like is help with my initial problem, but if there's no
solution within SPINMap, then I guess I need help with my workaround.

 

 

 

- 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

10yr-logo-sm

 

-- 
-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary 
Network (EVN), TopBraid Composer, TopBraid Live, TopBraid Insight, 
SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to
topbraid-users@googlegroups.com
To unsubscribe from this group, send email to
topbraid-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en
--- 
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] Programmattically define a function using the SPIN API and run it as part of a query

2014-07-19 Thread Holger Knublauch

Hi Monika,

the SPIN API is designed to be driven in the same way that SPIN files 
are driven - by declarations in RDF. In other words, the proper way of 
defining SPIN functions is to edit them with an RDF editor (such as 
TopBraid or a text editor) and then simply load the function definitions 
into the module registry. This is shown in the 
KennedysInferencingAndConstraintsExample via


// Register locally defined functions
SPINModuleRegistry.get().registerAll(ontModel, null);

then just use them in your SPARQL/SPIN queries. In the SPIN RDF syntax - 
if you ever want to generate that programmatically, use the Jena API to 
create the corresponding triples - a SPIN function call is simply an 
instance of the function class.


You may want to clarify which parts of your application are statically 
edited and which ones are dynamically produced for further advise.


Holger


On 7/20/2014 5:16, Monika Solanki wrote:
I am fairly new to SPIN and the SPIN API. I am looking for examples 
that show how to create a user defined function using the SPIN API and 
use it within a query that runs over a model. I am mostly aware of how 
I could develop the second part, but I would like help on 
programmatically creating the user defined function.


Many Thanks,

Monika
--
-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise 
Vocabulary Network (EVN), TopBraid Composer, TopBraid Live, TopBraid 
Insight, SPARQLMotion, SPARQL Web Pages and SPIN.

To post to this group, send email to
topbraid-users@googlegroups.com
To unsubscribe from this group, send email to
topbraid-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en
---
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 Enterprise Vocabulary 
Network (EVN), TopBraid Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL 
Web Pages and SPIN.
To post to this group, send email to
topbraid-users@googlegroups.com
To unsubscribe from this group, send email to
topbraid-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en
--- 
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] Customize behavior of TreeDataProvider arg:onSelect

2014-07-19 Thread Holger Knublauch

Hi Jack,

first off I would define "static" JavaScript functions in auxiliary .js 
files instead of defining them inline. This makes editing and debugging 
easier. The only cases where I would insert JavaScript into the SWP 
would be if the code itself needs to be generated dynamically, depending 
on SPARQL queries etc. To get your own .js file into a web application, 
use ui:headIncludes.


On 7/19/2014 9:58, Jack Hodges wrote:
The following  defines a javascript function that is called 
when an item in the tree is selected for viewing. In this body all 
that is stipulated is the url for the resource. In most of my views I 
can select what kind of view is used with a match-id or a priority. Is 
the ui:instanceView selected based on whether it (the resource type) 
is a class or an instance? Certainly not in this function:



var serverURL = ''; // 'http://localhost:8083/tbl/';

 function openInNewTab(resource){
var url=document.URL;
var q= url.indexOf('?');
var sendTo= url.substring(0,q)+"?_resource="+resource;;
//alert('openInNewTab ' + sendTo);
window.open(sendTo);
}


I want to be able to determine which view will be used when and item 
in the tree is selected. Can I construct the URL to use any SWP or 
will it be overridden?


The rules of when which views are selected are specified in the SWP 
manual, esp. in


http://uispin.org/ui.html#linking

As a general rule, you should use ui:instanceView to associate the 
classes from your domain model with your customized views. If nothing is 
specified for a class, it will walk up the class hierarchy, eventually 
reaching rdfs:Resource where the SWA ontology defines some standard views.


I would just try it except that everything is taking so damned long I 
might as well submit the question and wait for some kind of response 
here :-(


Something seems seriously broken in your set up, and just repeating the 
same complaints doesn't help - we need to get to the ground of that. 
What have you tried to overcome the slowness and what is going on in 
your workspace that could explain this? We do not have the problems you 
describe and use SWP on a daily basis - most of our own product code 
base uses SWP and SWA for the web user interfaces.


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), TopBraid Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL 
Web Pages and SPIN.
To post to this group, send email to
topbraid-users@googlegroups.com
To unsubscribe from this group, send email to
topbraid-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en
--- 
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] SPINMapping properties that are lists

2014-07-19 Thread Holger Knublauch

Hi Steve,

SPINMap has been designed to help people without a deep understanding of 
SPIN or SPARQL to build mappings. It covers the most frequently needed 
use cases, and provides a syntax that is suitable for graphical editing. 
Like every such language with a simplified scope, the expressivity has 
been intentionally cut down and not every possible use case of SPIN and 
SPARQL is covered by SPINMap. You can now guess that my answer is that 
you may need to bypass the SPINMap syntax for more complex cases like 
the one that you describe - mapping one rdf:List with multiple target 
values.


Fortunately, SPINMap is just an application of SPIN templates, and SPIN 
templates can be executed with the same engine as any other SPIN rules. 
This means that you can mix SPINMap with conventional "hand-coded" SPIN 
rules.


On 7/20/2014 10:43, Steve Ray (CMU) wrote:


I have what I think must be a common problem:

Assume I have a source class with property A, and its value is a list 
of strings.


I want to map this to a destination class with multiple instances of 
property B, each derived from one of the strings in the list.


My problem is that SPINMap can only call functions, and a function can 
only return a single value. To my knowledge, you cannot do something 
tricky with magic properties in a SPINMap mapping, right? So defining 
my own function doesn't help.


The only workaround I can think of is to just map it over using 
spinmap:equals, and then write a SPIN rule for the destination class 
that goes in and uses a pattern like


?list (rdf:rest)*/rdf:first ?item.

...to assert the individual items. This isn't very elegant, and in 
fact I'm having trouble having the rule clean up after itself and 
deleting the unwanted list without throwing itself into an infinite 
loop, so I'm hoping I'm just unaware of some obvious approach to this.


(For what it's worth, my SPIN rule that ran on forever was the following)

# Convert lists of keywords to individual instances of keywords

*DELETE*{

*?this* or:hasKeyword ?listOrItem.

}

*INSERT*{

*?this* or:hasKeyword ?item.

}

*WHERE*{

*?this* or:hasKeyword ?listOrItem.

*FILTER* (!spl:instanceOf(?listOrItem, xsd:string)) .

?listOrItem (rdf:rest)*/rdf:first ?item.

}

What I'd really like is help with my initial problem, but if there's 
no solution within SPINMap, then I guess I need help with my workaround.




The normal application area of SPINMap is to create new triples (in the 
target ontology) out of existing triples (in the source ontology). 
SPINMap for sure has not been designed to delete any triples - it just 
adds new triples. In your code above, the DELETE may delete the root of 
your rdfList, but not the intermediate blank nodes that constitute the 
rdf:List internally. So you would end up with orphan nodes. I do not see 
why it would run into an infinite loop though.


Sorry I don't have time to work out a complete solution for you right 
now, maybe tomorrow (or someone else may help out).


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), TopBraid Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL 
Web Pages and SPIN.
To post to this group, send email to
topbraid-users@googlegroups.com
To unsubscribe from this group, send email to
topbraid-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en
--- 
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.