One task in five languages
Content may include inaccuracies, outdated information, or technical errors. Users are advised to cross-check critical information before implementation.
The same question written in every language. In every example self is an
ArchiMate element, and in SPARQL it is ?self.
Does the element carry a name
| Language | Expression |
|---|---|
| AQL | self.name <> null and self.name.trim().size() > 0 |
| OCL | self.name <> null and self.name.size() > 0 |
| EOL | self.name.isDefined() and self.name.trim() <> '' |
| CEL | self.name != "" |
| SPARQL | ASK { ?self archimate:Nameable.name ?name . |
Is the element connected to anything
| Language | Expression |
|---|---|
| AQL | self.incomingRelationships->notEmpty() or self.outgoingRelationships->notEmpty() |
| OCL | self.incomingRelationships->notEmpty() or self.outgoingRelationships->notEmpty() |
| EOL | not self.incomingRelationships.isEmpty() or not self.outgoingRelationships.isEmpty() |
| CEL | self.incomingRelationships.size() > 0 || self.outgoingRelationships.size() > 0 |
| SPARQL | ASK { |
The names of everything the element points at
| Language | Expression |
|---|---|
| AQL | self.outgoingRelationships->collect(r | r.target.name) |
| OCL | self.outgoingRelationships->collect(r | r.target.name) |
| EOL | self.outgoingRelationships.collect(r | r.target.name) |
| CEL | self.outgoingRelationships.map(r, r.target.name) |
| SPARQL | SELECT ?name WHERE { |
Collection operations are written with -> in AQL and OCL, with a dot in EOL,
and as macros in CEL; SPARQL returns rows instead of a collection.
Is the owner property set exactly once
| Language | Expression |
|---|---|
| AQL | self.properties->select(p | p.key = 'owner')->size() = 1 |
| OCL | self.properties->select(p | p.key = 'owner')->size() = 1 |
| EOL | self.properties.select(p | p.key = 'owner').size() = 1 |
| CEL | self.properties.exists_one(p, p.key == "owner") |
| SPARQL | ASK { |
Note the equality operators: = in AQL, OCL and EOL, == in CEL, and a pattern
match in SPARQL.
Trim a stray space out of the name
Only two languages change a model, so this task has two answers.
| Language | Expression |
|---|---|
| EOL | self.name = self.name.trim(); |
| SPARQL | DELETE { GRAPH ?g { ?self archimate:Nameable.name ?name } } |
In the update, ?g is bound to the graph of the model along with ?self.
The same body written in AQL, OCL or CEL is rejected where a change is required, and never touches the model where it is accepted.