While there are general caveats to think in terms of a declarative language 
instead of a procedural language, I think Adam's query is just fine. On bit is 
that to remain SPARQL compliant, you should use BIND.  I.e.:
  BIND (IF( ?aVal > ?bVal, 
"conditionaltest:PersonTypeA","conditionaltest:PersonTypeB") AS ?type)

-- Scott

On Dec 14, 2012, at 10:35 AM, tk blast <[email protected]> wrote:

> You are using the right tool (SPIN) for 'counting' because you really have to 
> take the scenic route in RDF/OWL to perform what is built-in to most other 
> data modeling.
> 
> Having said that, I am always astonished when people first start with 
> semantic modeling because 99% of the time its an example that includes 
> 'counting' and the semantics of ordinatlity and cardinality.  '5' is just a 
> symbol that is a member of the set integer.   I encourage you to explore 
> semantic technology like the Matrix and get under all the data modeling 
> assumptions that come with constructs like 'whole numbers'.  "There is no 
> spoon"
> 
> Just my '2' cents
> --tk
> 
> Ct..
> On Fri, Dec 14, 2012 at 8:49 AM, Adam Montville <[email protected]> 
> wrote:
>> I guess I figured out my own problem.  I did not realize (new to TBC and 
>> Semantics in general) that I could simply craft the following query to get 
>> the assertion I need:
>> 
>> CONSTRUCT {
>>      conditionaltest:Person_1 rdfs:subClassOf ?type .
>> }
>> WHERE {
>>      conditionaltest:Person_1 conditionaltest:hasIntegerAValue ?aVal .
>>      conditionaltest:Person_1 conditionaltest:hasIntegerBValue ?bVal .
>>      LET(?type := IF( ?aVal > ?bVal, 
>> "conditionaltest:PersonTypeA","conditionaltest:PersonTypeB"))
>> }
>> 
>> 
>> But, perhaps there are other ways to accomplish this that are better for one 
>> reason or another?
>> 
>> Adam
>> 
>> On Friday, December 14, 2012 6:07:57 AM UTC-8, Adam Montville wrote:
>>> 
>>> Hey everyone.  I'm working on a "for fun" model and application.  I have a 
>>> situation where a Person has four integer properties, and, depending on 
>>> which of those four integers is the largest, that Person should be a 
>>> specific subclass of Person.  I'm trying to figure out how to accomplish 
>>> this, but am stuck.  
>>> 
>>> For the sake of the discussion, let's say I have the following:
>>> 
>>> conditionaltest:Person
>>>       a       owl:Class ;
>>>       rdfs:subClassOf owl:Thing .
>>> 
>>> 
>>> conditionaltest:PersonTypeA
>>>       a       owl:Class ;
>>>       rdfs:subClassOf conditionaltest:Person .
>>> 
>>> 
>>> conditionaltest:PersonTypeB
>>>       a       owl:Class ;
>>>       rdfs:subClassOf conditionaltest:Person .
>>> 
>>> 
>>> conditionaltest:hasIntegerAValue
>>>       a       owl:DatatypeProperty ;
>>>       rdfs:range xsd:integer .
>>> 
>>> 
>>> conditionaltest:hasIntegerBValue
>>>       a       owl:DatatypeProperty ;
>>>       rdfs:range xsd:integer .
>>> 
>>> 
>>> conditionaltest:Person_1
>>>       a       conditionaltest:Person ;
>>>       conditionaltest:hasIntegerAValue
>>>               5 ;
>>>       conditionaltest:hasIntegerBValue
>>>               10 .
>>> 
>>> 
>>> 
>>> Now what I want to do is, based on the fact that 10 is greater than 5, 
>>> assert: conditionaltest:Person_1 rdfs:subClassOf 
>>> conditionaltest:PersonTypeB .
>>> 
>>> Any thoughts on how this can be done using a SPARQL CONSTRUCT, SPIN, or 
>>> SPARQL Motion?  I thought about using a SPARQL IF, but can't figure out how 
>>> to make an assertion based on a returned value from that (would be great if 
>>> we could make conditional assertions inside the IF block).
>>> 
>>> Adam
>> 
>> -- 
>> -- 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
> 
> 
> 
> -- 
> 
> "Logic is in the eye of the Logician" --G. Steinem
> -- 
> -- 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
>  
>  

-- 
-- 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


Reply via email to