Revision 8a57f3b03992351f46c4537fd0d9351592278d2b (click the page title to view the current version)

oclBench/b1

Changes from 8a57f3b03992351f46c4537fd0d9351592278d2b to b3d79c7d55b72eb9c40f885cbb3277fe1cedc83f
---
title: OCL Benchmark B1
...


```{.clafer}
abstract Person
	name : string
	civstat : string
	gender : string
	alive ?
	husband -> Person ?
		[parent in this.wife]
	wife -> Person ?
		[parent in this.husband]
	[civstat = "single" || civstat ="married"|| civstat ="divorced"|| civstat = "widowed"]	
	[gender = "female"|| gender ="male"]
	[all p:Person|this != p =>  this.name.ref!=p.name.ref]
	[one p:Person|p.name.ref = this.name.ref]	
    name : string
    civstat : string
    gender : string
    alive ?
    husband -> Person ?
        [parent in this.wife]
    wife -> Person ?
        [parent in this.husband]
    [civstat = "single" || civstat ="married"|| civstat ="divorced"|| civstat = "widowed"]
    [gender = "female"|| gender ="male"]
    [all p:Person|this != p =>  this.name.ref!=p.name.ref]
    [one p:Person|p.name.ref = this.name.ref]

ada : Person
	[name = "Ada"
	civstat = "widowed"
	gender = "female"
	alive
	no husband
	no wife
	]
    [name = "Ada"
     civstat = "widowed"
     gender = "female"
     alive
     no husband
     no wife
     ]

cyd : Person
	[name = "Cyd"
	civstat = "married"
	gender = "male"
	no alive
	no husband
	no wife
	]
    [name = "Cyd"
     civstat = "married"
     gender = "male"
     no alive
     no husband
     no wife
     ]

eve : Person
	[name = "Eve"
	civstat = "married"
	gender = "female"
	alive
	husband = dan
	no wife
	]
    [name = "Eve"
     civstat = "married"
     gender = "female"
     alive
     husband = dan
     no wife
     ]

bob : Person
	[name = "Bob"
	civstat = "divorced"
	gender = "male"
	alive
	no husband
	no wife]
    [name = "Bob"
     civstat = "divorced"
     gender = "male"
     alive
     no husband
     no wife]

dan : Person
	[name = "Dan"
	civstat = "married"
	gender = "male"
	alive
	no husband
	wife = eve]
    [name = "Dan"
     civstat = "married"
     gender = "male"
     alive
     no husband
     wife = eve]
[adaBobCyd.name = stringSet1]
[personWithUndefinedHusband1.name = stringSet2]
[personWithUndefinedHusband2.name = stringSet2]
[possiblePairs.first.name = "Ada" && possiblePairs.second.name = "Bob"]

adaBobCyd -> Person *
	[this.name in stringSet1]
    [this.name in stringSet1]
[all p:Person|p.name in stringSet1 => p in adaBobCyd]

personWithUndefinedHusband1 -> Person *
	[this.husband = emptyPersonSet1]
    [this.husband = emptyPersonSet1]
[all p:Person|p.husband = emptyPersonSet1 => p in personWithUndefinedHusband1]

personWithUndefinedHusband2 -> Person *
	[this.husband = emptyPersonSet2]
    [this.husband = emptyPersonSet2]
[all p:Person|p.husband = emptyPersonSet2 => p in personWithUndefinedHusband2]

personWithNoWife -> Person *
	[no this.wife]
    [no this.wife]
[all p:Person|((no p.wife) => (p in personWithNoWife))]

emptyPersonSet1 -> Person *
[emptyPersonSet1 = personWithNoWife.wife]

emptyPersonSet2 -> Person *
	[1 > 2]
    [1 > 2]


personPair *
	first -> Person
	second -> Person
	
    first -> Person
    second -> Person

possiblePairs -> personPair *
	[this.first.gender = "female" && this.first.alive && this.first.civstat!="married"
	this.second.gender = "male" && this.second.alive && this.second.civstat!="married"]
    [this.first.gender = "female" && this.first.alive && this.first.civstat!="married"
     this.second.gender = "male" && this.second.alive && this.second.civstat!="married"]
[all p;q:Person|(p.gender = "female" && p.alive && p.civstat!="married" && q.gender = "male" && q.alive && q.civstat!="married") => (one pair:personPair|pair.first = p && pair.second = q && pair in possiblePairs)]
	


stringSet1 -> string 3
	[this="Ada" || this="Bob"||this="Cyd"]
    [this="Ada" || this="Bob"||this="Cyd"]
stringSet2 -> string 4
	[this="Ada" || this="Bob"||this="Cyd"||this="Dan"]
    [this="Ada" || this="Bob"||this="Cyd"||this="Dan"]

```

```{.clafer .summary}
```