From 60f01f46ba232ed6416054f0a6115cb2a9b70b4e Mon Sep 17 00:00:00 2001 From: OszkarSemerath Date: Sat, 10 Jun 2017 19:05:05 +0200 Subject: Migrating Additional projects --- .../alloy/reasoner/queries/signatureQueries.vql | 17 +++++ .../alloy/reasoner/queries/typeQueries.vql | 85 ++++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/queries/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/queries/signatureQueries.vql create mode 100644 Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/queries/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/queries/typeQueries.vql (limited to 'Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/queries') diff --git a/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/queries/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/queries/signatureQueries.vql b/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/queries/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/queries/signatureQueries.vql new file mode 100644 index 00000000..a020953c --- /dev/null +++ b/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/queries/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/queries/signatureQueries.vql @@ -0,0 +1,17 @@ +package hu.bme.mit.inf.dlsreasoner.alloy.reasoner.queries + +import epackage "http://www.bme.hu/mit/inf/dslreasoner/AlloyLanguage" + +pattern directSubset(x: ALSSignatureDeclaration, y: ALSSignatureDeclaration) { + ALSSignatureBody.declarations(b,y); + ALSSignatureBody.supertype(b,x); +} or { + ALSSignatureBody.declarations(b,y); + ALSSignatureBody.superset(b,x); +} + +pattern subset(x: ALSSignatureDeclaration, y: ALSSignatureDeclaration) { + x == y; +} or { + find directSubset+(x,y); +} diff --git a/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/queries/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/queries/typeQueries.vql b/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/queries/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/queries/typeQueries.vql new file mode 100644 index 00000000..8d93cafb --- /dev/null +++ b/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/queries/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/queries/typeQueries.vql @@ -0,0 +1,85 @@ +package hu.bme.mit.inf.dlsreasoner.alloy.reasoner.queries + +import epackage "http://www.bme.hu/mit/inf/dslreasoner/logic/model/language" + +private pattern supertypeEdge(type1: Type, type2: Type) { + Type.supertypes(type1,type2); +} + +pattern supertype(type1: Type, type2: Type) { + type1 == type2; +} or { + find supertypeEdge+(type1,type2); +} + +private pattern commonSubtype(type1: Type, type2: Type, common: Type) { + find supertype(common,type1); + find supertype(common,type2); +} + +private pattern commonSupertype(type1: Type, type2: Type, common: Type) { + find supertype(common,type1); + find supertype(common,type2); +} + +private pattern hasHigherCommonSubtype(type1: Type, type2: Type, common: Type, higher: Type) { + find supertype(higher,type1); + find supertype(higher,type2); + Type.supertypes(common,higher); + higher != common; +} + +private pattern hasLowerCommonSupertype(type1: Type, type2: Type, common: Type, lower: Type) { + find supertype(type1,lower); + find supertype(type2,lower); + Type.supertypes(lower,common); + lower != common; +} + +pattern topmostCommonSubtypes(type1: Type, type2: Type, common: Type) { + find commonSubtype(type1, type2, common); + neg find hasHigherCommonSubtype(type1, type2, common, _); +} + +pattern lowermostCommonSupertype(type1: Type, type2: Type, common: Type) { + find commonSupertype(type1, type2, common); + neg find hasLowerCommonSupertype(type1, type2, common, _); +} +/*pattern topmostCommonSubtypesInObject(type1: Type, type2: Type, common: Type) { + find commonSubtype(type1, type2, common); + neg find supertypeEdge(type1,_); + neg find supertypeEdge(type2,_); + neg find hasHigherCommonSubtype(type1, type2, common, _); +} +pattern topmostCommonSubtypesInType(in: Type, type1: Type, type2: Type, common: Type) { + find commonSubtype(type1, type2, common); + find supertypeEdge(type1,in); + find supertypeEdge(type2,in); + neg find hasHigherCommonSubtype(type1, type2, common, _); +} + */ + +pattern lowestCommonSupertypeOfAllOccuranceOfElement(element: DefinedElement, type: Type) { + find typeContainsAllOccuranceOfElement(element,type); + neg find hasLowerCommonSupertypeOfAllOccuranceOfElement(element, type, _); +} + +private pattern hasLowerCommonSupertypeOfAllOccuranceOfElement(element: DefinedElement, type: Type, lower: Type) { + find typeContainsAllOccuranceOfElement(element, type); + find typeContainsAllOccuranceOfElement(element, lower); + find supertype(lower, type); + type != lower; +} + +private pattern typeContainsAllOccuranceOfElement(element: DefinedElement, type: Type) { + find supertype(containerType,type); + TypeDefinition.elements(containerType,element); + neg find typeDoesNotCoverElementOccurance(element,type,_); +} + +private pattern typeDoesNotCoverElementOccurance(element: DefinedElement, type: Type, uncoveredOccurance: TypeDefinition) { + find supertype(containerType,type); + TypeDefinition.elements(containerType,element); + TypeDefinition.elements(uncoveredOccurance,element); + neg find supertype(uncoveredOccurance,type); +} \ No newline at end of file -- cgit v1.2.3-54-g00ecf