John; Thanks for the nice example. It really helps to have concrete
examples.
I think you've figured out BIND quite nicely, and there aren't any
differences between SELECT and CONSTRUCT at work here. The query
works fine and gives the expected results. The last bit you may want
to do, to remove the untyped literals you get, is to add a type triple
to the URI you create. I.e. use a CONSTRUCT that looks like the
following:
CONSTRUCT
{ ?this coreModel:source ?uri .
?uri a coreModel:fiddlestyx .
}
I'm not sure why you are getting an unregistered warning, but
spif:split is probably not want you want. It seems to me what you
want here is to just remove the trailing '#'. In that case, just use
fn:substring with fn:string-length or smf:lastIndexOf (e.g.: BIND
(fn:substring(?subString1, 1, smf:lastIndexOf(?subString1, "#")) AS ?
localName)
).
The reason being that spif:split is a magic property - you did get the
syntax right and no it can't be used with BIND. As opposed to a
function, which returns one value, a magic property, also known as a
property function, returns all matches. So spif:split is expected to
return more than one value - for example:
?str spif:split ("Hello World" " ")
...will return two bindings for ?str: "Hello" and "World". In your
case you had:
?localName spif:split ( "ndInTheWillows#" "#" ) .
...which returns one binding for ?localName: "ndInTheWillows". This
is only because there are no characters after the delimiter.
In the end, I think it all worked as you had designed. The only real
issue is to remember that globe icons simply mean that the resource
(URI) does not have a type triple, so Composer uses the a default
icon, which is a globe. It is perfectly legitimate to have an untyped
resource, but it often indicates that a type triple is missing, so
that's why it is a warning.
-- Scott
On Oct 12, 6:52 pm, John Perdoni <[email protected]> wrote:
> Hi I wonder if you could help yet again
>
> I am trying to write a spin:constructor that does the following
>
> 1)take the current instance ie. ?this ?this being
> <http://example.com/library/publishedBook/windInTheWillows#Paragraph_P...>
>
> 2) Get the namespace
> ie.http://example.com/library/publishedBook/windInTheWillows#
>
> 3) construct the following triple *?this model:source
> <http://example.com/library/publishedBook#windInTheWillows>* (ie. (not sure
> if this is the right terminolgy) go up a level from the instance and get
> the parent ontology <http://example.com/library/publishedBook> and create a
> subject ie *?this* a *predicate* of model:souce and an *object* that has a
> uri of <http://example.com/library/publishedBook#windInTheWillows>
>
> If I use the following select query , I get no problems
>
> SELECT *
> WHERE {
> BIND
> (afn:namespace(<http://example.com/library/publishedBook/windInTheWillows#Paragraph_P...>)
> AS ?nameSpace) .
> BIND (fn:substring(?nameSpace,1,42) AS ?subString).
> BIND (fn:substring(?nameSpace, 44) AS ?subString1) .
> ?localName spif:split ( ?subString1 "#" ) .
> BIND (?localName AS ?boundLocalName) .
> BIND (smf:buildURI("{?subString}#{?boundLocalName}") AS ?uri) .
>
> However if I use the following Construct query , I get inferences that are
> "Untyped Literal"
>
> CONSTRUCT {
> ?this coreModel:source ?uri .}
>
> WHERE {
> BIND (afn:namespace(?this) AS ?nameSpace) .
> BIND (fn:substring(?nameSpace,1,42) AS ?subString).
> BIND (fn:substring(?nameSpace, 44) AS ?subString1) .
> ?localName spif:split ( ?subString1 "#" ) .
> BIND (?localName AS ?boundLocalName) .
> BIND (smf:buildURI("{?subString}#{?boundLocalName}") AS ?uri) .
>
> }
>
> I think the problem lies in the spif:split function as I cannot seem to get
> this to work with a BIND , however much I try and work out the sytax I get
> the following error WARN [Thread-89] (E_Function.java:70) - URI
> <http://spinrdf.org/spif#split> has no registered function factory
>
> Please also bear in mind that I am not yet fully conversant of trully
> understand when BIND should be used. If there is a better way of taking an
> instance, getting its parent ontology from slash notation creating the
> triple I need then please correct my ignorence
>
> Regards again
>
> John
--
-- 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 Ensemble, SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en