Arthur; So let's say :vertexCoordinates takes an argument (?arg1) and
returns 4 parameters.  The magic property definition would look like:
  SELECT ?i ?x ?y ?z
  WHERE
   { ?arg1 :prop1 ?i
      ...
   }

and the triple pattern would be:
  ?ngon :vertexCoordinates (?i ?x ?y ?z)

As an example, that anyone on Composer can try out, follow these steps
in the kennedysSPIN file in the TBC library example:

 1. Create a subclass of spin:MagicProperties (subclass of
spin:Modules/spin:Functions), name it getNamesOfPerson
 2. Create a constraint from the spl:Argument template using sp:arg1
(optionally restrict the valueType to :Person)
 3. Place the following query in the spin:body
   SELECT ?fname ?lname ?name
   WHERE {
       ?arg1 kennedys:name ?name .
       ?arg1 kennedys:firstName ?fname .
       ?arg1 kennedys:lastName ?lname .
   }

While in kennedysSPIN execute the following query:

SELECT *
WHERE {
   ?person a kennedys:Person .
   ?person kspin:getNamesOfPerson (?first ?last ?full)
}

This will give a result set with ?first, ?last, ?full bound for each
binding to ?person from the first triple pattern (i.e. "?person a
kennedys:Person").

-- Scott

On Jun 10, 1:10 pm, Arthur Keen <[email protected]> wrote:
> For multiple bindings,
>
> SELECT *
> WHERE {
>    ?x tops:split ("John Jacob Jingle Ivor Schmidt" " ")
>
> }
>
> parses and successively binds ?x to the tokens in the string.
>
> If there are multiple return values and multiple bindings from the magic 
> property, for example (I am making this up on the fly) , if I want to access 
> the coordinates of vertex loop of a polygon using a magic property 
> :vertexCoordinates that accesses the vertices of the polygon and returns 
> their coordinates:
>
> SELECT *
> WHERE {
> ?ngon a :Polygon
> (?i ?x ?y ?z) :vertexCoordinates (?ngon).
>
> } ORDER BY ?i
>
>  ?i  ?x  ?y  ?z ?ngon
>  0   1    0    0   p1
>  1   0    1    0   p1
>  2   ...
>
> On Jun 10, 2010, at 12:30 PM, Scott Henninger wrote:
>
> > Arthur; I've always found top:split to be a good example of how this
> > works.  Try the following on the kennedys model:
>
> > SELECT *
> > WHERE {
> >    ?person kennedys:name ?name .
> >    ?x tops:split (?name " ")
> > }
>
> > It's also a god example of what a magic property does.  It creates
> > multiple bindings for the variable.  I say this because it seems like
> > the example you gave earlier should be applied via  SPIN function
> > because it would only generate one binding.  Then the syntax would be:
> >  LET ?name := apf:concat(?firstName, ?lastName))
>
> > (...or did you mean fn:concat()?)
>
> > -- Scott
>
> > On Jun 10, 12:47 am, Holger Knublauch <[email protected]> wrote:
> >> Yes, this is correct. Furthermore, a magic property can also have multiple 
> >> variables on the left side, for each SELECT ?x ?y ?z variable.
>
> >> Syntactically, the (...) is a short notation for RDF lists, BTW.
>
> >> Holger
>
> >> On Jun 10, 2010, at 3:32 PM, Arthur Keen wrote:
>
> >>> In the SPIN documentation, there is a statement "Magic properties can 
> >>> also take multiple arguments ..."  What is the syntax for passing in the 
> >>> other arguments.
> >>> The example  ?name apf:concat (?firstName ?lastName), indicates the 
> >>> syntax is:  object propertyfunction (arg1 arg2), is that right?
>
> >>> Arthur
>
> >>> --
> >>> You received this message because you are subscribed to the Google
> >>> Group "TopBraid Suite Users", the topics of which include TopBraid 
> >>> Composer,
> >>> TopBraid Live, TopBraid Ensemble, SPARQLMotion 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
>
> > --
> > You received this message because you are subscribed to the Google
> > Group "TopBraid Suite Users", the topics of which include TopBraid Composer,
> > TopBraid Live, TopBraid Ensemble, SPARQLMotion 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

-- 
You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include TopBraid Composer,
TopBraid Live, TopBraid Ensemble, SPARQLMotion 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

Reply via email to