|
OK, I'm getting it now. The value of a
hasRestriction is a string, such as "( pm:fistName
minCard 1) and" that needs to be parsed to
get the constituent values. I'd suggest you create SPIN functions
that do this. The function is created by defining a subclass of
spin:Functions. Let's say its named getNumOfRestrictions. A
constraint, let's use sp:arg1 is defined for the function. This
will be the string to be parsed. The body of the function will
parse the string and get the number of restrictions value. Using
a regular _expression_ approach, the query body would look like: SELECT ?numRestrict WHERE { LET (?numRestrict := smf:regex("?arg1, ".* ([0-9]+ *)\\)$", "$1")) } ...where ?arg1 is defined as a spin:constraint for the function and the regex will find the last number, zero or more spaces and ')' in the string. You could also use tops:split or the smf: string functions, such as smf:indexOf to parse the string. Once the function is defined, it can be used in any SPARQL query. For example WHERE { ... ?thing pmda:hasRestriction ?Restr . LET (?numRestr := getNumOfRestrictions(?Restr)) . ... } ?thing pmda:hasRestriction ?Restr . Similar functions can be used to get other values in the restriction. For intersection and union, I'm still not quite clear, but you can parse the "and" or "or" and construct the logic. -- Scott On 3/3/11 10:47 PM, Guilherme Scomparim wrote: --Hi Scott, Sorry but I do not fully understand the question? pmda is just the prefix of my own model. The reason I am trying to do this is because I am trying to infer an executable model from metadata defined by Business Analysts. The idea is to capture the restrictions using a framework that provides a screen with a grid where each line has drop downs fields with Properties, Types of restrictions, values, “(“, “)”, “and/or”, with the possibility to include and delete lines in a simple way for an end user, and then infer the triples using the SPIN:constructs like this one I am trying to build. Then based on the fact that a particular pmda:State can have two or more pmda:State:Restriction I need to identify how many restrictions are for that state. I need to test in case the first restriction has “(“ and doesn’t have a “)” the next restriction until I find the “)”. I also need to identify the ways they are linked ( “and/or”) to create owl:intersectionOf and owl:unionOf between them Here is an example with two restrictions pm:Consumer a pmda:State hasRestriction “( pm:fistName minCard 1) and” hasRestriction “(om:hasOrder minCard 1 ) “ This is the reason I need to learn how to use something like for each in SPIN Thanks again, Guil On Mar 4, 2:43 pm, Scott Henninger <[email protected]> wrote:Does this have anything to do with OWL local restrictions? Specifically, is your pmda: prefix defined as "http://www.w3.org/ 2002/07/owl#"? -- Scott On Mar 3, 8:59 pm, Guilherme Scomparim <[email protected]> wrote:Hi Scott,Sorry to confuse things. To make easier, forget about the aggregation issue for now.Based on the triples that I sent before, I am already able to create the construct below and it creates all the restrictions correctly. 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 |
- [topbraid-users] Help in dealing with "recordsets... Guilherme Scomparim
- [topbraid-users] Re: Help in dealing with "r... Scott Henninger
- [topbraid-users] Re: Help in dealing with &qu... Guilherme Scomparim
- [topbraid-users] Re: Help in dealing with... Scott Henninger
- [topbraid-users] Re: Help in dealing ... Guilherme Scomparim
- Re: [topbraid-users] Re: Help in... Scott Henninger
- [topbraid-users] Re: Help in... Guilherme Scomparim
- [topbraid-users] Re: Hel... Scott Henninger
- [topbraid-users] Re: Hel... Guilherme Scomparim
- [topbraid-users] Re: Hel... Scott Henninger
- Re: [topbraid-users] Re: Help in dealing ... Holger Knublauch
