Well, as a SPARQL query it (the suggested solution) worked perfectly, but 
when I put the same logic into a SPIN rule it didn't. Here is the context:

Sample list:

["TRANSDUCER"^^xsd:NMTOKEN, "PHYSICAL"^^xsd:NMTOKEN, 
"FUNCTION"^^xsd:NMTOKEN]


is what ?obj2 in the query below looks like (which is type rdf:List)


SPARQL query (works great):

*SELECT* ?o

*WHERE* {

    *?arg1* owl:equivalentClass ?obj .

    ?obj owl:oneOf ?obj2 .

    ?obj2 (rdf:rest)*/rdf:first ?o .

}


and ?o is then bound to 3 strings: TRANSDUCER, PHYSICAL, and FUNCTION.


If I put the same SPARQL query into a SPIN rule:


*SELECT* ?o

*WHERE* {

    *?arg1* owl:equivalentClass ?obj .

    ?obj owl:oneOf ?obj2 .

    ?obj2 (rdf:rest)*/rdf:first ?o .

}


and bind ?arg1 to the same object that I used in the SPARQL query, I get 
just TRANSDUCER as a result.


Very confusing. And what I want to do with this list of strings is to 
create a formatted string out of their combination. At first I thought I 
might be able to use spit:convertSPINRDFtoString in the SPARQL to create a 
string of strings and then operate on the new string. That didn't work 
because, even though the object I gave it is rdf:List the function 
complained that I was trying to convert a non list to a list. Then I 
thought I might try ui:concat but since my SPIN function isn't working it 
is hard to test this.


Question 1: Does anyone know why my SPARQL doesn't work in the SPIN 
function above?


Question 2: Has anyone need to and figured out how to build a formatted 
string without some complicated logic?


Thank as usual for any pointers...


Jack

On Saturday, January 24, 2015 at 8:16:17 PM UTC-8, Jack Hodges wrote:
>
> Thank you Scott, did the trick perfectly.
>
> Jack
>
> On Monday, January 19, 2015 at 2:24:11 PM UTC-8, Scott Henninger wrote:
>>
>> Jack; No reason to use spif:split, given that the data is already in RDF. 
>> Something like the following should work:
>>
>> SELECT ?str
>> WHERE
>> {  ...
>>    ?s rdf:rest*/rdf:first ?o .
>>     BIND (xsd:string(?o) AS ?str)
>> }
>>
>> The rdf:rest*/rdf:first idiom will de-construct the RDF list into 
>> elements.
>>
>> -- Scott
>>
>> Sent from my iPhone
>>
>> On Jan 19, 2015, at 3:00 PM, Jack Hodges <[email protected]> wrote:
>>
>> I have a list of xsd:NMTOKENs that I want to render (using SWP) in a 
>> table or chart. These items are in an owl:equivalentClass as owl:oneOf 
>> items (an enumerated type). I tried breaking them up with spif:split (oops, 
>> not a string), and spif:foreach but neither worked. Here is an example list:
>>
>> ["FOO"^^xsd:NMTOKEN,
>>
>> "BAR"^^xsd:NMTOKEN,
>>
>> "BAZ"^^xsd:NMTOKEN]
>>
>>
>> With other ways of modeling enumerated types (e.g., by representing FOO 
>> as an instance) I can do this, but this modeling approach was used by 
>> someone else.
>>
>>
>> Is there a way to de-list these items in a SPARQL query?
>>
>>
>> Thanks,
>>
>>
>> Jack
>>
>> -- 
>> You received this message because you are subscribed to the Google Group 
>> "TopBraid Suite Users", the topics of which include Enterprise Vocabulary 
>> Network (EVN), Reference Data Manager (RDM), TopBraid Composer, TopBraid 
>> Live, TopBraid Insight, SPARQLMotion, SPARQL Web Pages and SPIN.
>> To post to this group, send email to [email protected]
>> --- 
>> 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 [email protected].
>> 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), Reference Data Manager (RDM), TopBraid Composer, TopBraid Live, 
TopBraid Insight, SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to [email protected]
--- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to