Note correction below...

Sent from my iPhone

> On Sep 28, 2015, at 7:53 PM, Mark Feblowitz <[email protected]> wrote:
> 
> I have need to identify 0 or more type resources from a given set  as having 
> been asserted as types of a given subject entity;  if none matches, I’d like 
> to bind some default resource to symbol a non-match.
> 
> So, I have a set of “whitelisted” types
> 
>    VALUES ?entType { ex:T1 ex:T2 ex:T3 }
> 
> and  I’m looking to match an entity against those types in this way:
> 
>    ?E a ?entType.
> 
> It’s fine to match more than one (although I’d rather not, but that’s a 
> separate discussion).
> 
> In cases where there’s no match, I’d then like to force bind ?entType to, 
> e.g., ex:T0 or owl:Thing.
> 
> To survive a non-match, the type match would likely need to be wrapped in an 
> OPTIONAL block, likely with the VALUES statement in there too(?):
> 
>    OPTIONAL {
>        VALUES ?entTypeS { ex:T1 ex:T2 ex:T3 }
>        ?E a ?entTypeS.
>        }
> 
> (Note the “S” in ?entTypeS - that’s for the next bit).
> 
> I’ve tried a conditional BIND
>    BIND(IF(BOUND(?entType), ?entType, ex:T0) as ?entType) 

  BIND(IF(BOUND(?entTypeS), ?entTypeS, ex:T0) as ?entType)

> 
> and also s COALESCE
>    BIND(COALESCE(?entTypeS, ex:T0) as ?entType)
> 
> 
> But it seems that neither works as I’d like.  I appears that, even though 
> optional, the test against the VALUES set acts as a constraint.
> 
> I’ve also tried a FILTER, with 
> 
>    FILTER ( ?E1T in ( ex:T1, ex:T2, ex:T3 )) 
>    BIND(COALESCE(?E1T, ex:T0) as ?E1Type)
> 
> That’s not even getting to executing (yet) - some non-parsing error on 
> DBPedia Live. 
> 
> Have I stated the problem clearly enough? What might be other ways to address 
> this?
> 
> Thanks,
> 
> Mark
> 

Reply via email to