Spin templates not found

27 views
Skip to first unread message

Adam Kimball

unread,
Aug 31, 2016, 7:15:07 PM8/31/16
to TopBraid Suite Users


Hi all,

I'm pulling my hair out trying to invoke a spin template via the swp servlet in TB Live via TBC ME.  I've created a new file hello.world.ui.ttlx.  The complete definition is utterly simple:

service-sdl:HelloWorld
  rdf:type spin:SelectTemplate ;
  spin:body [
      rdf:type sp:Select ;
      sp:limit "100"^^xsd:long ;
      sp:where (
          [
            sp:object [
                sp:varName "p"^^xsd:string ;
              ] ;
            sp:predicate [
                sp:varName "p"^^xsd:string ;
              ] ;
            sp:subject [
                sp:varName "s"^^xsd:string ;
              ] ;
          ]
        ) ;
    ] ;
  rdfs:label "The simplest test"^^xsd:string ;
  rdfs:subClassOf spin:SelectTemplate ;
.

In other worlds, we have a hello world template that returns 200 triples with no other considerations.  The file itself declares the prefix:

# baseURI: http://metadata.healthwise.org/services/sdl
# imports: http://uispin.org/swon
# prefix: service-sdl
...boiler-plate...
@prefix service-sdl: <http://metadata.healthwise.org/services/sdl#> .

When I hit the TBL web services report, I clearly see it listed and the generated docs tell me I can get to it via:

template//HelloWorld?
or
template?_template=:HelloWorld&

However, I get a 500 Error when I hit: http://localhost:8083/tbl/template//HelloWorld? (
Summary: [Cannot find a SPIN template with qname service-sdl:HelloWorld]) or by adding a qname at: http://localhost:8083/tbl/template/service-sdl/HelloWorld? 
Gives me more or less the same error: Summary: [Cannot find a SPIN template with qname :HelloWorld]


I have spent more time than I care to admit fighting to get this working. I've refreshed the registries regularly and everything else that holds promise. But the fact is that I simply don't understand how the qname's are bound, how they can show in the web service docs but be unavailable.

It can't be this difficult, I know there is a bone-headed mistake I am making - but what?

-Adam

Holger Knublauch

unread,
Aug 31, 2016, 7:34:55 PM8/31/16
to topbrai...@googlegroups.com
Renaming the file to helloworld.spin.ttlx worked for me. Could you try that?

Also note that if you run this stand-alone, without the file in TBC-ME open, you will get a NullPointer because no query graph has been specified. Use the _base argument to pass that in, if you get to that stage.

Thanks
Holger
--
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.

Adam Kimball

unread,
Aug 31, 2016, 7:47:24 PM8/31/16
to TopBraid Suite Users
Thanks for the reply.

How does the name effect the binding of a template?  My plan was to group logically related templates together in a single file with a name that represents the use case or application that they enable. In my work now this means I have a named select template paired with a SWP/SWON element to fulfill some integration use case.  Does the name have a certain relationship to the qname?  Do the prefixes I declare in this file map to the qname of the template?

Mostly I want a sense of the underlying implementation so that I properly understand what is going on.

-Adam

Holger Knublauch

unread,
Aug 31, 2016, 7:50:47 PM8/31/16
to topbrai...@googlegroups.com
The file naming such as .spin. or .ui. determines whether a service is globally known to the system when called via the servlet. SPIN templates usually cannot depend on SWP/SWON, however SWP can reference SPIN, so a natural organization of your code would be to split it into multiple files - one for the (more general) SPIN modules and others for the SWP stuff. The SWP file can owl:import the SPIN file. That's also the way that we usually organize our code.

The name of the file has no relation with the qnames - that's an orthogonal topic.

Holger

Adam Kimball

unread,
Aug 31, 2016, 8:44:32 PM8/31/16
to topbrai...@googlegroups.com

Holger,

 

That helps a ton.  However, a couple more things come to mind:

 

1. Is there a difference between *.ui.* and *.spin.*  - are there other variants where the filename has implications on something?

2. How do prefix's work?  I'm not a big fan of having the templates (or swp modules) living global lives, I'd like them to at least be behind a namespace.  So in my simplistic example, I want to call /template/myPrefix/HelloWorld.  I've noticed some # prefix: <somePrefix> statements in the TTL - are these related?  How is the prefix shared with TBL?

 

Thanks a ton!

Adam

Holger Knublauch

unread,
Aug 31, 2016, 8:49:23 PM8/31/16
to topbrai...@googlegroups.com


On 1/09/2016 10:44, Adam Kimball wrote:

Holger,

 

That helps a ton.  However, a couple more things come to mind:

 

1. Is there a difference between *.ui.* and *.spin.*  - are there other variants where the filename has implications on something?


Yes there seems to be a difference in that the SPIN templates don't get registered from .ui. files.

Another one is .sms. for SPARQLMotion services (most of which can now also be expressed and used in SWP).


2. How do prefix's work?  I'm not a big fan of having the templates (or swp modules) living global lives, I'd like them to at least be behind a namespace.  So in my simplistic example, I want to call /template/myPrefix/HelloWorld.  I've noticed some # prefix: <somePrefix> statements in the TTL - are these related?  How is the prefix shared with TBL?


Whenever you use prefixes, make sure that these are unique, and no other file re-defines them with a different namespace. The # prefix line is not needed - it's just a hint for TopBraid so that it knows which prefix is defined in which file, without having to parse the whole file. The tbl/template servlet will recognize all prefixes defined in .spin. files.

HTH
Holger
Reply all
Reply to author
Forward
0 new messages