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.

Reply via email to