Skip to content

Commit

Permalink
Moved to Tonel 3
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Jun 18, 2024
1 parent 9952dd3 commit cdaf411
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 73 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Class {
#name : #BaselineOfOntoUMLModelQuery,
#superclass : #BaselineOf,
#category : #BaselineOfOntoUMLModelQuery
#name : 'BaselineOfOntoUMLModelQuery',
#superclass : 'BaselineOf',
#category : 'BaselineOfOntoUMLModelQuery',
#package : 'BaselineOfOntoUMLModelQuery'
}

{ #category : #baselines }
{ #category : 'baselines' }
BaselineOfOntoUMLModelQuery >> baseline: spec [
<baseline>
spec
Expand Down
2 changes: 1 addition & 1 deletion BaselineOfOntoUMLModelQuery/package.st
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Package { #name : #BaselineOfOntoUMLModelQuery }
Package { #name : 'BaselineOfOntoUMLModelQuery' }
57 changes: 29 additions & 28 deletions OntoUML-ModelQuery/OntoUMLModelQuery.class.st
Original file line number Diff line number Diff line change
@@ -1,71 +1,72 @@
Class {
#name : #OntoUMLModelQuery,
#superclass : #Object,
#name : 'OntoUMLModelQuery',
#superclass : 'Object',
#traits : 'TProfileGatherer',
#classTraits : 'TProfileGatherer classTrait',
#category : #'OntoUML-ModelQuery'
#category : 'OntoUML-ModelQuery',
#package : 'OntoUML-ModelQuery'
}

{ #category : #generalizations }
{ #category : 'generalizations' }
OntoUMLModelQuery class >> getAncestorsFor: aChild [
| ancestorSet |
ancestorSet := Set new.
self getAncestorsFor: aChild into: ancestorSet.
^ ancestorSet.
]

{ #category : #generalizations }
{ #category : 'generalizations' }
OntoUMLModelQuery class >> getAncestorsFor: aTarget into: aAncestorsSet [
aTarget generalizations do: [ :generalization |
(aAncestorsSet includes: generalization general) ifFalse: [
aAncestorsSet add: generalization general.
self getAncestorsFor: generalization general into: aAncestorsSet. ]. ].
]

{ #category : #associations }
{ #category : 'associations' }
OntoUMLModelQuery class >> getAssociationName: aAssociation [
^ ((aAssociation memberEnds at: 1) type name) , '->' , ((aAssociation memberEnds at: 2) type name).
]

{ #category : #associations }
{ #category : 'associations' }
OntoUMLModelQuery class >> getAssociationsFrom: aModel [
^ (aModel select: [ :object | object isKindOf: OPUMLAssociation. ]).
]

{ #category : #associations }
{ #category : 'associations' }
OntoUMLModelQuery class >> getAssociationsFrom: aModel filterBy: aBlockFilter [
^ (self getAssociationsFrom: aModel) select:
[ :association | aBlockFilter value: association ].
]

{ #category : #associations }
{ #category : 'associations' }
OntoUMLModelQuery class >> getAssociationsFrom: aModel withStereotype: aStereotypeClass [
^ (aModel select: [ :object | object isKindOf: OPUMLAssociation. ])
select: [ :association | (self getStereotypeClass: association) = aStereotypeClass ].
]

{ #category : #associations }
{ #category : 'associations' }
OntoUMLModelQuery class >> getAssociationsFrom: aModel withStereotype: aStereotypeClass filterBy: aBlockFilter [
^ (self getAssociationsFrom: aModel withStereotype: aStereotypeClass)
select: [ :association | aBlockFilter value: association ].
]

{ #category : #generalizations }
{ #category : 'generalizations' }
OntoUMLModelQuery class >> getChildrenOf: aParent from: aModel [
^ (self getGeneralizationsFrom: aModel filterBy:
[ :generalization | generalization general = aParent ])
collect: [ :generalization | generalization specific. ].
]

{ #category : #generalizations }
{ #category : 'generalizations' }
OntoUMLModelQuery class >> getDescendantsFor: aAncestor from: aModel [
| childrenSet |
childrenSet := Set new.
self getDescendantsFor: aAncestor from: aModel into: childrenSet.
^ childrenSet
]

{ #category : #generalizations }
{ #category : 'generalizations' }
OntoUMLModelQuery class >> getDescendantsFor: aTarget from: aModel into: aChildrenSet [
((aModel select: [ :object | object isKindOf: OPUMLGeneralization ])
select: [ :generalization | generalization general = aTarget ])
Expand All @@ -78,86 +79,86 @@ OntoUMLModelQuery class >> getDescendantsFor: aTarget from: aModel into: aChildr
into: aChildrenSet ] ].
]

{ #category : #entities }
{ #category : 'entities' }
OntoUMLModelQuery class >> getEntitiesFrom: aModel [
^ aModel select: [ :object | object isKindOf: OPUMLClass. ].
]

{ #category : #entities }
{ #category : 'entities' }
OntoUMLModelQuery class >> getEntitiesFrom: aModel filterBy: aBlockFilter [
^ (self getEntitiesFrom: aModel) select: [ :element | aBlockFilter value: element. ].
]

{ #category : #entities }
{ #category : 'entities' }
OntoUMLModelQuery class >> getEntitiesFrom: aModel withStereotype: aStereotypeClass [
^ (aModel select: [ :object | object isKindOf: OPUMLClass. ])
select: [ :entity | (self getStereotypeClass: entity) = aStereotypeClass ].
]

{ #category : #entities }
{ #category : 'entities' }
OntoUMLModelQuery class >> getEntitiesFrom: aModel withStereotype: aStereotypeClass filterBy: aBlockFilter [
^ (self getEntitiesFrom: aModel withStereotype: aStereotypeClass)
select: [ :entity | aBlockFilter value: entity ].
]

{ #category : #generalizations }
{ #category : 'generalizations' }
OntoUMLModelQuery class >> getGeneralizationSetsFrom: aModel [
^ (aModel select: [ :object | object isKindOf: OPUMLGeneralizationSet. ]) asSet.
]

{ #category : #generalizations }
{ #category : 'generalizations' }
OntoUMLModelQuery class >> getGeneralizationsFrom: aModel [
^ ((self getEntitiesFrom: aModel) flatCollect: [ :object | object generalizations ]) asSet.
]

{ #category : #generalizations }
{ #category : 'generalizations' }
OntoUMLModelQuery class >> getGeneralizationsFrom: aModel filterBy: aBlockFilter [
^ (self getGeneralizationsFrom: aModel) select:
[ :generalization | aBlockFilter value: generalization ].


]

{ #category : #generalizations }
{ #category : 'generalizations' }
OntoUMLModelQuery class >> getGeneralizationsWithoutGenSetsFrom: aModel [
| generalizations |
generalizations := (self getEntitiesFrom: aModel) flatCollect: [ :object | object generalizations ].
^ (generalizations select: [ :generalization | generalization generalizationSets isEmpty. ]) asSet.
]

{ #category : #generalizations }
{ #category : 'generalizations' }
OntoUMLModelQuery class >> getParentsOf: aChild [
^ aChild generalizations collect: [ :generalization | generalization general. ].
]

{ #category : #associations }
{ #category : 'associations' }
OntoUMLModelQuery class >> getSourceEndFrom: aAssociation [
^ aAssociation memberEnds first.
]

{ #category : #associations }
{ #category : 'associations' }
OntoUMLModelQuery class >> getSourceFrom: aAssociation [
^ (self getSourceEndFrom: aAssociation) type.
]

{ #category : #associations }
{ #category : 'associations' }
OntoUMLModelQuery class >> getTargetEndFrom: aAssociation [
^ aAssociation memberEnds second.
]

{ #category : #associations }
{ #category : 'associations' }
OntoUMLModelQuery class >> getTargetFrom: aAssociation [
^ (self getTargetEndFrom: aAssociation) type.
]

{ #category : #'accessing - stereotypes' }
{ #category : 'accessing - stereotypes' }
OntoUMLModelQuery class >> is: aStereotype oclKindOf: aStereotypeName [
aStereotype ifNil: [ ^false. ].
"else"
^ aStereotype oclIsKindOf: aStereotypeName.
]

{ #category : #'accessing - stereotypes' }
{ #category : 'accessing - stereotypes' }
OntoUMLModelQuery class >> isStereotypeOf: aObject oclKindOf: aStereotypeName [
| stereotype |
stereotype := (self getStereotype: aObject).
Expand Down
Loading

0 comments on commit cdaf411

Please sign in to comment.