diff options
author | 2020-06-25 19:55:10 +0200 | |
---|---|---|
committer | 2020-06-25 19:55:10 +0200 | |
commit | c3a6d4b9cf3657070d180aa65ddbf0459e880329 (patch) | |
tree | 780c4fc61578dcb309af53fb0c164c7627e51676 /Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner | |
parent | New configuration language parser WIP (diff) | |
parent | Scope unsat benchmarks (diff) | |
download | VIATRA-Generator-c3a6d4b9cf3657070d180aa65ddbf0459e880329.tar.gz VIATRA-Generator-c3a6d4b9cf3657070d180aa65ddbf0459e880329.tar.zst VIATRA-Generator-c3a6d4b9cf3657070d180aa65ddbf0459e880329.zip |
Merge branch 'kris'
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner')
1 files changed, 18 insertions, 5 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/InstanceModel2PartialInterpretation.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/InstanceModel2PartialInterpretation.xtend index 8aaaacb5..cb5b587f 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/InstanceModel2PartialInterpretation.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/InstanceModel2PartialInterpretation.xtend | |||
@@ -1,5 +1,6 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic | 1 | package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic |
2 | 2 | ||
3 | import com.google.common.collect.ImmutableList | ||
3 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic | 4 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic |
4 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace | 5 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace |
5 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput | 6 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput |
@@ -12,18 +13,18 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.Par | |||
12 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.Problem2PartialInterpretationTrace | 13 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.Problem2PartialInterpretationTrace |
13 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialRelationInterpretation | 14 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialRelationInterpretation |
14 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationFactory | 15 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationFactory |
16 | import java.math.BigDecimal | ||
15 | import java.util.HashMap | 17 | import java.util.HashMap |
18 | import java.util.HashSet | ||
16 | import java.util.List | 19 | import java.util.List |
17 | import java.util.Map | 20 | import java.util.Map |
21 | import java.util.Set | ||
18 | import org.eclipse.emf.common.util.Enumerator | 22 | import org.eclipse.emf.common.util.Enumerator |
23 | import org.eclipse.emf.ecore.EAttribute | ||
19 | import org.eclipse.emf.ecore.EObject | 24 | import org.eclipse.emf.ecore.EObject |
20 | import org.eclipse.emf.ecore.resource.Resource | 25 | import org.eclipse.emf.ecore.resource.Resource |
21 | 26 | ||
22 | import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* | 27 | import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* |
23 | import java.util.HashSet | ||
24 | import java.util.Set | ||
25 | import java.math.BigDecimal | ||
26 | import org.eclipse.emf.ecore.EAttribute | ||
27 | 28 | ||
28 | class InstanceModel2PartialInterpretation { | 29 | class InstanceModel2PartialInterpretation { |
29 | val extension LogiclanguageFactory factory = LogiclanguageFactory.eINSTANCE | 30 | val extension LogiclanguageFactory factory = LogiclanguageFactory.eINSTANCE |
@@ -36,7 +37,19 @@ class InstanceModel2PartialInterpretation { | |||
36 | Resource resource, | 37 | Resource resource, |
37 | boolean withID) | 38 | boolean withID) |
38 | { | 39 | { |
39 | val objects = resource.allContents.toList | 40 | val objectsBuilder = ImmutableList.builder |
41 | val treeIterator = resource.allContents | ||
42 | val referencesUsed = ecore2Logic.allReferencesInScope(metamodelTranslationResult.trace).toSet | ||
43 | while (treeIterator.hasNext) { | ||
44 | val object = treeIterator.next | ||
45 | val containingReference = object.eContainmentFeature | ||
46 | if (containingReference === null || referencesUsed.contains(containingReference)) { | ||
47 | objectsBuilder.add(object) | ||
48 | } else { | ||
49 | treeIterator.prune | ||
50 | } | ||
51 | } | ||
52 | val objects = objectsBuilder.build | ||
40 | return transform(metamodelTranslationResult,objects,withID) | 53 | return transform(metamodelTranslationResult,objects,withID) |
41 | } | 54 | } |
42 | 55 | ||