From 8d2d6359f3b47b36075ea5aad8b522c094f5a71c Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Thu, 9 Feb 2023 16:52:43 +0100 Subject: refactor: Atom -> Literal naming convention --- .../store/src/test/java/tools/refinery/store/model/tests/ModelTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'subprojects/store/src/test') diff --git a/subprojects/store/src/test/java/tools/refinery/store/model/tests/ModelTest.java b/subprojects/store/src/test/java/tools/refinery/store/model/tests/ModelTest.java index 371b5e47..9536a444 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/model/tests/ModelTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/model/tests/ModelTest.java @@ -49,7 +49,7 @@ class ModelTest { assertEquals(3, ageInterpretation.get(Tuple.of(0))); assertEquals(1, ageInterpretation.get(Tuple.of(1))); - assertNull(ageInterpretation.get( Tuple.of(2))); + assertNull(ageInterpretation.get(Tuple.of(2))); assertTrue(friendInterpretation.get(Tuple.of(0, 1))); assertFalse(friendInterpretation.get(Tuple.of(0, 5))); -- cgit v1.2.3-70-g09d2 From 3e5a9bb7a258de77e5ca5dc46e3c730317f8b894 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Fri, 17 Feb 2023 17:39:12 +0100 Subject: feat: type inference for class hierarchies --- .../translator/typehierarchy/EliminatedType.java | 6 + .../translator/typehierarchy/ExtendedTypeInfo.java | 101 ++++++++++ .../translator/typehierarchy/InferredType.java | 30 +++ .../translator/typehierarchy/PreservedType.java | 136 ++++++++++++++ .../typehierarchy/TypeAnalysisResult.java | 4 + .../translator/typehierarchy/TypeAnalyzer.java | 202 ++++++++++++++++++++ .../partial/translator/typehierarchy/TypeInfo.java | 46 +++++ .../translator/typehierarchy/InferredTypeTest.java | 32 ++++ .../TypeAnalyzerExampleHierarchyTest.java | 203 +++++++++++++++++++++ .../translator/typehierarchy/TypeAnalyzerTest.java | 200 ++++++++++++++++++++ .../typehierarchy/TypeAnalyzerTester.java | 51 ++++++ 11 files changed, 1011 insertions(+) create mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/EliminatedType.java create mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/ExtendedTypeInfo.java create mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/InferredType.java create mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/PreservedType.java create mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalysisResult.java create mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzer.java create mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeInfo.java create mode 100644 subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/InferredTypeTest.java create mode 100644 subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerExampleHierarchyTest.java create mode 100644 subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTest.java create mode 100644 subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTester.java (limited to 'subprojects/store/src/test') diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/EliminatedType.java b/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/EliminatedType.java new file mode 100644 index 00000000..9adf6bc8 --- /dev/null +++ b/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/EliminatedType.java @@ -0,0 +1,6 @@ +package tools.refinery.store.partial.translator.typehierarchy; + +import tools.refinery.store.partial.representation.PartialRelation; + +record EliminatedType(PartialRelation replacement) implements TypeAnalysisResult { +} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/ExtendedTypeInfo.java b/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/ExtendedTypeInfo.java new file mode 100644 index 00000000..d3f66a4c --- /dev/null +++ b/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/ExtendedTypeInfo.java @@ -0,0 +1,101 @@ +package tools.refinery.store.partial.translator.typehierarchy; + +import org.jetbrains.annotations.NotNull; +import tools.refinery.store.partial.representation.PartialRelation; + +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.Objects; +import java.util.Set; + +final class ExtendedTypeInfo implements Comparable { + private final int index; + private final PartialRelation type; + private final TypeInfo typeInfo; + private final Set allSubtypes = new LinkedHashSet<>(); + private final Set allSupertypes; + private final Set concreteSubtypesAndSelf = new LinkedHashSet<>(); + private Set directSubtypes; + private final Set unsortedDirectSupertypes = new HashSet<>(); + + public ExtendedTypeInfo(int index, PartialRelation type, TypeInfo typeInfo) { + this.index = index; + this.type = type; + this.typeInfo = typeInfo; + this.allSupertypes = new LinkedHashSet<>(typeInfo.supertypes()); + } + + public PartialRelation getType() { + return type; + } + + public TypeInfo getTypeInfo() { + return typeInfo; + } + + public boolean isAbstractType() { + return getTypeInfo().abstractType(); + } + + public Set getAllSubtypes() { + return allSubtypes; + } + + public Set getAllSupertypes() { + return allSupertypes; + } + + public Set getAllSupertypesAndSelf() { + var allSubtypesAndSelf = new HashSet(allSupertypes.size() + 1); + addMust(allSubtypesAndSelf); + return allSubtypesAndSelf; + } + + public Set getConcreteSubtypesAndSelf() { + return concreteSubtypesAndSelf; + } + + public Set getDirectSubtypes() { + return directSubtypes; + } + + public Set getUnsortedDirectSupertypes() { + return unsortedDirectSupertypes; + } + + public void setDirectSubtypes(Set directSubtypes) { + this.directSubtypes = directSubtypes; + } + + public boolean allowsAllConcreteTypes(Set concreteTypes) { + for (var concreteType : concreteTypes) { + if (!concreteSubtypesAndSelf.contains(concreteType)) { + return false; + } + } + return true; + } + + public void addMust(Set mustTypes) { + mustTypes.add(type); + mustTypes.addAll(allSupertypes); + } + + @Override + public int compareTo(@NotNull ExtendedTypeInfo extendedTypeInfo) { + return Integer.compare(index, extendedTypeInfo.index); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ExtendedTypeInfo that = (ExtendedTypeInfo) o; + return index == that.index; + } + + @Override + public int hashCode() { + return Objects.hash(index); + } +} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/InferredType.java b/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/InferredType.java new file mode 100644 index 00000000..729b1fb5 --- /dev/null +++ b/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/InferredType.java @@ -0,0 +1,30 @@ +package tools.refinery.store.partial.translator.typehierarchy; + +import tools.refinery.store.partial.representation.PartialRelation; + +import java.util.Collections; +import java.util.Set; + +record InferredType(Set mustTypes, Set mayConcreteTypes, + PartialRelation currentType) { + public static final InferredType UNTYPED = new InferredType(Set.of(), Set.of(), null); + + public InferredType(Set mustTypes, Set mayConcreteTypes, + PartialRelation currentType) { + this.mustTypes = Collections.unmodifiableSet(mustTypes); + this.mayConcreteTypes = Collections.unmodifiableSet(mayConcreteTypes); + this.currentType = currentType; + } + + public boolean isConsistent() { + return currentType != null || mustTypes.isEmpty(); + } + + public boolean isMust(PartialRelation partialRelation) { + return mustTypes.contains(partialRelation); + } + + public boolean isMayConcrete(PartialRelation partialRelation) { + return mayConcreteTypes.contains(partialRelation); + } +} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/PreservedType.java b/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/PreservedType.java new file mode 100644 index 00000000..0299ae03 --- /dev/null +++ b/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/PreservedType.java @@ -0,0 +1,136 @@ +package tools.refinery.store.partial.translator.typehierarchy; + +import tools.refinery.store.partial.representation.PartialRelation; +import tools.refinery.store.representation.TruthValue; + +import java.util.*; + +final class PreservedType implements TypeAnalysisResult { + private final ExtendedTypeInfo extendedTypeInfo; + private final List directSubtypes; + private final List allExternalTypeInfoList; + private final InferredType inferredType; + + public PreservedType(ExtendedTypeInfo extendedTypeInfo, List allExternalTypeInfoList) { + this.extendedTypeInfo = extendedTypeInfo; + directSubtypes = List.copyOf(extendedTypeInfo.getDirectSubtypes()); + this.allExternalTypeInfoList = allExternalTypeInfoList; + inferredType = propagateMust(extendedTypeInfo.getAllSupertypesAndSelf(), + extendedTypeInfo.getConcreteSubtypesAndSelf()); + } + + public PartialRelation type() { + return extendedTypeInfo.getType(); + } + + public List getDirectSubtypes() { + return directSubtypes; + } + + public boolean isAbstractType() { + return extendedTypeInfo.isAbstractType(); + } + + public boolean isVacuous() { + return isAbstractType() && directSubtypes.isEmpty(); + } + + public InferredType asInferredType() { + return inferredType; + } + + public InferredType merge(InferredType inferredType, TruthValue value) { + return switch (value) { + case UNKNOWN -> inferredType; + case TRUE -> addMust(inferredType); + case FALSE -> removeMay(inferredType); + case ERROR -> addError(inferredType); + }; + } + + private InferredType addMust(InferredType inferredType) { + var originalMustTypes = inferredType.mustTypes(); + if (originalMustTypes.contains(type())) { + return inferredType; + } + var mustTypes = new HashSet<>(originalMustTypes); + extendedTypeInfo.addMust(mustTypes); + var originalMayConcreteTypes = inferredType.mayConcreteTypes(); + var mayConcreteTypes = new LinkedHashSet<>(originalMayConcreteTypes); + Set mayConcreteTypesResult; + if (mayConcreteTypes.retainAll(extendedTypeInfo.getConcreteSubtypesAndSelf())) { + mayConcreteTypesResult = mayConcreteTypes; + } else { + mayConcreteTypesResult = originalMayConcreteTypes; + } + return propagateMust(mustTypes, mayConcreteTypesResult); + } + + private InferredType removeMay(InferredType inferredType) { + var originalMayConcreteTypes = inferredType.mayConcreteTypes(); + var mayConcreteTypes = new LinkedHashSet<>(originalMayConcreteTypes); + if (!mayConcreteTypes.removeAll(extendedTypeInfo.getConcreteSubtypesAndSelf())) { + return inferredType; + } + return propagateMust(inferredType.mustTypes(), mayConcreteTypes); + } + + private InferredType addError(InferredType inferredType) { + var originalMustTypes = inferredType.mustTypes(); + if (originalMustTypes.contains(type())) { + if (inferredType.mayConcreteTypes().isEmpty()) { + return inferredType; + } + return new InferredType(originalMustTypes, Set.of(), null); + } + var mustTypes = new HashSet<>(originalMustTypes); + extendedTypeInfo.addMust(mustTypes); + return new InferredType(mustTypes, Set.of(), null); + } + + private InferredType propagateMust(Set originalMustTypes, + Set mayConcreteTypes) { + // It is possible that there is not type at all, do not force one by propagation. + var maybeUntyped = originalMustTypes.isEmpty(); + // Para-consistent case, do not propagate must types to avoid logical explosion. + var paraConsistentOrSurelyUntyped = mayConcreteTypes.isEmpty(); + if (maybeUntyped || paraConsistentOrSurelyUntyped) { + return new InferredType(originalMustTypes, mayConcreteTypes, null); + } + var currentType = computeCurrentType(mayConcreteTypes); + var mustTypes = new HashSet<>(originalMustTypes); + boolean changed = false; + for (var newMustExtendedTypeInfo : allExternalTypeInfoList) { + var newMustType = newMustExtendedTypeInfo.getType(); + if (mustTypes.contains(newMustType)) { + continue; + } + if (newMustExtendedTypeInfo.allowsAllConcreteTypes(mayConcreteTypes)) { + newMustExtendedTypeInfo.addMust(mustTypes); + changed = true; + } + } + if (!changed) { + return new InferredType(originalMustTypes, mayConcreteTypes, currentType); + } + return new InferredType(mustTypes, mayConcreteTypes, currentType); + } + + /** + * Returns a concrete type that is allowed by a (consistent, i.e., nonempty) set of may concrete types. + * + * @param mayConcreteTypes The set of allowed concrete types. Must not be empty. + * @return The first concrete type that is allowed by {@code matConcreteTypes}. + */ + private PartialRelation computeCurrentType(Set mayConcreteTypes) { + for (var concreteExtendedTypeInfo : allExternalTypeInfoList) { + var concreteType = concreteExtendedTypeInfo.getType(); + if (!concreteExtendedTypeInfo.isAbstractType() && mayConcreteTypes.contains(concreteType)) { + return concreteType; + } + } + // We have already filtered out the para-consistent case in {@link #propagateMust(Set, + // Set}. + throw new AssertionError("No concrete type in %s".formatted(mayConcreteTypes)); + } +} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalysisResult.java b/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalysisResult.java new file mode 100644 index 00000000..0745f84e --- /dev/null +++ b/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalysisResult.java @@ -0,0 +1,4 @@ +package tools.refinery.store.partial.translator.typehierarchy; + +sealed interface TypeAnalysisResult permits EliminatedType, PreservedType { +} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzer.java b/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzer.java new file mode 100644 index 00000000..062b4c49 --- /dev/null +++ b/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzer.java @@ -0,0 +1,202 @@ +package tools.refinery.store.partial.translator.typehierarchy; + +import tools.refinery.store.partial.representation.PartialRelation; + +import java.util.*; + +class TypeAnalyzer { + private final Map extendedTypeInfoMap; + private final Map replacements = new LinkedHashMap<>(); + private final InferredType unknownType; + private final Map analysisResults; + + public TypeAnalyzer(Map typeInfoMap) { + int size = typeInfoMap.size(); + extendedTypeInfoMap = new LinkedHashMap<>(size); + var concreteTypes = new LinkedHashSet(); + int index = 0; + for (var entry : typeInfoMap.entrySet()) { + var type = entry.getKey(); + var typeInfo = entry.getValue(); + extendedTypeInfoMap.put(type, new ExtendedTypeInfo(index, type, typeInfo)); + if (!typeInfo.abstractType()) { + concreteTypes.add(type); + } + index++; + } + unknownType = new InferredType(Set.of(), concreteTypes, null); + computeAllSupertypes(); + computeAllAndConcreteSubtypes(); + computeDirectSubtypes(); + eliminateTrivialSupertypes(); + analysisResults = computeAnalysisResults(); + } + + public InferredType getUnknownType() { + return unknownType; + } + + public Map getAnalysisResults() { + return analysisResults; + } + + private void computeAllSupertypes() { + boolean changed; + do { + changed = false; + for (var extendedTypeInfo : extendedTypeInfoMap.values()) { + var found = new HashSet(); + var allSupertypes = extendedTypeInfo.getAllSupertypes(); + for (var supertype : allSupertypes) { + found.addAll(extendedTypeInfoMap.get(supertype).getAllSupertypes()); + } + if (allSupertypes.addAll(found)) { + changed = true; + } + } + } while (changed); + } + + private void computeAllAndConcreteSubtypes() { + for (var extendedTypeInfo : extendedTypeInfoMap.values()) { + var type = extendedTypeInfo.getType(); + if (!extendedTypeInfo.isAbstractType()) { + extendedTypeInfo.getConcreteSubtypesAndSelf().add(type); + } + for (var supertype : extendedTypeInfo.getAllSupertypes()) { + if (type.equals(supertype)) { + throw new IllegalArgumentException("%s cannot be a supertype of itself".formatted(type)); + } + var supertypeInfo = extendedTypeInfoMap.get(supertype); + supertypeInfo.getAllSubtypes().add(type); + if (!extendedTypeInfo.isAbstractType()) { + supertypeInfo.getConcreteSubtypesAndSelf().add(type); + } + } + } + } + + private void computeDirectSubtypes() { + for (var extendedTypeInfo : extendedTypeInfoMap.values()) { + var allSubtypes = extendedTypeInfo.getAllSubtypes(); + var directSubtypes = new LinkedHashSet<>(allSubtypes); + var indirectSubtypes = new LinkedHashSet(allSubtypes.size()); + for (var subtype : allSubtypes) { + indirectSubtypes.addAll(extendedTypeInfoMap.get(subtype).getAllSubtypes()); + } + directSubtypes.removeAll(indirectSubtypes); + extendedTypeInfo.setDirectSubtypes(directSubtypes); + } + } + + private void eliminateTrivialSupertypes() { + boolean changed; + do { + var toRemove = new ArrayList(); + for (var entry : extendedTypeInfoMap.entrySet()) { + var extendedTypeInfo = entry.getValue(); + boolean isAbstract = extendedTypeInfo.isAbstractType(); + // Do not eliminate abstract types with 0 subtypes, because they can be used para-consistently, i.e., + // an object determined to must have an abstract type with 0 subtypes may not ever exist. + boolean hasSingleDirectSubtype = extendedTypeInfo.getDirectSubtypes().size() == 1; + if (isAbstract && hasSingleDirectSubtype) { + toRemove.add(entry.getKey()); + } + } + toRemove.forEach(this::removeTrivialType); + changed = !toRemove.isEmpty(); + } while (changed); + } + + private void removeTrivialType(PartialRelation trivialType) { + var extendedTypeInfo = extendedTypeInfoMap.get(trivialType); + var iterator = extendedTypeInfo.getDirectSubtypes().iterator(); + if (!iterator.hasNext()) { + throw new AssertionError("Expected trivial supertype %s to have a direct subtype" + .formatted(trivialType)); + } + PartialRelation replacement = setReplacement(trivialType, iterator.next()); + if (iterator.hasNext()) { + throw new AssertionError("Expected trivial supertype %s to have at most 1 direct subtype" + .formatted(trivialType)); + } + replacements.put(trivialType, replacement); + for (var supertype : extendedTypeInfo.getAllSupertypes()) { + var extendedSupertypeInfo = extendedTypeInfoMap.get(supertype); + if (!extendedSupertypeInfo.getAllSubtypes().remove(trivialType)) { + throw new AssertionError("Expected %s to be subtype of %s".formatted(trivialType, supertype)); + } + var directSubtypes = extendedSupertypeInfo.getDirectSubtypes(); + if (directSubtypes.remove(trivialType)) { + directSubtypes.add(replacement); + } + } + for (var subtype : extendedTypeInfo.getAllSubtypes()) { + var extendedSubtypeInfo = extendedTypeInfoMap.get(subtype); + if (!extendedSubtypeInfo.getAllSupertypes().remove(trivialType)) { + throw new AssertionError("Expected %s to be supertype of %s".formatted(trivialType, subtype)); + } + } + extendedTypeInfoMap.remove(trivialType); + } + + private PartialRelation setReplacement(PartialRelation trivialRelation, PartialRelation replacement) { + if (replacement == null) { + return trivialRelation; + } + var resolved = setReplacement(replacement, replacements.get(replacement)); + replacements.put(trivialRelation, resolved); + return resolved; + } + + private Map computeAnalysisResults() { + var allExtendedTypeInfoList = sortTypes(); + var results = new LinkedHashMap( + allExtendedTypeInfoList.size() + replacements.size()); + for (var extendedTypeInfo : allExtendedTypeInfoList) { + var type = extendedTypeInfo.getType(); + results.put(type, new PreservedType(extendedTypeInfo, allExtendedTypeInfoList)); + } + for (var entry : replacements.entrySet()) { + var type = entry.getKey(); + results.put(type, new EliminatedType(entry.getValue())); + } + return Collections.unmodifiableMap(results); + } + + private List sortTypes() { + // Invert {@code directSubtypes} to keep track of the out-degree of types. + for (var extendedTypeInfo : extendedTypeInfoMap.values()) { + for (var directSubtype : extendedTypeInfo.getDirectSubtypes()) { + var extendedDirectSubtypeInfo = extendedTypeInfoMap.get(directSubtype); + extendedDirectSubtypeInfo.getUnsortedDirectSupertypes().add(extendedTypeInfo.getType()); + } + } + // Build a inverse topological order ({@code extends} edges always points to earlier nodes in the order, + // breaking ties according to the original order ({@link ExtendedTypeInfo#index}) to form a 'stable' sort. + // See, e.g., https://stackoverflow.com/a/11236027. + var priorityQueue = new PriorityQueue(); + for (var extendedTypeInfo : extendedTypeInfoMap.values()) { + if (extendedTypeInfo.getUnsortedDirectSupertypes().isEmpty()) { + priorityQueue.add(extendedTypeInfo); + } + } + var sorted = new ArrayList(extendedTypeInfoMap.size()); + while (!priorityQueue.isEmpty()) { + var extendedTypeInfo = priorityQueue.remove(); + sorted.add(extendedTypeInfo); + for (var directSubtype : extendedTypeInfo.getDirectSubtypes()) { + var extendedDirectSubtypeInfo = extendedTypeInfoMap.get(directSubtype); + var unsortedDirectSupertypes = extendedDirectSubtypeInfo.getUnsortedDirectSupertypes(); + if (!unsortedDirectSupertypes.remove(extendedTypeInfo.getType())) { + throw new AssertionError("Expected %s to be a direct supertype of %s" + .formatted(extendedTypeInfo.getType(), directSubtype)); + } + if (unsortedDirectSupertypes.isEmpty()) { + priorityQueue.add(extendedDirectSubtypeInfo); + } + } + } + return Collections.unmodifiableList(sorted); + } +} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeInfo.java b/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeInfo.java new file mode 100644 index 00000000..1b0922fe --- /dev/null +++ b/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeInfo.java @@ -0,0 +1,46 @@ +package tools.refinery.store.partial.translator.typehierarchy; + +import tools.refinery.store.partial.representation.PartialRelation; + +import java.util.*; + +public record TypeInfo(Collection supertypes, boolean abstractType) { + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private final Set supertypes = new LinkedHashSet<>(); + private boolean abstractType; + + private Builder() { + } + + public Builder supertypes(Collection supertypes) { + this.supertypes.addAll(supertypes); + return this; + } + + public Builder supertypes(PartialRelation... supertypes) { + return supertypes(List.of(supertypes)); + } + + public Builder supertype(PartialRelation supertype) { + supertypes.add(supertype); + return this; + } + + public Builder abstractType(boolean abstractType) { + this.abstractType = abstractType; + return this; + } + + public Builder abstractType() { + return abstractType(true); + } + + public TypeInfo build() { + return new TypeInfo(Collections.unmodifiableSet(supertypes), abstractType); + } + } +} diff --git a/subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/InferredTypeTest.java b/subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/InferredTypeTest.java new file mode 100644 index 00000000..9efa76ef --- /dev/null +++ b/subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/InferredTypeTest.java @@ -0,0 +1,32 @@ +package tools.refinery.store.partial.translator.typehierarchy; + +import org.junit.jupiter.api.Test; +import tools.refinery.store.partial.representation.PartialRelation; + +import java.util.Set; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +class InferredTypeTest { + private final PartialRelation c1 = new PartialRelation("C1", 1); + private final PartialRelation c2 = new PartialRelation("C2", 1); + + @Test + void untypedIsConsistentTest() { + var sut = new InferredType(Set.of(), Set.of(c1, c2), null); + assertThat(sut.isConsistent(), is(true)); + } + + @Test + void typedIsConsistentTest() { + var sut = new InferredType(Set.of(c1), Set.of(c1, c2), c1); + assertThat(sut.isConsistent(), is(true)); + } + + @Test + void typedIsInconsistentTest() { + var sut = new InferredType(Set.of(c1), Set.of(), null); + assertThat(sut.isConsistent(), is(false)); + } +} diff --git a/subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerExampleHierarchyTest.java b/subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerExampleHierarchyTest.java new file mode 100644 index 00000000..5f528328 --- /dev/null +++ b/subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerExampleHierarchyTest.java @@ -0,0 +1,203 @@ +package tools.refinery.store.partial.translator.typehierarchy; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import tools.refinery.store.partial.representation.PartialRelation; +import tools.refinery.store.representation.TruthValue; + +import java.util.LinkedHashMap; +import java.util.Set; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.junit.jupiter.api.Assertions.assertAll; + +class TypeAnalyzerExampleHierarchyTest { + private final PartialRelation a1 = new PartialRelation("A1", 1); + private final PartialRelation a2 = new PartialRelation("A2", 1); + private final PartialRelation a3 = new PartialRelation("A3", 1); + private final PartialRelation a4 = new PartialRelation("A4", 1); + private final PartialRelation a5 = new PartialRelation("A5", 1); + private final PartialRelation c1 = new PartialRelation("C1", 1); + private final PartialRelation c2 = new PartialRelation("C2", 1); + private final PartialRelation c3 = new PartialRelation("C3", 1); + private final PartialRelation c4 = new PartialRelation("C4", 1); + + private TypeAnalyzer sut; + private TypeAnalyzerTester tester; + + @BeforeEach + void beforeEach() { + var typeInfoMap = new LinkedHashMap(); + typeInfoMap.put(a1, TypeInfo.builder().abstractType().build()); + typeInfoMap.put(a2, TypeInfo.builder().abstractType().build()); + typeInfoMap.put(a3, TypeInfo.builder().abstractType().build()); + typeInfoMap.put(a4, TypeInfo.builder().abstractType().build()); + typeInfoMap.put(a5, TypeInfo.builder().abstractType().build()); + typeInfoMap.put(c1, TypeInfo.builder().supertypes(a1, a4).build()); + typeInfoMap.put(c2, TypeInfo.builder().supertypes(a1, a2, a3, a4).build()); + typeInfoMap.put(c3, TypeInfo.builder().supertype(a3).build()); + typeInfoMap.put(c4, TypeInfo.builder().supertype(a4).build()); + sut = new TypeAnalyzer(typeInfoMap); + tester = new TypeAnalyzerTester(sut); + } + + @Test + void analysisResultsTest() { + assertAll( + () -> tester.assertAbstractType(a1, c1, c2), + () -> tester.assertEliminatedType(a2, c2), + () -> tester.assertAbstractType(a3, c2, c3), + () -> tester.assertAbstractType(a4, c1, c2, c4), + () -> tester.assertVacuousType(a5), + () -> tester.assertConcreteType(c1), + () -> tester.assertConcreteType(c2), + () -> tester.assertConcreteType(c3), + () -> tester.assertConcreteType(c4) + ); + } + + @Test + void inferredTypesTest() { + assertAll( + () -> assertThat(sut.getUnknownType(), is(new InferredType(Set.of(), Set.of(c1, c2, c3, c4), null))), + () -> assertThat(tester.getInferredType(a1), is(new InferredType(Set.of(a1, a4), Set.of(c1, c2), c1))), + () -> assertThat(tester.getInferredType(a3), is(new InferredType(Set.of(a3), Set.of(c2, c3), c2))), + () -> assertThat(tester.getInferredType(a4), is(new InferredType(Set.of(a4), Set.of(c1, c2, c4), c1))), + () -> assertThat(tester.getInferredType(a5), is(new InferredType(Set.of(a5), Set.of(), null))), + () -> assertThat(tester.getInferredType(c1), is(new InferredType(Set.of(a1, a4, c1), Set.of(c1), c1))), + () -> assertThat(tester.getInferredType(c2), + is(new InferredType(Set.of(a1, a3, a4, c2), Set.of(c2), c2))), + () -> assertThat(tester.getInferredType(c3), is(new InferredType(Set.of(a3, c3), Set.of(c3), c3))), + () -> assertThat(tester.getInferredType(c4), is(new InferredType(Set.of(a4, c4), Set.of(c4), c4))) + ); + } + + @Test + void consistentMustTest() { + var a1Result = tester.getPreservedType(a1); + var a3Result = tester.getPreservedType(a3); + var expected = new InferredType(Set.of(a1, a3, a4, c2), Set.of(c2), c2); + assertAll( + () -> assertThat(a1Result.merge(a3Result.asInferredType(), TruthValue.TRUE), is(expected)), + () -> assertThat(a3Result.merge(a1Result.asInferredType(), TruthValue.TRUE), is(expected)), + () -> assertThat(a1Result.merge(sut.getUnknownType(), TruthValue.TRUE), is(a1Result.asInferredType())), + () -> assertThat(a3Result.merge(sut.getUnknownType(), TruthValue.TRUE), is(a3Result.asInferredType())), + () -> assertThat(a1Result.merge(a1Result.asInferredType(), TruthValue.TRUE), + is(a1Result.asInferredType())) + ); + } + + @Test + void consistentMayNotTest() { + var a1Result = tester.getPreservedType(a1); + var a3Result = tester.getPreservedType(a3); + var a4Result = tester.getPreservedType(a4); + assertAll( + () -> assertThat(a1Result.merge(a3Result.asInferredType(), TruthValue.FALSE), + is(new InferredType(Set.of(a3, c3), Set.of(c3), c3))), + () -> assertThat(a3Result.merge(a1Result.asInferredType(), TruthValue.FALSE), + is(new InferredType(Set.of(a1, a4, c1), Set.of(c1), c1))), + () -> assertThat(a4Result.merge(a3Result.asInferredType(), TruthValue.FALSE), + is(new InferredType(Set.of(a3, c3), Set.of(c3), c3))), + () -> assertThat(a3Result.merge(a4Result.asInferredType(), TruthValue.FALSE), + is(new InferredType(Set.of(a4), Set.of(c1, c4), c1))), + () -> assertThat(a1Result.merge(sut.getUnknownType(), TruthValue.FALSE), + is(new InferredType(Set.of(), Set.of(c3, c4), null))), + () -> assertThat(a3Result.merge(sut.getUnknownType(), TruthValue.FALSE), + is(new InferredType(Set.of(), Set.of(c1, c4), null))), + () -> assertThat(a4Result.merge(sut.getUnknownType(), TruthValue.FALSE), + is(new InferredType(Set.of(), Set.of(c3), null))) + ); + } + + @Test + void consistentErrorTest() { + var c1Result = tester.getPreservedType(c1); + var a4Result = tester.getPreservedType(a4); + var expected = new InferredType(Set.of(c1, a1, a4), Set.of(), null); + assertAll( + () -> assertThat(c1Result.merge(a4Result.asInferredType(), TruthValue.ERROR), is(expected)), + () -> assertThat(a4Result.merge(c1Result.asInferredType(), TruthValue.ERROR), is(expected)) + ); + } + + @Test + void consistentUnknownTest() { + var c1Result = tester.getPreservedType(c1); + var a4Result = tester.getPreservedType(a4); + assertAll( + () -> assertThat(c1Result.merge(a4Result.asInferredType(), TruthValue.UNKNOWN), + is(a4Result.asInferredType())), + () -> assertThat(a4Result.merge(c1Result.asInferredType(), TruthValue.UNKNOWN), + is(c1Result.asInferredType())) + ); + } + + @Test + void inconsistentMustTest() { + var a1Result = tester.getPreservedType(a1); + var c3Result = tester.getPreservedType(c3); + assertAll( + () -> assertThat(a1Result.merge(c3Result.asInferredType(), TruthValue.TRUE), + is(new InferredType(Set.of(a1, a3, c3), Set.of(), null))), + () -> assertThat(c3Result.merge(a1Result.asInferredType(), TruthValue.TRUE), + is(new InferredType(Set.of(a1, a3, a4, c3), Set.of(), null))) + ); + } + + @Test + void inconsistentMayNotTest() { + var a1Result = tester.getPreservedType(a1); + var a4Result = tester.getPreservedType(a4); + var c1Result = tester.getPreservedType(c1); + assertAll( + () -> assertThat(a4Result.merge(a1Result.asInferredType(), TruthValue.FALSE), + is(new InferredType(Set.of(a1, a4), Set.of(), null))), + () -> assertThat(a1Result.merge(c1Result.asInferredType(), TruthValue.FALSE), + is(new InferredType(Set.of(a1, a4, c1), Set.of(), null))), + () -> assertThat(a4Result.merge(c1Result.asInferredType(), TruthValue.FALSE), + is(new InferredType(Set.of(a1, a4, c1), Set.of(), null))), + () -> assertThat(a1Result.merge(a1Result.asInferredType(), TruthValue.FALSE), + is(new InferredType(Set.of(a1, a4), Set.of(), null))) + ); + } + + @Test + void vacuousMustTest() { + var c1Result = tester.getPreservedType(c1); + var a5Result = tester.getPreservedType(a5); + assertAll( + () -> assertThat(c1Result.merge(a5Result.asInferredType(), TruthValue.TRUE), + is(new InferredType(Set.of(a1, a4, a5, c1), Set.of(), null))), + () -> assertThat(a5Result.merge(c1Result.asInferredType(), TruthValue.TRUE), + is(new InferredType(Set.of(a1, a4, a5, c1), Set.of(), null))) + ); + } + + @Test + void vacuousMayNotTest() { + var c1Result = tester.getPreservedType(c1); + var a5Result = tester.getPreservedType(a5); + assertAll( + () -> assertThat(c1Result.merge(a5Result.asInferredType(), TruthValue.FALSE), + is(a5Result.asInferredType())), + () -> assertThat(a5Result.merge(c1Result.asInferredType(), TruthValue.FALSE), + is(c1Result.asInferredType())) + ); + } + + @Test + void vacuousErrorTest() { + var c1Result = tester.getPreservedType(c1); + var a5Result = tester.getPreservedType(a5); + assertAll( + () -> assertThat(c1Result.merge(a5Result.asInferredType(), TruthValue.ERROR), + is(new InferredType(Set.of(a1, a4, a5, c1), Set.of(), null))), + () -> assertThat(a5Result.merge(c1Result.asInferredType(), TruthValue.ERROR), + is(new InferredType(Set.of(a1, a4, a5, c1), Set.of(), null))), + () -> assertThat(a5Result.merge(a5Result.asInferredType(), TruthValue.ERROR), + is(a5Result.asInferredType())) + ); + } +} diff --git a/subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTest.java b/subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTest.java new file mode 100644 index 00000000..02903026 --- /dev/null +++ b/subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTest.java @@ -0,0 +1,200 @@ +package tools.refinery.store.partial.translator.typehierarchy; + +import org.junit.jupiter.api.Test; +import tools.refinery.store.partial.representation.PartialRelation; +import tools.refinery.store.representation.TruthValue; + +import java.util.LinkedHashMap; +import java.util.Set; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.junit.jupiter.api.Assertions.assertAll; +import static org.junit.jupiter.api.Assertions.assertThrows; + +class TypeAnalyzerTest { + @Test + void directSupertypesTest() { + var c1 = new PartialRelation("C1", 1); + var c2 = new PartialRelation("C2", 1); + var c3 = new PartialRelation("C3", 1); + var typeInfoMap = new LinkedHashMap(); + typeInfoMap.put(c1, TypeInfo.builder().supertypes(c2, c3).build()); + typeInfoMap.put(c2, TypeInfo.builder().supertype(c3).build()); + typeInfoMap.put(c3, TypeInfo.builder().build()); + + var sut = new TypeAnalyzer(typeInfoMap); + var tester = new TypeAnalyzerTester(sut); + + assertAll( + () -> tester.assertConcreteType(c1), + () -> tester.assertConcreteType(c2, c1), + () -> tester.assertConcreteType(c3, c2) + ); + } + + @Test + void typeEliminationAbstractToConcreteTest() { + var c1 = new PartialRelation("C1", 1); + var c2 = new PartialRelation("C2", 1); + var a11 = new PartialRelation("A11", 1); + var a12 = new PartialRelation("A12", 1); + var a21 = new PartialRelation("A21", 1); + var a22 = new PartialRelation("A22", 1); + var a3 = new PartialRelation("A3", 1); + var typeInfoMap = new LinkedHashMap(); + typeInfoMap.put(a3, TypeInfo.builder().abstractType().build()); + typeInfoMap.put(a21, TypeInfo.builder().abstractType().supertype(a3).build()); + typeInfoMap.put(a22, TypeInfo.builder().abstractType().supertype(a3).build()); + typeInfoMap.put(a11, TypeInfo.builder().abstractType().supertypes(a21, a22).build()); + typeInfoMap.put(a12, TypeInfo.builder().abstractType().supertypes(a21, a22).build()); + typeInfoMap.put(c1, TypeInfo.builder().supertypes(a11, a12).build()); + typeInfoMap.put(c2, TypeInfo.builder().supertype(a3).build()); + + var sut = new TypeAnalyzer(typeInfoMap); + var tester = new TypeAnalyzerTester(sut); + + assertAll( + () -> tester.assertConcreteType(c1), + () -> tester.assertConcreteType(c2), + () -> tester.assertEliminatedType(a11, c1), + () -> tester.assertEliminatedType(a12, c1), + () -> tester.assertEliminatedType(a21, c1), + () -> tester.assertEliminatedType(a22, c1), + () -> tester.assertAbstractType(a3, c1, c2) + ); + } + + @Test + void typeEliminationConcreteToAbstractTest() { + var c1 = new PartialRelation("C1", 1); + var c2 = new PartialRelation("C2", 1); + var a11 = new PartialRelation("A11", 1); + var a12 = new PartialRelation("A12", 1); + var a21 = new PartialRelation("A21", 1); + var a22 = new PartialRelation("A22", 1); + var a3 = new PartialRelation("A3", 1); + var typeInfoMap = new LinkedHashMap(); + typeInfoMap.put(c1, TypeInfo.builder().supertypes(a11, a12).build()); + typeInfoMap.put(c2, TypeInfo.builder().supertype(a3).build()); + typeInfoMap.put(a11, TypeInfo.builder().abstractType().supertypes(a21, a22).build()); + typeInfoMap.put(a12, TypeInfo.builder().abstractType().supertypes(a21, a22).build()); + typeInfoMap.put(a21, TypeInfo.builder().abstractType().supertype(a3).build()); + typeInfoMap.put(a22, TypeInfo.builder().abstractType().supertype(a3).build()); + typeInfoMap.put(a3, TypeInfo.builder().abstractType().build()); + + var sut = new TypeAnalyzer(typeInfoMap); + var tester = new TypeAnalyzerTester(sut); + + assertAll( + () -> tester.assertConcreteType(c1), + () -> tester.assertConcreteType(c2), + () -> tester.assertEliminatedType(a11, c1), + () -> tester.assertEliminatedType(a12, c1), + () -> tester.assertEliminatedType(a21, c1), + () -> tester.assertEliminatedType(a22, c1), + () -> tester.assertAbstractType(a3, c1, c2) + ); + } + + @Test + void preserveConcreteTypeTest() { + var c1 = new PartialRelation("C1", 1); + var a1 = new PartialRelation("A1", 1); + var c2 = new PartialRelation("C2", 1); + var a2 = new PartialRelation("A2", 1); + var typeInfoMap = new LinkedHashMap(); + typeInfoMap.put(c1, TypeInfo.builder().supertype(a1).build()); + typeInfoMap.put(a1, TypeInfo.builder().abstractType().supertype(c2).build()); + typeInfoMap.put(c2, TypeInfo.builder().supertype(a2).build()); + typeInfoMap.put(a2, TypeInfo.builder().abstractType().build()); + + var sut = new TypeAnalyzer(typeInfoMap); + var tester = new TypeAnalyzerTester(sut); + + assertAll( + () -> tester.assertConcreteType(c1), + () -> tester.assertEliminatedType(a1, c1), + () -> tester.assertConcreteType(c2, c1), + () -> tester.assertEliminatedType(a2, c2) + ); + } + + @Test + void mostGeneralCurrentTypeTest() { + var c1 = new PartialRelation("C1", 1); + var c2 = new PartialRelation("C2", 1); + var c3 = new PartialRelation("C3", 1); + var typeInfoMap = new LinkedHashMap(); + typeInfoMap.put(c1, TypeInfo.builder().supertype(c3).build()); + typeInfoMap.put(c2, TypeInfo.builder().supertype(c3).build()); + typeInfoMap.put(c3, TypeInfo.builder().build()); + + var sut = new TypeAnalyzer(typeInfoMap); + var tester = new TypeAnalyzerTester(sut); + var c3Result = tester.getPreservedType(c3); + + var expected = new InferredType(Set.of(c3), Set.of(c1, c2, c3), c3); + assertAll( + () -> assertThat(tester.getInferredType(c3), is(expected)), + () -> assertThat(c3Result.merge(sut.getUnknownType(), TruthValue.TRUE), is(expected)) + ); + } + + @Test + void preferFirstConcreteTypeTest() { + var a1 = new PartialRelation("A1", 1); + var c1 = new PartialRelation("C1", 1); + var c2 = new PartialRelation("C2", 1); + var c3 = new PartialRelation("C3", 1); + var c4 = new PartialRelation("C4", 1); + var typeInfoMap = new LinkedHashMap(); + typeInfoMap.put(c1, TypeInfo.builder().supertype(a1).build()); + typeInfoMap.put(c2, TypeInfo.builder().supertype(a1).build()); + typeInfoMap.put(c3, TypeInfo.builder().supertype(a1).build()); + typeInfoMap.put(c4, TypeInfo.builder().supertype(c3).build()); + typeInfoMap.put(a1, TypeInfo.builder().abstractType().build()); + + var sut = new TypeAnalyzer(typeInfoMap); + var tester = new TypeAnalyzerTester(sut); + var c1Result = tester.getPreservedType(c1); + var a1Result = tester.getPreservedType(a1); + + assertThat(c1Result.merge(a1Result.asInferredType(), TruthValue.FALSE), + is(new InferredType(Set.of(a1), Set.of(c2, c3, c4), c2))); + } + + @Test + void preferFirstMostGeneralConcreteTypeTest() { + var a1 = new PartialRelation("A1", 1); + var c1 = new PartialRelation("C1", 1); + var c2 = new PartialRelation("C2", 1); + var c3 = new PartialRelation("C3", 1); + var c4 = new PartialRelation("C4", 1); + var typeInfoMap = new LinkedHashMap(); + typeInfoMap.put(c4, TypeInfo.builder().supertype(c3).build()); + typeInfoMap.put(c3, TypeInfo.builder().supertype(a1).build()); + typeInfoMap.put(c2, TypeInfo.builder().supertype(a1).build()); + typeInfoMap.put(c1, TypeInfo.builder().supertype(a1).build()); + typeInfoMap.put(a1, TypeInfo.builder().abstractType().build()); + + var sut = new TypeAnalyzer(typeInfoMap); + var tester = new TypeAnalyzerTester(sut); + var c1Result = tester.getPreservedType(c1); + var a1Result = tester.getPreservedType(a1); + + assertThat(c1Result.merge(a1Result.asInferredType(), TruthValue.FALSE), + is(new InferredType(Set.of(a1), Set.of(c2, c3, c4), c3))); + } + + @Test + void circularTypeHierarchyTest() { + var c1 = new PartialRelation("C1", 1); + var c2 = new PartialRelation("C2", 1); + var typeInfoMap = new LinkedHashMap(); + typeInfoMap.put(c1, TypeInfo.builder().supertype(c2).build()); + typeInfoMap.put(c2, TypeInfo.builder().supertype(c1).build()); + + assertThrows(IllegalArgumentException.class, () -> new TypeAnalyzer(typeInfoMap)); + } +} diff --git a/subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTester.java b/subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTester.java new file mode 100644 index 00000000..ce600ea6 --- /dev/null +++ b/subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTester.java @@ -0,0 +1,51 @@ +package tools.refinery.store.partial.translator.typehierarchy; + +import tools.refinery.store.partial.representation.PartialRelation; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.is; + +class TypeAnalyzerTester { + private final TypeAnalyzer sut; + + public TypeAnalyzerTester(TypeAnalyzer sut) { + this.sut = sut; + } + + public void assertAbstractType(PartialRelation partialRelation, PartialRelation... directSubtypes) { + assertPreservedType(partialRelation, true, false, directSubtypes); + } + + public void assertVacuousType(PartialRelation partialRelation) { + assertPreservedType(partialRelation, true, true); + } + + public void assertConcreteType(PartialRelation partialRelation, PartialRelation... directSubtypes) { + assertPreservedType(partialRelation, false, false, directSubtypes); + } + + private void assertPreservedType(PartialRelation partialRelation, boolean isAbstract, boolean isVacuous, + PartialRelation... directSubtypes) { + var result = sut.getAnalysisResults().get(partialRelation); + assertThat(result, is(instanceOf(PreservedType.class))); + var preservedResult = (PreservedType) result; + assertThat(preservedResult.isAbstractType(), is(isAbstract)); + assertThat(preservedResult.isVacuous(), is(isVacuous)); + assertThat(preservedResult.getDirectSubtypes(), hasItems(directSubtypes)); + } + + public void assertEliminatedType(PartialRelation partialRelation, PartialRelation replacement) { + var result = sut.getAnalysisResults().get(partialRelation); + assertThat(result, is(instanceOf(EliminatedType.class))); + assertThat(((EliminatedType) result).replacement(), is(replacement)); + } + + public PreservedType getPreservedType(PartialRelation partialRelation) { + return (PreservedType) sut.getAnalysisResults().get(partialRelation); + } + + public InferredType getInferredType(PartialRelation partialRelation) { + return getPreservedType(partialRelation).asInferredType(); + } +} -- cgit v1.2.3-70-g09d2 From b3f7c4d7707435803921c4fec2c4d95b3dd45c53 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Mon, 20 Feb 2023 20:23:27 +0100 Subject: refactor: split query and partial from store Allows more complicated dependency hiearchies (e.g., use store-query-viatra for testing store-partial) and better separation of test fixtures. --- settings.gradle | 2 + subprojects/store-partial/build.gradle | 7 + .../partial/AnyPartialSymbolInterpretation.java | 13 ++ .../tools/refinery/store/partial/MergeResult.java | 15 ++ .../store/partial/PartialInterpretation.java | 24 +++ .../partial/PartialInterpretationAdapter.java | 20 ++ .../partial/PartialInterpretationBuilder.java | 28 +++ .../partial/PartialInterpretationStoreAdapter.java | 17 ++ .../store/partial/PartialSymbolInterpretation.java | 22 +++ .../internal/PartialInterpretationAdapterImpl.java | 38 ++++ .../internal/PartialInterpretationBuilderImpl.java | 29 +++ .../PartialInterpretationStoreAdapterImpl.java | 37 ++++ .../refinery/store/partial/lifting/DnfLifter.java | 107 +++++++++++ .../refinery/store/partial/lifting/ModalDnf.java | 11 ++ .../store/partial/literal/ModalDnfCallLiteral.java | 37 ++++ .../store/partial/literal/ModalLiteral.java | 45 +++++ .../partial/literal/ModalRelationLiteral.java | 31 ++++ .../refinery/store/partial/literal/Modality.java | 31 ++++ .../store/partial/literal/PartialLiterals.java | 33 ++++ .../partial/literal/PartialRelationLiteral.java | 27 +++ .../partial/representation/AnyPartialFunction.java | 4 + .../partial/representation/AnyPartialSymbol.java | 11 ++ .../partial/representation/PartialFunction.java | 32 ++++ .../partial/representation/PartialRelation.java | 66 +++++++ .../partial/representation/PartialSymbol.java | 12 ++ .../partial/rule/RelationRefinementAction.java | 36 ++++ .../tools/refinery/store/partial/rule/Rule.java | 38 ++++ .../refinery/store/partial/rule/RuleAction.java | 12 ++ .../store/partial/rule/RuleActionExecutor.java | 9 + .../refinery/store/partial/rule/RuleExecutor.java | 34 ++++ .../refinery/store/partial/translator/Advice.java | 155 ++++++++++++++++ .../store/partial/translator/AdviceSlot.java | 25 +++ .../refinery/store/partial/translator/Seed.java | 12 ++ .../store/partial/translator/TranslationUnit.java | 48 +++++ .../translator/typehierarchy/EliminatedType.java | 6 + .../translator/typehierarchy/ExtendedTypeInfo.java | 101 ++++++++++ .../typehierarchy/InferredMayTypeRelationView.java | 19 ++ .../InferredMustTypeRelationView.java | 19 ++ .../translator/typehierarchy/InferredType.java | 30 +++ .../translator/typehierarchy/PreservedType.java | 136 ++++++++++++++ .../typehierarchy/TypeAnalysisResult.java | 4 + .../translator/typehierarchy/TypeAnalyzer.java | 202 ++++++++++++++++++++ .../TypeHierarchyTranslationUnit.java | 52 ++++++ .../partial/translator/typehierarchy/TypeInfo.java | 46 +++++ .../translator/typehierarchy/InferredTypeTest.java | 32 ++++ .../TypeAnalyzerExampleHierarchyTest.java | 204 +++++++++++++++++++++ .../translator/typehierarchy/TypeAnalyzerTest.java | 201 ++++++++++++++++++++ .../typehierarchy/TypeAnalyzerTester.java | 51 ++++++ subprojects/store-query-viatra/build.gradle | 2 +- subprojects/store-query/build.gradle | 7 + .../main/java/tools/refinery/store/query/Dnf.java | 112 +++++++++++ .../tools/refinery/store/query/DnfBuilder.java | 108 +++++++++++ .../java/tools/refinery/store/query/DnfClause.java | 9 + .../java/tools/refinery/store/query/DnfUtils.java | 24 +++ .../refinery/store/query/FunctionalDependency.java | 15 ++ .../tools/refinery/store/query/ModelQuery.java | 11 ++ .../refinery/store/query/ModelQueryAdapter.java | 13 ++ .../refinery/store/query/ModelQueryBuilder.java | 23 +++ .../store/query/ModelQueryStoreAdapter.java | 16 ++ .../tools/refinery/store/query/RelationLike.java | 11 ++ .../java/tools/refinery/store/query/ResultSet.java | 25 +++ .../java/tools/refinery/store/query/Variable.java | 58 ++++++ .../store/query/literal/BooleanLiteral.java | 37 ++++ .../refinery/store/query/literal/CallLiteral.java | 66 +++++++ .../refinery/store/query/literal/CallPolarity.java | 32 ++++ .../store/query/literal/ConstantLiteral.java | 19 ++ .../store/query/literal/DnfCallLiteral.java | 29 +++ .../store/query/literal/EquivalenceLiteral.java | 35 ++++ .../refinery/store/query/literal/Literal.java | 16 ++ .../store/query/literal/LiteralReduction.java | 26 +++ .../refinery/store/query/literal/Literals.java | 11 ++ .../refinery/store/query/literal/PolarLiteral.java | 5 + .../store/query/literal/RelationViewLiteral.java | 24 +++ .../refinery/store/query/view/AnyRelationView.java | 24 +++ .../store/query/view/FilteredRelationView.java | 49 +++++ .../store/query/view/FunctionalRelationView.java | 71 +++++++ .../store/query/view/KeyOnlyRelationView.java | 36 ++++ .../refinery/store/query/view/RelationView.java | 82 +++++++++ .../store/query/view/RelationViewImplication.java | 19 ++ .../query/view/TuplePreservingRelationView.java | 44 +++++ .../store/partial/PartialInterpretation.java | 19 -- .../partial/PartialInterpretationAdapter.java | 9 - .../partial/PartialInterpretationBuilder.java | 9 - .../partial/PartialInterpretationStoreAdapter.java | 9 - .../internal/PartialInterpretationAdapterImpl.java | 24 --- .../internal/PartialInterpretationBuilderImpl.java | 17 -- .../PartialInterpretationStoreAdapterImpl.java | 23 --- .../store/partial/literal/ModalDnfCallLiteral.java | 30 --- .../store/partial/literal/ModalLiteral.java | 45 ----- .../partial/literal/ModalRelationLiteral.java | 31 ---- .../refinery/store/partial/literal/Modality.java | 31 ---- .../store/partial/literal/PartialLiterals.java | 33 ---- .../partial/literal/PartialRelationLiteral.java | 27 --- .../partial/representation/AnyPartialFunction.java | 4 - .../partial/representation/AnyPartialSymbol.java | 11 -- .../partial/representation/PartialFunction.java | 32 ---- .../partial/representation/PartialRelation.java | 66 ------- .../partial/representation/PartialSymbol.java | 12 -- .../translator/typehierarchy/EliminatedType.java | 6 - .../translator/typehierarchy/ExtendedTypeInfo.java | 101 ---------- .../translator/typehierarchy/InferredType.java | 30 --- .../translator/typehierarchy/PreservedType.java | 136 -------------- .../typehierarchy/TypeAnalysisResult.java | 4 - .../translator/typehierarchy/TypeAnalyzer.java | 202 -------------------- .../partial/translator/typehierarchy/TypeInfo.java | 46 ----- .../main/java/tools/refinery/store/query/Dnf.java | 187 ------------------- .../java/tools/refinery/store/query/DnfClause.java | 9 - .../java/tools/refinery/store/query/DnfUtils.java | 24 --- .../refinery/store/query/FunctionalDependency.java | 15 -- .../tools/refinery/store/query/ModelQuery.java | 11 -- .../refinery/store/query/ModelQueryAdapter.java | 13 -- .../refinery/store/query/ModelQueryBuilder.java | 23 --- .../store/query/ModelQueryStoreAdapter.java | 16 -- .../tools/refinery/store/query/RelationLike.java | 11 -- .../java/tools/refinery/store/query/ResultSet.java | 25 --- .../java/tools/refinery/store/query/Variable.java | 58 ------ .../refinery/store/query/literal/CallLiteral.java | 66 ------- .../refinery/store/query/literal/CallPolarity.java | 32 ---- .../store/query/literal/ConstantLiteral.java | 19 -- .../store/query/literal/DnfCallLiteral.java | 23 --- .../store/query/literal/EquivalenceLiteral.java | 27 --- .../refinery/store/query/literal/Literal.java | 12 -- .../refinery/store/query/literal/Literals.java | 11 -- .../refinery/store/query/literal/PolarLiteral.java | 5 - .../store/query/literal/RelationViewLiteral.java | 24 --- .../refinery/store/query/view/AnyRelationView.java | 24 --- .../store/query/view/FilteredRelationView.java | 49 ----- .../store/query/view/FunctionalRelationView.java | 71 ------- .../store/query/view/KeyOnlyRelationView.java | 36 ---- .../refinery/store/query/view/RelationView.java | 82 --------- .../store/query/view/RelationViewImplication.java | 19 -- .../query/view/TuplePreservingRelationView.java | 44 ----- .../translator/typehierarchy/InferredTypeTest.java | 32 ---- .../TypeAnalyzerExampleHierarchyTest.java | 203 -------------------- .../translator/typehierarchy/TypeAnalyzerTest.java | 200 -------------------- .../typehierarchy/TypeAnalyzerTester.java | 51 ------ 136 files changed, 3229 insertions(+), 2380 deletions(-) create mode 100644 subprojects/store-partial/build.gradle create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/AnyPartialSymbolInterpretation.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/MergeResult.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/PartialInterpretation.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/PartialInterpretationAdapter.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/PartialInterpretationBuilder.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/PartialInterpretationStoreAdapter.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/PartialSymbolInterpretation.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/internal/PartialInterpretationAdapterImpl.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/internal/PartialInterpretationBuilderImpl.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/internal/PartialInterpretationStoreAdapterImpl.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/lifting/DnfLifter.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/lifting/ModalDnf.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalDnfCallLiteral.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalLiteral.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalRelationLiteral.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/Modality.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/PartialLiterals.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/PartialRelationLiteral.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/representation/AnyPartialFunction.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/representation/AnyPartialSymbol.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/representation/PartialFunction.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/representation/PartialRelation.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/representation/PartialSymbol.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/rule/RelationRefinementAction.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/rule/Rule.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/rule/RuleAction.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/rule/RuleActionExecutor.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/rule/RuleExecutor.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/Advice.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/AdviceSlot.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/Seed.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/TranslationUnit.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/EliminatedType.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/ExtendedTypeInfo.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/InferredMayTypeRelationView.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/InferredMustTypeRelationView.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/InferredType.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/PreservedType.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalysisResult.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzer.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeHierarchyTranslationUnit.java create mode 100644 subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeInfo.java create mode 100644 subprojects/store-partial/src/test/java/tools/refinery/store/partial/translator/typehierarchy/InferredTypeTest.java create mode 100644 subprojects/store-partial/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerExampleHierarchyTest.java create mode 100644 subprojects/store-partial/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTest.java create mode 100644 subprojects/store-partial/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTester.java create mode 100644 subprojects/store-query/build.gradle create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/Dnf.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/DnfBuilder.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/DnfClause.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/DnfUtils.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/FunctionalDependency.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQuery.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQueryAdapter.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQueryBuilder.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQueryStoreAdapter.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/RelationLike.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/ResultSet.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/Variable.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/literal/BooleanLiteral.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/literal/CallLiteral.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/literal/CallPolarity.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/literal/ConstantLiteral.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/literal/DnfCallLiteral.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/literal/EquivalenceLiteral.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/literal/Literal.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/literal/LiteralReduction.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/literal/Literals.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/literal/PolarLiteral.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/literal/RelationViewLiteral.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/view/AnyRelationView.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/view/FilteredRelationView.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/view/FunctionalRelationView.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/view/KeyOnlyRelationView.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/view/RelationView.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/view/RelationViewImplication.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/view/TuplePreservingRelationView.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/PartialInterpretation.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/PartialInterpretationAdapter.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/PartialInterpretationBuilder.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/PartialInterpretationStoreAdapter.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/internal/PartialInterpretationAdapterImpl.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/internal/PartialInterpretationBuilderImpl.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/internal/PartialInterpretationStoreAdapterImpl.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/literal/ModalDnfCallLiteral.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/literal/ModalLiteral.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/literal/ModalRelationLiteral.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/literal/Modality.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/literal/PartialLiterals.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/literal/PartialRelationLiteral.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/representation/AnyPartialFunction.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/representation/AnyPartialSymbol.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/representation/PartialFunction.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/representation/PartialRelation.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/representation/PartialSymbol.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/EliminatedType.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/ExtendedTypeInfo.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/InferredType.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/PreservedType.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalysisResult.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzer.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeInfo.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/Dnf.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/DnfClause.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/DnfUtils.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/FunctionalDependency.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/ModelQuery.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/ModelQueryAdapter.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/ModelQueryBuilder.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/ModelQueryStoreAdapter.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/RelationLike.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/ResultSet.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/Variable.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/literal/CallLiteral.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/literal/CallPolarity.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/literal/ConstantLiteral.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/literal/DnfCallLiteral.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/literal/EquivalenceLiteral.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/literal/Literal.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/literal/Literals.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/literal/PolarLiteral.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/literal/RelationViewLiteral.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/view/AnyRelationView.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/view/FilteredRelationView.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/view/FunctionalRelationView.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/view/KeyOnlyRelationView.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/view/RelationView.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/view/RelationViewImplication.java delete mode 100644 subprojects/store/src/main/java/tools/refinery/store/query/view/TuplePreservingRelationView.java delete mode 100644 subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/InferredTypeTest.java delete mode 100644 subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerExampleHierarchyTest.java delete mode 100644 subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTest.java delete mode 100644 subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTester.java (limited to 'subprojects/store/src/test') diff --git a/settings.gradle b/settings.gradle index 3149380d..94a3c2e6 100644 --- a/settings.gradle +++ b/settings.gradle @@ -7,6 +7,8 @@ include 'language-model' include 'language-semantics' include 'language-web' include 'store' +include 'store-partial' +include 'store-query' include 'store-query-viatra' for (project in rootProject.children) { diff --git a/subprojects/store-partial/build.gradle b/subprojects/store-partial/build.gradle new file mode 100644 index 00000000..cb440d9f --- /dev/null +++ b/subprojects/store-partial/build.gradle @@ -0,0 +1,7 @@ +plugins { + id 'refinery-java-library' +} + +dependencies { + api project(':refinery-store-query') +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/AnyPartialSymbolInterpretation.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/AnyPartialSymbolInterpretation.java new file mode 100644 index 00000000..b6b1f2be --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/AnyPartialSymbolInterpretation.java @@ -0,0 +1,13 @@ +package tools.refinery.store.partial; + +import tools.refinery.store.partial.representation.AnyPartialSymbol; + +public sealed interface AnyPartialSymbolInterpretation permits PartialSymbolInterpretation { + PartialInterpretationAdapter getAdapter(); + + AnyPartialSymbol getPartialSymbol(); + + int countUnfinished(); + + int countErrors(); +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/MergeResult.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/MergeResult.java new file mode 100644 index 00000000..82414d87 --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/MergeResult.java @@ -0,0 +1,15 @@ +package tools.refinery.store.partial; + +public enum MergeResult { + UNCHANGED, + REFINED, + REJECTED; + + public MergeResult andAlso(MergeResult other) { + return switch (this) { + case UNCHANGED -> other; + case REFINED -> other == REJECTED ? REJECTED : REFINED; + case REJECTED -> REJECTED; + }; + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/PartialInterpretation.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/PartialInterpretation.java new file mode 100644 index 00000000..d76f8728 --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/PartialInterpretation.java @@ -0,0 +1,24 @@ +package tools.refinery.store.partial; + +import tools.refinery.store.partial.internal.PartialInterpretationBuilderImpl; +import tools.refinery.store.adapter.ModelAdapterBuilderFactory; +import tools.refinery.store.model.ModelStoreBuilder; +import tools.refinery.store.partial.representation.PartialRelation; + +public final class PartialInterpretation extends ModelAdapterBuilderFactory { + public static final PartialInterpretation ADAPTER = new PartialInterpretation(); + + public static final PartialRelation EXISTS = new PartialRelation("exists", 1); + + public static final PartialRelation EQUALS = new PartialRelation("equals", 1); + + private PartialInterpretation() { + super(PartialInterpretationAdapter.class, PartialInterpretationStoreAdapter.class, PartialInterpretationBuilder.class); + } + + @Override + public PartialInterpretationBuilder createBuilder(ModelStoreBuilder storeBuilder) { + return new PartialInterpretationBuilderImpl(storeBuilder); + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/PartialInterpretationAdapter.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/PartialInterpretationAdapter.java new file mode 100644 index 00000000..b811ae7a --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/PartialInterpretationAdapter.java @@ -0,0 +1,20 @@ +package tools.refinery.store.partial; + +import tools.refinery.store.adapter.ModelAdapter; +import tools.refinery.store.partial.representation.AnyPartialSymbol; +import tools.refinery.store.partial.representation.PartialSymbol; +import tools.refinery.store.query.Dnf; +import tools.refinery.store.query.ResultSet; + +public interface PartialInterpretationAdapter extends ModelAdapter { + @Override + PartialInterpretationStoreAdapter getStoreAdapter(); + + default AnyPartialSymbolInterpretation getPartialInterpretation(AnyPartialSymbol partialSymbol) { + return getPartialInterpretation((PartialSymbol) partialSymbol); + } + + PartialSymbolInterpretation getPartialInterpretation(PartialSymbol partialSymbol); + + ResultSet getLiftedResultSet(Dnf query); +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/PartialInterpretationBuilder.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/PartialInterpretationBuilder.java new file mode 100644 index 00000000..db042466 --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/PartialInterpretationBuilder.java @@ -0,0 +1,28 @@ +package tools.refinery.store.partial; + +import tools.refinery.store.adapter.ModelAdapterBuilder; +import tools.refinery.store.model.ModelStore; +import tools.refinery.store.query.Dnf; +import tools.refinery.store.partial.literal.Modality; + +import java.util.Collection; +import java.util.List; + +@SuppressWarnings("UnusedReturnValue") +public interface PartialInterpretationBuilder extends ModelAdapterBuilder { + default PartialInterpretationBuilder liftedQueries(Dnf... liftedQueries) { + return liftedQueries(List.of(liftedQueries)); + } + + default PartialInterpretationBuilder liftedQueries(Collection liftedQueries) { + liftedQueries.forEach(this::liftedQuery); + return this; + } + + PartialInterpretationBuilder liftedQuery(Dnf liftedQuery); + + Dnf lift(Modality modality, Dnf query); + + @Override + PartialInterpretationStoreAdapter createStoreAdapter(ModelStore store); +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/PartialInterpretationStoreAdapter.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/PartialInterpretationStoreAdapter.java new file mode 100644 index 00000000..a1813671 --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/PartialInterpretationStoreAdapter.java @@ -0,0 +1,17 @@ +package tools.refinery.store.partial; + +import tools.refinery.store.adapter.ModelStoreAdapter; +import tools.refinery.store.model.Model; +import tools.refinery.store.partial.representation.AnyPartialSymbol; +import tools.refinery.store.query.Dnf; + +import java.util.Collection; + +public interface PartialInterpretationStoreAdapter extends ModelStoreAdapter { + Collection getPartialSymbols(); + + Collection getLiftedQueries(); + + @Override + PartialInterpretationAdapter createModelAdapter(Model model); +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/PartialSymbolInterpretation.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/PartialSymbolInterpretation.java new file mode 100644 index 00000000..fa9e9216 --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/PartialSymbolInterpretation.java @@ -0,0 +1,22 @@ +package tools.refinery.store.partial; + +import tools.refinery.store.partial.representation.PartialSymbol; +import tools.refinery.store.map.Cursor; +import tools.refinery.store.tuple.Tuple; + +public non-sealed interface PartialSymbolInterpretation extends AnyPartialSymbolInterpretation { + @Override + PartialSymbol getPartialSymbol(); + + A get(Tuple key); + + Cursor getAll(); + + Cursor getAllErrors(); + + MergeResult merge(Tuple key, A value); + + C getConcrete(Tuple key); + + Cursor getAllConcrete(); +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/internal/PartialInterpretationAdapterImpl.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/internal/PartialInterpretationAdapterImpl.java new file mode 100644 index 00000000..c482d8a2 --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/internal/PartialInterpretationAdapterImpl.java @@ -0,0 +1,38 @@ +package tools.refinery.store.partial.internal; + +import tools.refinery.store.model.Model; +import tools.refinery.store.partial.PartialInterpretationAdapter; +import tools.refinery.store.partial.PartialSymbolInterpretation; +import tools.refinery.store.partial.representation.PartialSymbol; +import tools.refinery.store.query.Dnf; +import tools.refinery.store.query.ResultSet; + +public class PartialInterpretationAdapterImpl implements PartialInterpretationAdapter { + private final Model model; + private final PartialInterpretationStoreAdapterImpl storeAdapter; + + PartialInterpretationAdapterImpl(Model model, PartialInterpretationStoreAdapterImpl storeAdapter) { + this.model = model; + this.storeAdapter = storeAdapter; + } + + @Override + public Model getModel() { + return model; + } + + @Override + public PartialInterpretationStoreAdapterImpl getStoreAdapter() { + return storeAdapter; + } + + @Override + public PartialSymbolInterpretation getPartialInterpretation(PartialSymbol partialSymbol) { + return null; + } + + @Override + public ResultSet getLiftedResultSet(Dnf query) { + return null; + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/internal/PartialInterpretationBuilderImpl.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/internal/PartialInterpretationBuilderImpl.java new file mode 100644 index 00000000..5853aeaf --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/internal/PartialInterpretationBuilderImpl.java @@ -0,0 +1,29 @@ +package tools.refinery.store.partial.internal; + +import tools.refinery.store.adapter.AbstractModelAdapterBuilder; +import tools.refinery.store.model.ModelStore; +import tools.refinery.store.model.ModelStoreBuilder; +import tools.refinery.store.partial.PartialInterpretationBuilder; +import tools.refinery.store.partial.literal.Modality; +import tools.refinery.store.query.Dnf; + +public class PartialInterpretationBuilderImpl extends AbstractModelAdapterBuilder implements PartialInterpretationBuilder { + public PartialInterpretationBuilderImpl(ModelStoreBuilder storeBuilder) { + super(storeBuilder); + } + + @Override + public PartialInterpretationBuilder liftedQuery(Dnf liftedQuery) { + return null; + } + + @Override + public Dnf lift(Modality modality, Dnf query) { + return null; + } + + @Override + public PartialInterpretationStoreAdapterImpl createStoreAdapter(ModelStore store) { + return null; + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/internal/PartialInterpretationStoreAdapterImpl.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/internal/PartialInterpretationStoreAdapterImpl.java new file mode 100644 index 00000000..0486af6e --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/internal/PartialInterpretationStoreAdapterImpl.java @@ -0,0 +1,37 @@ +package tools.refinery.store.partial.internal; + +import tools.refinery.store.partial.PartialInterpretationStoreAdapter; +import tools.refinery.store.model.Model; +import tools.refinery.store.model.ModelStore; +import tools.refinery.store.partial.representation.AnyPartialSymbol; +import tools.refinery.store.query.Dnf; + +import java.util.Collection; + +public class PartialInterpretationStoreAdapterImpl implements PartialInterpretationStoreAdapter { + private final ModelStore store; + + PartialInterpretationStoreAdapterImpl(ModelStore store) { + this.store = store; + } + + @Override + public ModelStore getStore() { + return store; + } + + @Override + public Collection getPartialSymbols() { + return null; + } + + @Override + public Collection getLiftedQueries() { + return null; + } + + @Override + public PartialInterpretationAdapterImpl createModelAdapter(Model model) { + return new PartialInterpretationAdapterImpl(model, this); + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/lifting/DnfLifter.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/lifting/DnfLifter.java new file mode 100644 index 00000000..1c35b925 --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/lifting/DnfLifter.java @@ -0,0 +1,107 @@ +package tools.refinery.store.partial.lifting; + +import org.jetbrains.annotations.Nullable; +import tools.refinery.store.partial.literal.ModalDnfCallLiteral; +import tools.refinery.store.partial.PartialInterpretation; +import tools.refinery.store.partial.literal.ModalRelationLiteral; +import tools.refinery.store.partial.literal.PartialRelationLiteral; +import tools.refinery.store.query.Dnf; +import tools.refinery.store.query.DnfBuilder; +import tools.refinery.store.query.DnfClause; +import tools.refinery.store.query.Variable; +import tools.refinery.store.query.literal.CallPolarity; +import tools.refinery.store.query.literal.DnfCallLiteral; +import tools.refinery.store.query.literal.Literal; +import tools.refinery.store.partial.literal.Modality; +import tools.refinery.store.util.CycleDetectingMapper; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; + +public class DnfLifter { + private final CycleDetectingMapper mapper = new CycleDetectingMapper<>(ModalDnf::toString, + this::doLift); + + public Dnf lift(Modality modality, Dnf query) { + return mapper.map(new ModalDnf(modality, query)); + } + + private Dnf doLift(ModalDnf modalDnf) { + var modality = modalDnf.modality(); + var dnf = modalDnf.dnf(); + var builder = Dnf.builder(); + builder.parameters(dnf.getParameters()); + boolean changed = false; + for (var clause : dnf.getClauses()) { + if (liftClause(modality, clause, builder)) { + changed = true; + } + } + if (changed) { + return builder.build(); + } + return dnf; + } + + private boolean liftClause(Modality modality, DnfClause clause, DnfBuilder builder) { + boolean changed = false; + var quantifiedVariables = new HashSet<>(clause.quantifiedVariables()); + var literals = clause.literals(); + var liftedLiterals = new ArrayList(literals.size()); + for (var literal : literals) { + Literal liftedLiteral = liftLiteral(modality, literal); + if (liftedLiteral == null) { + liftedLiteral = literal; + } else { + changed = true; + } + liftedLiterals.add(liftedLiteral); + var variable = isExistsLiteralForVariable(modality, liftedLiteral); + if (variable != null) { + // If we already quantify over the existence of the variable with the expected modality, + // we don't need to insert quantification manually. + quantifiedVariables.remove(variable); + } + } + for (var quantifiedVariable : quantifiedVariables) { + // Quantify over variables that are not already quantified with the expected modality. + liftedLiterals.add(PartialInterpretation.EXISTS.call(CallPolarity.POSITIVE, modality, + List.of(quantifiedVariable))); + } + builder.clause(liftedLiterals); + return changed || !quantifiedVariables.isEmpty(); + } + + @Nullable + private Variable isExistsLiteralForVariable(Modality modality, Literal literal) { + if (literal instanceof ModalRelationLiteral modalRelationLiteral && + modalRelationLiteral.getPolarity() == CallPolarity.POSITIVE && + modalRelationLiteral.getModality() == modality && + modalRelationLiteral.getTarget().equals(PartialInterpretation.EXISTS)) { + return modalRelationLiteral.getArguments().get(0); + } + return null; + } + + @Nullable + private Literal liftLiteral(Modality modality, Literal literal) { + if (literal instanceof PartialRelationLiteral partialRelationLiteral) { + return new ModalRelationLiteral(modality, partialRelationLiteral); + } else if (literal instanceof DnfCallLiteral dnfCallLiteral) { + var polarity = dnfCallLiteral.getPolarity(); + var target = dnfCallLiteral.getTarget(); + var liftedTarget = lift(modality.commute(polarity), target); + if (target.equals(liftedTarget)) { + return null; + } + return new DnfCallLiteral(polarity, liftedTarget, dnfCallLiteral.getArguments()); + } else if (literal instanceof ModalDnfCallLiteral modalDnfCallLiteral) { + var liftedTarget = lift(modalDnfCallLiteral.getModality(), modalDnfCallLiteral.getTarget()); + return new DnfCallLiteral(modalDnfCallLiteral.getPolarity(), liftedTarget, + modalDnfCallLiteral.getArguments()); + } else { + return null; + } + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/lifting/ModalDnf.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/lifting/ModalDnf.java new file mode 100644 index 00000000..6fe54ad9 --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/lifting/ModalDnf.java @@ -0,0 +1,11 @@ +package tools.refinery.store.partial.lifting; + +import tools.refinery.store.query.Dnf; +import tools.refinery.store.partial.literal.Modality; + +public record ModalDnf(Modality modality, Dnf dnf) { + @Override + public String toString() { + return "%s %s".formatted(modality, dnf.name()); + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalDnfCallLiteral.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalDnfCallLiteral.java new file mode 100644 index 00000000..a49e0625 --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalDnfCallLiteral.java @@ -0,0 +1,37 @@ +package tools.refinery.store.partial.literal; + +import tools.refinery.store.query.Dnf; +import tools.refinery.store.query.Variable; +import tools.refinery.store.query.literal.CallPolarity; +import tools.refinery.store.query.literal.DnfCallLiteral; +import tools.refinery.store.query.literal.LiteralReduction; +import tools.refinery.store.query.literal.PolarLiteral; + +import java.util.List; +import java.util.Map; + +public class ModalDnfCallLiteral extends ModalLiteral implements PolarLiteral { + public ModalDnfCallLiteral(CallPolarity polarity, Modality modality, Dnf target, List arguments) { + super(polarity, modality, target, arguments); + } + + public ModalDnfCallLiteral(Modality modality, DnfCallLiteral baseLiteral) { + super(modality.commute(baseLiteral.getPolarity()), baseLiteral); + } + + @Override + public ModalDnfCallLiteral substitute(Map substitution) { + return new ModalDnfCallLiteral(getPolarity(), getModality(), getTarget(), substituteArguments(substitution)); + } + + @Override + public ModalDnfCallLiteral negate() { + return new ModalDnfCallLiteral(getPolarity().negate(), getModality(), getTarget(), getArguments()); + } + + @Override + public LiteralReduction getReduction() { + var dnfReduction = getTarget().getReduction(); + return getPolarity().isPositive() ? dnfReduction : dnfReduction.negate(); + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalLiteral.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalLiteral.java new file mode 100644 index 00000000..a1b6c83e --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalLiteral.java @@ -0,0 +1,45 @@ +package tools.refinery.store.partial.literal; + +import tools.refinery.store.query.RelationLike; +import tools.refinery.store.query.Variable; +import tools.refinery.store.query.literal.CallLiteral; +import tools.refinery.store.query.literal.CallPolarity; + +import java.util.List; +import java.util.Objects; + +public abstract class ModalLiteral extends CallLiteral { + private final Modality modality; + + protected ModalLiteral(CallPolarity polarity, Modality modality, T target, List arguments) { + super(polarity, target, arguments); + this.modality = modality; + } + + protected ModalLiteral(Modality modality, CallLiteral baseLiteral) { + this(baseLiteral.getPolarity(), commute(modality, baseLiteral.getPolarity()), baseLiteral.getTarget(), + baseLiteral.getArguments()); + } + + public Modality getModality() { + return modality; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + if (!super.equals(o)) return false; + ModalLiteral that = (ModalLiteral) o; + return modality == that.modality; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), modality); + } + + private static Modality commute(Modality modality, CallPolarity polarity) { + return polarity.isPositive() ? modality : modality.negate(); + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalRelationLiteral.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalRelationLiteral.java new file mode 100644 index 00000000..dbaa524f --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalRelationLiteral.java @@ -0,0 +1,31 @@ +package tools.refinery.store.partial.literal; + +import tools.refinery.store.partial.representation.PartialRelation; +import tools.refinery.store.query.Variable; +import tools.refinery.store.query.literal.CallPolarity; +import tools.refinery.store.query.literal.PolarLiteral; + +import java.util.List; +import java.util.Map; + +public final class ModalRelationLiteral extends ModalLiteral + implements PolarLiteral { + public ModalRelationLiteral(CallPolarity polarity, Modality modality, PartialRelation target, + List arguments) { + super(polarity, modality, target, arguments); + } + + public ModalRelationLiteral(Modality modality, PartialRelationLiteral baseLiteral) { + super(modality, baseLiteral); + } + + @Override + public ModalRelationLiteral substitute(Map substitution) { + return new ModalRelationLiteral(getPolarity(), getModality(), getTarget(), substituteArguments(substitution)); + } + + @Override + public ModalRelationLiteral negate() { + return new ModalRelationLiteral(getPolarity().negate(), getModality(), getTarget(), getArguments()); + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/Modality.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/Modality.java new file mode 100644 index 00000000..d647ef0a --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/Modality.java @@ -0,0 +1,31 @@ +package tools.refinery.store.partial.literal; + +import tools.refinery.store.query.literal.CallPolarity; + +import java.util.Locale; + +public enum Modality { + MUST, + MAY, + CURRENT; + + public Modality negate() { + return switch(this) { + case MUST -> MAY; + case MAY -> MUST; + case CURRENT -> CURRENT; + }; + } + + public Modality commute(CallPolarity polarity) { + if (polarity.isPositive()) { + return this; + } + return this.negate(); + } + + @Override + public String toString() { + return name().toLowerCase(Locale.ROOT); + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/PartialLiterals.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/PartialLiterals.java new file mode 100644 index 00000000..51d388d3 --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/PartialLiterals.java @@ -0,0 +1,33 @@ +package tools.refinery.store.partial.literal; + +import tools.refinery.store.query.literal.DnfCallLiteral; + +public final class PartialLiterals { + private PartialLiterals() { + throw new IllegalStateException("This is a static utility class and should not be instantiated directly"); + } + + public ModalRelationLiteral may(PartialRelationLiteral literal) { + return new ModalRelationLiteral(Modality.MAY, literal); + } + + public ModalRelationLiteral must(PartialRelationLiteral literal) { + return new ModalRelationLiteral(Modality.MUST, literal); + } + + public ModalRelationLiteral current(PartialRelationLiteral literal) { + return new ModalRelationLiteral(Modality.CURRENT, literal); + } + + public ModalDnfCallLiteral may(DnfCallLiteral literal) { + return new ModalDnfCallLiteral(Modality.MAY, literal); + } + + public ModalDnfCallLiteral must(DnfCallLiteral literal) { + return new ModalDnfCallLiteral(Modality.MUST, literal); + } + + public ModalDnfCallLiteral current(DnfCallLiteral literal) { + return new ModalDnfCallLiteral(Modality.CURRENT, literal); + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/PartialRelationLiteral.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/PartialRelationLiteral.java new file mode 100644 index 00000000..dc1a1da3 --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/PartialRelationLiteral.java @@ -0,0 +1,27 @@ +package tools.refinery.store.partial.literal; + +import tools.refinery.store.partial.representation.PartialRelation; +import tools.refinery.store.query.Variable; +import tools.refinery.store.query.literal.CallLiteral; +import tools.refinery.store.query.literal.CallPolarity; +import tools.refinery.store.query.literal.PolarLiteral; + +import java.util.List; +import java.util.Map; + +public final class PartialRelationLiteral extends CallLiteral + implements PolarLiteral { + public PartialRelationLiteral(CallPolarity polarity, PartialRelation target, List substitution) { + super(polarity, target, substitution); + } + + @Override + public PartialRelationLiteral substitute(Map substitution) { + return new PartialRelationLiteral(getPolarity(), getTarget(), substituteArguments(substitution)); + } + + @Override + public PartialRelationLiteral negate() { + return new PartialRelationLiteral(getPolarity().negate(), getTarget(), getArguments()); + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/representation/AnyPartialFunction.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/representation/AnyPartialFunction.java new file mode 100644 index 00000000..1113245e --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/representation/AnyPartialFunction.java @@ -0,0 +1,4 @@ +package tools.refinery.store.partial.representation; + +public sealed interface AnyPartialFunction extends AnyPartialSymbol permits PartialFunction { +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/representation/AnyPartialSymbol.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/representation/AnyPartialSymbol.java new file mode 100644 index 00000000..25096e74 --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/representation/AnyPartialSymbol.java @@ -0,0 +1,11 @@ +package tools.refinery.store.partial.representation; + +import tools.refinery.store.representation.AnyAbstractDomain; + +public sealed interface AnyPartialSymbol permits AnyPartialFunction, PartialSymbol { + String name(); + + int arity(); + + AnyAbstractDomain abstractDomain(); +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/representation/PartialFunction.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/representation/PartialFunction.java new file mode 100644 index 00000000..3c186f6f --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/representation/PartialFunction.java @@ -0,0 +1,32 @@ +package tools.refinery.store.partial.representation; + +import tools.refinery.store.representation.AbstractDomain; + +public record PartialFunction(String name, int arity, AbstractDomain abstractDomain) + implements AnyPartialFunction, PartialSymbol { + @Override + public A defaultValue() { + return null; + } + + @Override + public C defaultConcreteValue() { + return null; + } + + @Override + public boolean equals(Object o) { + return this == o; + } + + @Override + public int hashCode() { + // Compare by identity to make hash table lookups more efficient. + return System.identityHashCode(this); + } + + @Override + public String toString() { + return "%s/%d".formatted(name, arity); + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/representation/PartialRelation.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/representation/PartialRelation.java new file mode 100644 index 00000000..51c2f28d --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/representation/PartialRelation.java @@ -0,0 +1,66 @@ +package tools.refinery.store.partial.representation; + +import tools.refinery.store.partial.literal.Modality; +import tools.refinery.store.partial.literal.PartialRelationLiteral; +import tools.refinery.store.partial.literal.ModalRelationLiteral; +import tools.refinery.store.query.RelationLike; +import tools.refinery.store.query.Variable; +import tools.refinery.store.query.literal.CallPolarity; +import tools.refinery.store.representation.AbstractDomain; +import tools.refinery.store.representation.TruthValue; +import tools.refinery.store.representation.TruthValueDomain; + +import java.util.List; + +public record PartialRelation(String name, int arity) implements PartialSymbol, RelationLike { + @Override + public AbstractDomain abstractDomain() { + return TruthValueDomain.INSTANCE; + } + + @Override + public TruthValue defaultValue() { + return TruthValue.FALSE; + } + + @Override + public Boolean defaultConcreteValue() { + return false; + } + + public ModalRelationLiteral call(CallPolarity polarity, Modality modality, List arguments) { + return new ModalRelationLiteral(polarity, modality, this, arguments); + } + + public PartialRelationLiteral call(CallPolarity polarity, List arguments) { + return new PartialRelationLiteral(polarity, this, arguments); + } + + public PartialRelationLiteral call(CallPolarity polarity, Variable... arguments) { + return call(polarity, List.of(arguments)); + } + + public PartialRelationLiteral call(Variable... arguments) { + return call(CallPolarity.POSITIVE, arguments); + } + + public PartialRelationLiteral callTransitive(Variable left, Variable right) { + return call(CallPolarity.TRANSITIVE, List.of(left, right)); + } + + @Override + public boolean equals(Object o) { + return this == o; + } + + @Override + public int hashCode() { + // Compare by identity to make hash table lookups more efficient. + return System.identityHashCode(this); + } + + @Override + public String toString() { + return "%s/%d".formatted(name, arity); + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/representation/PartialSymbol.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/representation/PartialSymbol.java new file mode 100644 index 00000000..38533fa9 --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/representation/PartialSymbol.java @@ -0,0 +1,12 @@ +package tools.refinery.store.partial.representation; + +import tools.refinery.store.representation.AbstractDomain; + +public sealed interface PartialSymbol extends AnyPartialSymbol permits PartialFunction, PartialRelation { + @Override + AbstractDomain abstractDomain(); + + A defaultValue(); + + C defaultConcreteValue(); +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/rule/RelationRefinementAction.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/rule/RelationRefinementAction.java new file mode 100644 index 00000000..6c89653d --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/rule/RelationRefinementAction.java @@ -0,0 +1,36 @@ +package tools.refinery.store.partial.rule; + +import tools.refinery.store.partial.PartialInterpretation; +import tools.refinery.store.partial.representation.PartialRelation; +import tools.refinery.store.model.Model; +import tools.refinery.store.query.Variable; +import tools.refinery.store.representation.TruthValue; +import tools.refinery.store.tuple.Tuple; + +import java.util.List; + +public record RelationRefinementAction(PartialRelation target, List arguments, TruthValue value) + implements RuleAction { + public RelationRefinementAction { + if (arguments.size() != target.arity()) { + throw new IllegalArgumentException("%s needs %d parameters, but got %s".formatted(target.name(), + target.arity(), arguments.size())); + } + if (value == TruthValue.UNKNOWN) { + throw new IllegalArgumentException("Refining with UNKNOWN has no effect"); + } + } + + @Override + public RuleActionExecutor createExecutor(int[] argumentIndices, Model model) { + var targetInterpretation = model.getAdapter(PartialInterpretation.ADAPTER).getPartialInterpretation(target); + return activationTuple -> { + int arity = argumentIndices.length; + var arguments = new int[arity]; + for (int i = 0; i < arity; i++) { + arguments[i] = activationTuple.get(argumentIndices[i]); + } + return targetInterpretation.merge(Tuple.of(arguments), value); + }; + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/rule/Rule.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/rule/Rule.java new file mode 100644 index 00000000..c114b8cf --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/rule/Rule.java @@ -0,0 +1,38 @@ +package tools.refinery.store.partial.rule; + +import tools.refinery.store.model.Model; +import tools.refinery.store.query.Dnf; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; + +public record Rule(Dnf precondition, List actions) { + public Rule { + var parameterSet = new HashSet<>(precondition.getParameters()); + for (var action : actions) { + for (var argument : action.arguments()) { + if (!parameterSet.contains(argument)) { + throw new IllegalArgumentException( + "Argument %s of action %s does not appear in the parameter list %s of %s" + .formatted(argument, action, precondition.getParameters(), precondition.name())); + } + } + } + } + + public RuleExecutor createExecutor(Model model) { + var parameters = precondition.getParameters(); + var actionExecutors = new ArrayList(actions.size()); + for (var action : actions) { + var arguments = action.arguments(); + int arity = arguments.size(); + var argumentIndices = new int[arity]; + for (int i = 0; i < arity; i++) { + argumentIndices[i] = parameters.indexOf(arguments.get(i)); + } + actionExecutors.add(action.createExecutor(argumentIndices, model)); + } + return new RuleExecutor(this, model, actionExecutors); + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/rule/RuleAction.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/rule/RuleAction.java new file mode 100644 index 00000000..7a8ede40 --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/rule/RuleAction.java @@ -0,0 +1,12 @@ +package tools.refinery.store.partial.rule; + +import tools.refinery.store.model.Model; +import tools.refinery.store.query.Variable; + +import java.util.List; + +public interface RuleAction { + List arguments(); + + RuleActionExecutor createExecutor(int[] argumentIndices, Model model); +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/rule/RuleActionExecutor.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/rule/RuleActionExecutor.java new file mode 100644 index 00000000..1c2db5f1 --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/rule/RuleActionExecutor.java @@ -0,0 +1,9 @@ +package tools.refinery.store.partial.rule; + +import tools.refinery.store.partial.MergeResult; +import tools.refinery.store.tuple.TupleLike; + +@FunctionalInterface +public interface RuleActionExecutor { + MergeResult execute(TupleLike activationTuple); +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/rule/RuleExecutor.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/rule/RuleExecutor.java new file mode 100644 index 00000000..41d79306 --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/rule/RuleExecutor.java @@ -0,0 +1,34 @@ +package tools.refinery.store.partial.rule; + +import tools.refinery.store.partial.MergeResult; +import tools.refinery.store.model.Model; +import tools.refinery.store.tuple.TupleLike; + +import java.util.List; + +public final class RuleExecutor { + private final Rule rule; + private final Model model; + private final List actionExecutors; + + RuleExecutor(Rule rule, Model model, List actionExecutors) { + this.rule = rule; + this.model = model; + this.actionExecutors = actionExecutors; + } + + public Rule getRule() { + return rule; + } + + public Model getModel() { + return model; + } + public MergeResult execute(TupleLike activationTuple) { + MergeResult mergeResult = MergeResult.UNCHANGED; + for (var actionExecutor : actionExecutors) { + mergeResult = mergeResult.andAlso(actionExecutor.execute(activationTuple)); + } + return mergeResult; + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/Advice.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/Advice.java new file mode 100644 index 00000000..65040a8e --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/Advice.java @@ -0,0 +1,155 @@ +package tools.refinery.store.partial.translator; + +import tools.refinery.store.partial.representation.AnyPartialSymbol; +import tools.refinery.store.partial.representation.PartialRelation; +import tools.refinery.store.query.Variable; +import tools.refinery.store.query.literal.Literal; + +import java.util.*; + +public final class Advice { + private final AnyPartialSymbol source; + private final PartialRelation target; + private final AdviceSlot slot; + private final boolean mandatory; + private final List parameters; + private final List literals; + private boolean processed; + + public Advice(AnyPartialSymbol source, PartialRelation target, AdviceSlot slot, boolean mandatory, List parameters, List literals) { + if (mandatory && !slot.isMonotonic()) { + throw new IllegalArgumentException("Only monotonic advice can be mandatory"); + } + this.source = source; + this.target = target; + this.slot = slot; + this.mandatory = mandatory; + checkArity(parameters); + this.parameters = parameters; + this.literals = literals; + } + + public AnyPartialSymbol source() { + return source; + } + + public PartialRelation target() { + return target; + } + + public AdviceSlot slot() { + return slot; + } + + public boolean mandatory() { + return mandatory; + } + + public List parameters() { + return parameters; + } + + public List literals() { + return literals; + } + + public boolean processed() { + return processed; + } + + public List substitute(List substituteParameters) { + checkArity(substituteParameters); + markProcessed(); + int arity = parameters.size(); + var substitution = new HashMap(arity); + for (int i = 0; i < arity; i++) { + substitution.put(parameters.get(i), substituteParameters.get(i)); + } + return literals.stream().map(literal -> literal.substitute(substitution)).toList(); + } + + private void markProcessed() { + processed = true; + } + + public void checkProcessed() { + if (mandatory && !processed) { + throw new IllegalStateException("Mandatory advice %s was not processed".formatted(this)); + } + } + + private void checkArity(List toCheck) { + if (toCheck.size() != target.arity()) { + throw new IllegalArgumentException("%s needs %d parameters, but got %s".formatted(target.name(), + target.arity(), parameters.size())); + } + } + + public static Builder builderFor(AnyPartialSymbol source, PartialRelation target, AdviceSlot slot) { + return new Builder(source, target, slot); + } + + + @Override + public String toString() { + return "Advice[source=%s, target=%s, slot=%s, mandatory=%s, parameters=%s, literals=%s]".formatted(source, + target, slot, mandatory, parameters, literals); + } + + public static class Builder { + private final AnyPartialSymbol source; + private final PartialRelation target; + private final AdviceSlot slot; + private boolean mandatory; + private final List parameters = new ArrayList<>(); + private final List literals = new ArrayList<>(); + + private Builder(AnyPartialSymbol source, PartialRelation target, AdviceSlot slot) { + this.source = source; + this.target = target; + this.slot = slot; + } + + public Builder mandatory(boolean mandatory) { + this.mandatory = mandatory; + return this; + } + + public Builder mandatory() { + return mandatory(false); + } + + public Builder parameters(List variables) { + parameters.addAll(variables); + return this; + } + + public Builder parameters(Variable... variables) { + return parameters(List.of(variables)); + } + + public Builder parameter(Variable variable) { + parameters.add(variable); + return this; + } + + public Builder literals(Collection literals) { + this.literals.addAll(literals); + return this; + } + + public Builder literals(Literal... literals) { + return literals(List.of(literals)); + } + + public Builder literal(Literal literal) { + literals.add(literal); + return this; + } + + public Advice build() { + return new Advice(source, target, slot, mandatory, Collections.unmodifiableList(parameters), + Collections.unmodifiableList(literals)); + } + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/AdviceSlot.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/AdviceSlot.java new file mode 100644 index 00000000..3702a8ac --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/AdviceSlot.java @@ -0,0 +1,25 @@ +package tools.refinery.store.partial.translator; + +import tools.refinery.store.representation.TruthValue; + +public enum AdviceSlot { + EXTEND_MUST(true), + + RESTRICT_MAY(true), + + /** + * Same as {@link #RESTRICT_MAY}, but only active if the value of the relation is not {@link TruthValue#TRUE} or + * {@link TruthValue#ERROR}. + */ + RESTRICT_NEW(false); + + private final boolean monotonic; + + AdviceSlot(boolean monotonic) { + this.monotonic = monotonic; + } + + public boolean isMonotonic() { + return monotonic; + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/Seed.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/Seed.java new file mode 100644 index 00000000..c56b06ed --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/Seed.java @@ -0,0 +1,12 @@ +package tools.refinery.store.partial.translator; + +import tools.refinery.store.map.Cursor; +import tools.refinery.store.tuple.Tuple; + +public interface Seed { + int arity(); + + T get(Tuple key); + + Cursor getCursor(T defaultValue, int nodeCount); +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/TranslationUnit.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/TranslationUnit.java new file mode 100644 index 00000000..26bd909b --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/TranslationUnit.java @@ -0,0 +1,48 @@ +package tools.refinery.store.partial.translator; + +import tools.refinery.store.partial.PartialInterpretationBuilder; +import tools.refinery.store.model.Model; +import tools.refinery.store.model.ModelStoreBuilder; +import tools.refinery.store.partial.AnyPartialSymbolInterpretation; +import tools.refinery.store.partial.literal.Modality; +import tools.refinery.store.partial.representation.AnyPartialSymbol; +import tools.refinery.store.partial.representation.PartialRelation; +import tools.refinery.store.query.Variable; +import tools.refinery.store.query.literal.CallPolarity; +import tools.refinery.store.query.literal.Literal; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +public abstract class TranslationUnit { + private PartialInterpretationBuilder partialInterpretationBuilder; + + protected PartialInterpretationBuilder getPartialInterpretationBuilder() { + return partialInterpretationBuilder; + } + + public void setPartialInterpretationBuilder(PartialInterpretationBuilder partialInterpretationBuilder) { + this.partialInterpretationBuilder = partialInterpretationBuilder; + } + + protected ModelStoreBuilder getModelStoreBuilder() { + return partialInterpretationBuilder.getStoreBuilder(); + } + + public abstract Collection getTranslatedPartialSymbols(); + + public Collection computeAdvices() { + // No advices to give by default. + return List.of(); + } + + public abstract void configure(Collection advices); + + public abstract List call(CallPolarity polarity, Modality modality, PartialRelation target, + List arguments); + + public abstract Map createPartialInterpretations(Model model); + + public abstract void initializeModel(Model model, int nodeCount); +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/EliminatedType.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/EliminatedType.java new file mode 100644 index 00000000..9adf6bc8 --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/EliminatedType.java @@ -0,0 +1,6 @@ +package tools.refinery.store.partial.translator.typehierarchy; + +import tools.refinery.store.partial.representation.PartialRelation; + +record EliminatedType(PartialRelation replacement) implements TypeAnalysisResult { +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/ExtendedTypeInfo.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/ExtendedTypeInfo.java new file mode 100644 index 00000000..d3f66a4c --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/ExtendedTypeInfo.java @@ -0,0 +1,101 @@ +package tools.refinery.store.partial.translator.typehierarchy; + +import org.jetbrains.annotations.NotNull; +import tools.refinery.store.partial.representation.PartialRelation; + +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.Objects; +import java.util.Set; + +final class ExtendedTypeInfo implements Comparable { + private final int index; + private final PartialRelation type; + private final TypeInfo typeInfo; + private final Set allSubtypes = new LinkedHashSet<>(); + private final Set allSupertypes; + private final Set concreteSubtypesAndSelf = new LinkedHashSet<>(); + private Set directSubtypes; + private final Set unsortedDirectSupertypes = new HashSet<>(); + + public ExtendedTypeInfo(int index, PartialRelation type, TypeInfo typeInfo) { + this.index = index; + this.type = type; + this.typeInfo = typeInfo; + this.allSupertypes = new LinkedHashSet<>(typeInfo.supertypes()); + } + + public PartialRelation getType() { + return type; + } + + public TypeInfo getTypeInfo() { + return typeInfo; + } + + public boolean isAbstractType() { + return getTypeInfo().abstractType(); + } + + public Set getAllSubtypes() { + return allSubtypes; + } + + public Set getAllSupertypes() { + return allSupertypes; + } + + public Set getAllSupertypesAndSelf() { + var allSubtypesAndSelf = new HashSet(allSupertypes.size() + 1); + addMust(allSubtypesAndSelf); + return allSubtypesAndSelf; + } + + public Set getConcreteSubtypesAndSelf() { + return concreteSubtypesAndSelf; + } + + public Set getDirectSubtypes() { + return directSubtypes; + } + + public Set getUnsortedDirectSupertypes() { + return unsortedDirectSupertypes; + } + + public void setDirectSubtypes(Set directSubtypes) { + this.directSubtypes = directSubtypes; + } + + public boolean allowsAllConcreteTypes(Set concreteTypes) { + for (var concreteType : concreteTypes) { + if (!concreteSubtypesAndSelf.contains(concreteType)) { + return false; + } + } + return true; + } + + public void addMust(Set mustTypes) { + mustTypes.add(type); + mustTypes.addAll(allSupertypes); + } + + @Override + public int compareTo(@NotNull ExtendedTypeInfo extendedTypeInfo) { + return Integer.compare(index, extendedTypeInfo.index); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ExtendedTypeInfo that = (ExtendedTypeInfo) o; + return index == that.index; + } + + @Override + public int hashCode() { + return Objects.hash(index); + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/InferredMayTypeRelationView.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/InferredMayTypeRelationView.java new file mode 100644 index 00000000..ff761936 --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/InferredMayTypeRelationView.java @@ -0,0 +1,19 @@ +package tools.refinery.store.partial.translator.typehierarchy; + +import tools.refinery.store.partial.representation.PartialRelation; +import tools.refinery.store.query.view.TuplePreservingRelationView; +import tools.refinery.store.tuple.Tuple; + +class InferredMayTypeRelationView extends TuplePreservingRelationView { + private final PartialRelation type; + + InferredMayTypeRelationView(PartialRelation type) { + super(TypeHierarchyTranslationUnit.INFERRED_TYPE_SYMBOL, "%s#may".formatted(type)); + this.type = type; + } + + @Override + public boolean filter(Tuple key, InferredType value) { + return value.mayConcreteTypes().contains(type); + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/InferredMustTypeRelationView.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/InferredMustTypeRelationView.java new file mode 100644 index 00000000..4eca0a1c --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/InferredMustTypeRelationView.java @@ -0,0 +1,19 @@ +package tools.refinery.store.partial.translator.typehierarchy; + +import tools.refinery.store.partial.representation.PartialRelation; +import tools.refinery.store.query.view.TuplePreservingRelationView; +import tools.refinery.store.tuple.Tuple; + +class InferredMustTypeRelationView extends TuplePreservingRelationView { + private final PartialRelation type; + + InferredMustTypeRelationView(PartialRelation type) { + super(TypeHierarchyTranslationUnit.INFERRED_TYPE_SYMBOL, "%s#must".formatted(type)); + this.type = type; + } + + @Override + public boolean filter(Tuple key, InferredType value) { + return value.mustTypes().contains(type); + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/InferredType.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/InferredType.java new file mode 100644 index 00000000..729b1fb5 --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/InferredType.java @@ -0,0 +1,30 @@ +package tools.refinery.store.partial.translator.typehierarchy; + +import tools.refinery.store.partial.representation.PartialRelation; + +import java.util.Collections; +import java.util.Set; + +record InferredType(Set mustTypes, Set mayConcreteTypes, + PartialRelation currentType) { + public static final InferredType UNTYPED = new InferredType(Set.of(), Set.of(), null); + + public InferredType(Set mustTypes, Set mayConcreteTypes, + PartialRelation currentType) { + this.mustTypes = Collections.unmodifiableSet(mustTypes); + this.mayConcreteTypes = Collections.unmodifiableSet(mayConcreteTypes); + this.currentType = currentType; + } + + public boolean isConsistent() { + return currentType != null || mustTypes.isEmpty(); + } + + public boolean isMust(PartialRelation partialRelation) { + return mustTypes.contains(partialRelation); + } + + public boolean isMayConcrete(PartialRelation partialRelation) { + return mayConcreteTypes.contains(partialRelation); + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/PreservedType.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/PreservedType.java new file mode 100644 index 00000000..0299ae03 --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/PreservedType.java @@ -0,0 +1,136 @@ +package tools.refinery.store.partial.translator.typehierarchy; + +import tools.refinery.store.partial.representation.PartialRelation; +import tools.refinery.store.representation.TruthValue; + +import java.util.*; + +final class PreservedType implements TypeAnalysisResult { + private final ExtendedTypeInfo extendedTypeInfo; + private final List directSubtypes; + private final List allExternalTypeInfoList; + private final InferredType inferredType; + + public PreservedType(ExtendedTypeInfo extendedTypeInfo, List allExternalTypeInfoList) { + this.extendedTypeInfo = extendedTypeInfo; + directSubtypes = List.copyOf(extendedTypeInfo.getDirectSubtypes()); + this.allExternalTypeInfoList = allExternalTypeInfoList; + inferredType = propagateMust(extendedTypeInfo.getAllSupertypesAndSelf(), + extendedTypeInfo.getConcreteSubtypesAndSelf()); + } + + public PartialRelation type() { + return extendedTypeInfo.getType(); + } + + public List getDirectSubtypes() { + return directSubtypes; + } + + public boolean isAbstractType() { + return extendedTypeInfo.isAbstractType(); + } + + public boolean isVacuous() { + return isAbstractType() && directSubtypes.isEmpty(); + } + + public InferredType asInferredType() { + return inferredType; + } + + public InferredType merge(InferredType inferredType, TruthValue value) { + return switch (value) { + case UNKNOWN -> inferredType; + case TRUE -> addMust(inferredType); + case FALSE -> removeMay(inferredType); + case ERROR -> addError(inferredType); + }; + } + + private InferredType addMust(InferredType inferredType) { + var originalMustTypes = inferredType.mustTypes(); + if (originalMustTypes.contains(type())) { + return inferredType; + } + var mustTypes = new HashSet<>(originalMustTypes); + extendedTypeInfo.addMust(mustTypes); + var originalMayConcreteTypes = inferredType.mayConcreteTypes(); + var mayConcreteTypes = new LinkedHashSet<>(originalMayConcreteTypes); + Set mayConcreteTypesResult; + if (mayConcreteTypes.retainAll(extendedTypeInfo.getConcreteSubtypesAndSelf())) { + mayConcreteTypesResult = mayConcreteTypes; + } else { + mayConcreteTypesResult = originalMayConcreteTypes; + } + return propagateMust(mustTypes, mayConcreteTypesResult); + } + + private InferredType removeMay(InferredType inferredType) { + var originalMayConcreteTypes = inferredType.mayConcreteTypes(); + var mayConcreteTypes = new LinkedHashSet<>(originalMayConcreteTypes); + if (!mayConcreteTypes.removeAll(extendedTypeInfo.getConcreteSubtypesAndSelf())) { + return inferredType; + } + return propagateMust(inferredType.mustTypes(), mayConcreteTypes); + } + + private InferredType addError(InferredType inferredType) { + var originalMustTypes = inferredType.mustTypes(); + if (originalMustTypes.contains(type())) { + if (inferredType.mayConcreteTypes().isEmpty()) { + return inferredType; + } + return new InferredType(originalMustTypes, Set.of(), null); + } + var mustTypes = new HashSet<>(originalMustTypes); + extendedTypeInfo.addMust(mustTypes); + return new InferredType(mustTypes, Set.of(), null); + } + + private InferredType propagateMust(Set originalMustTypes, + Set mayConcreteTypes) { + // It is possible that there is not type at all, do not force one by propagation. + var maybeUntyped = originalMustTypes.isEmpty(); + // Para-consistent case, do not propagate must types to avoid logical explosion. + var paraConsistentOrSurelyUntyped = mayConcreteTypes.isEmpty(); + if (maybeUntyped || paraConsistentOrSurelyUntyped) { + return new InferredType(originalMustTypes, mayConcreteTypes, null); + } + var currentType = computeCurrentType(mayConcreteTypes); + var mustTypes = new HashSet<>(originalMustTypes); + boolean changed = false; + for (var newMustExtendedTypeInfo : allExternalTypeInfoList) { + var newMustType = newMustExtendedTypeInfo.getType(); + if (mustTypes.contains(newMustType)) { + continue; + } + if (newMustExtendedTypeInfo.allowsAllConcreteTypes(mayConcreteTypes)) { + newMustExtendedTypeInfo.addMust(mustTypes); + changed = true; + } + } + if (!changed) { + return new InferredType(originalMustTypes, mayConcreteTypes, currentType); + } + return new InferredType(mustTypes, mayConcreteTypes, currentType); + } + + /** + * Returns a concrete type that is allowed by a (consistent, i.e., nonempty) set of may concrete types. + * + * @param mayConcreteTypes The set of allowed concrete types. Must not be empty. + * @return The first concrete type that is allowed by {@code matConcreteTypes}. + */ + private PartialRelation computeCurrentType(Set mayConcreteTypes) { + for (var concreteExtendedTypeInfo : allExternalTypeInfoList) { + var concreteType = concreteExtendedTypeInfo.getType(); + if (!concreteExtendedTypeInfo.isAbstractType() && mayConcreteTypes.contains(concreteType)) { + return concreteType; + } + } + // We have already filtered out the para-consistent case in {@link #propagateMust(Set, + // Set}. + throw new AssertionError("No concrete type in %s".formatted(mayConcreteTypes)); + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalysisResult.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalysisResult.java new file mode 100644 index 00000000..0745f84e --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalysisResult.java @@ -0,0 +1,4 @@ +package tools.refinery.store.partial.translator.typehierarchy; + +sealed interface TypeAnalysisResult permits EliminatedType, PreservedType { +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzer.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzer.java new file mode 100644 index 00000000..062b4c49 --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzer.java @@ -0,0 +1,202 @@ +package tools.refinery.store.partial.translator.typehierarchy; + +import tools.refinery.store.partial.representation.PartialRelation; + +import java.util.*; + +class TypeAnalyzer { + private final Map extendedTypeInfoMap; + private final Map replacements = new LinkedHashMap<>(); + private final InferredType unknownType; + private final Map analysisResults; + + public TypeAnalyzer(Map typeInfoMap) { + int size = typeInfoMap.size(); + extendedTypeInfoMap = new LinkedHashMap<>(size); + var concreteTypes = new LinkedHashSet(); + int index = 0; + for (var entry : typeInfoMap.entrySet()) { + var type = entry.getKey(); + var typeInfo = entry.getValue(); + extendedTypeInfoMap.put(type, new ExtendedTypeInfo(index, type, typeInfo)); + if (!typeInfo.abstractType()) { + concreteTypes.add(type); + } + index++; + } + unknownType = new InferredType(Set.of(), concreteTypes, null); + computeAllSupertypes(); + computeAllAndConcreteSubtypes(); + computeDirectSubtypes(); + eliminateTrivialSupertypes(); + analysisResults = computeAnalysisResults(); + } + + public InferredType getUnknownType() { + return unknownType; + } + + public Map getAnalysisResults() { + return analysisResults; + } + + private void computeAllSupertypes() { + boolean changed; + do { + changed = false; + for (var extendedTypeInfo : extendedTypeInfoMap.values()) { + var found = new HashSet(); + var allSupertypes = extendedTypeInfo.getAllSupertypes(); + for (var supertype : allSupertypes) { + found.addAll(extendedTypeInfoMap.get(supertype).getAllSupertypes()); + } + if (allSupertypes.addAll(found)) { + changed = true; + } + } + } while (changed); + } + + private void computeAllAndConcreteSubtypes() { + for (var extendedTypeInfo : extendedTypeInfoMap.values()) { + var type = extendedTypeInfo.getType(); + if (!extendedTypeInfo.isAbstractType()) { + extendedTypeInfo.getConcreteSubtypesAndSelf().add(type); + } + for (var supertype : extendedTypeInfo.getAllSupertypes()) { + if (type.equals(supertype)) { + throw new IllegalArgumentException("%s cannot be a supertype of itself".formatted(type)); + } + var supertypeInfo = extendedTypeInfoMap.get(supertype); + supertypeInfo.getAllSubtypes().add(type); + if (!extendedTypeInfo.isAbstractType()) { + supertypeInfo.getConcreteSubtypesAndSelf().add(type); + } + } + } + } + + private void computeDirectSubtypes() { + for (var extendedTypeInfo : extendedTypeInfoMap.values()) { + var allSubtypes = extendedTypeInfo.getAllSubtypes(); + var directSubtypes = new LinkedHashSet<>(allSubtypes); + var indirectSubtypes = new LinkedHashSet(allSubtypes.size()); + for (var subtype : allSubtypes) { + indirectSubtypes.addAll(extendedTypeInfoMap.get(subtype).getAllSubtypes()); + } + directSubtypes.removeAll(indirectSubtypes); + extendedTypeInfo.setDirectSubtypes(directSubtypes); + } + } + + private void eliminateTrivialSupertypes() { + boolean changed; + do { + var toRemove = new ArrayList(); + for (var entry : extendedTypeInfoMap.entrySet()) { + var extendedTypeInfo = entry.getValue(); + boolean isAbstract = extendedTypeInfo.isAbstractType(); + // Do not eliminate abstract types with 0 subtypes, because they can be used para-consistently, i.e., + // an object determined to must have an abstract type with 0 subtypes may not ever exist. + boolean hasSingleDirectSubtype = extendedTypeInfo.getDirectSubtypes().size() == 1; + if (isAbstract && hasSingleDirectSubtype) { + toRemove.add(entry.getKey()); + } + } + toRemove.forEach(this::removeTrivialType); + changed = !toRemove.isEmpty(); + } while (changed); + } + + private void removeTrivialType(PartialRelation trivialType) { + var extendedTypeInfo = extendedTypeInfoMap.get(trivialType); + var iterator = extendedTypeInfo.getDirectSubtypes().iterator(); + if (!iterator.hasNext()) { + throw new AssertionError("Expected trivial supertype %s to have a direct subtype" + .formatted(trivialType)); + } + PartialRelation replacement = setReplacement(trivialType, iterator.next()); + if (iterator.hasNext()) { + throw new AssertionError("Expected trivial supertype %s to have at most 1 direct subtype" + .formatted(trivialType)); + } + replacements.put(trivialType, replacement); + for (var supertype : extendedTypeInfo.getAllSupertypes()) { + var extendedSupertypeInfo = extendedTypeInfoMap.get(supertype); + if (!extendedSupertypeInfo.getAllSubtypes().remove(trivialType)) { + throw new AssertionError("Expected %s to be subtype of %s".formatted(trivialType, supertype)); + } + var directSubtypes = extendedSupertypeInfo.getDirectSubtypes(); + if (directSubtypes.remove(trivialType)) { + directSubtypes.add(replacement); + } + } + for (var subtype : extendedTypeInfo.getAllSubtypes()) { + var extendedSubtypeInfo = extendedTypeInfoMap.get(subtype); + if (!extendedSubtypeInfo.getAllSupertypes().remove(trivialType)) { + throw new AssertionError("Expected %s to be supertype of %s".formatted(trivialType, subtype)); + } + } + extendedTypeInfoMap.remove(trivialType); + } + + private PartialRelation setReplacement(PartialRelation trivialRelation, PartialRelation replacement) { + if (replacement == null) { + return trivialRelation; + } + var resolved = setReplacement(replacement, replacements.get(replacement)); + replacements.put(trivialRelation, resolved); + return resolved; + } + + private Map computeAnalysisResults() { + var allExtendedTypeInfoList = sortTypes(); + var results = new LinkedHashMap( + allExtendedTypeInfoList.size() + replacements.size()); + for (var extendedTypeInfo : allExtendedTypeInfoList) { + var type = extendedTypeInfo.getType(); + results.put(type, new PreservedType(extendedTypeInfo, allExtendedTypeInfoList)); + } + for (var entry : replacements.entrySet()) { + var type = entry.getKey(); + results.put(type, new EliminatedType(entry.getValue())); + } + return Collections.unmodifiableMap(results); + } + + private List sortTypes() { + // Invert {@code directSubtypes} to keep track of the out-degree of types. + for (var extendedTypeInfo : extendedTypeInfoMap.values()) { + for (var directSubtype : extendedTypeInfo.getDirectSubtypes()) { + var extendedDirectSubtypeInfo = extendedTypeInfoMap.get(directSubtype); + extendedDirectSubtypeInfo.getUnsortedDirectSupertypes().add(extendedTypeInfo.getType()); + } + } + // Build a inverse topological order ({@code extends} edges always points to earlier nodes in the order, + // breaking ties according to the original order ({@link ExtendedTypeInfo#index}) to form a 'stable' sort. + // See, e.g., https://stackoverflow.com/a/11236027. + var priorityQueue = new PriorityQueue(); + for (var extendedTypeInfo : extendedTypeInfoMap.values()) { + if (extendedTypeInfo.getUnsortedDirectSupertypes().isEmpty()) { + priorityQueue.add(extendedTypeInfo); + } + } + var sorted = new ArrayList(extendedTypeInfoMap.size()); + while (!priorityQueue.isEmpty()) { + var extendedTypeInfo = priorityQueue.remove(); + sorted.add(extendedTypeInfo); + for (var directSubtype : extendedTypeInfo.getDirectSubtypes()) { + var extendedDirectSubtypeInfo = extendedTypeInfoMap.get(directSubtype); + var unsortedDirectSupertypes = extendedDirectSubtypeInfo.getUnsortedDirectSupertypes(); + if (!unsortedDirectSupertypes.remove(extendedTypeInfo.getType())) { + throw new AssertionError("Expected %s to be a direct supertype of %s" + .formatted(extendedTypeInfo.getType(), directSubtype)); + } + if (unsortedDirectSupertypes.isEmpty()) { + priorityQueue.add(extendedDirectSubtypeInfo); + } + } + } + return Collections.unmodifiableList(sorted); + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeHierarchyTranslationUnit.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeHierarchyTranslationUnit.java new file mode 100644 index 00000000..7f438f71 --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeHierarchyTranslationUnit.java @@ -0,0 +1,52 @@ +package tools.refinery.store.partial.translator.typehierarchy; + +import tools.refinery.store.partial.AnyPartialSymbolInterpretation; +import tools.refinery.store.partial.literal.Modality; +import tools.refinery.store.partial.representation.AnyPartialSymbol; +import tools.refinery.store.partial.representation.PartialRelation; +import tools.refinery.store.partial.translator.Advice; +import tools.refinery.store.partial.translator.TranslationUnit; +import tools.refinery.store.model.Model; +import tools.refinery.store.query.Variable; +import tools.refinery.store.query.literal.CallPolarity; +import tools.refinery.store.query.literal.Literal; +import tools.refinery.store.representation.Symbol; + +import java.util.*; + +public class TypeHierarchyTranslationUnit extends TranslationUnit { + static final Symbol INFERRED_TYPE_SYMBOL = new Symbol<>("inferredType", 1, + InferredType.class, InferredType.UNTYPED); + + private final Map typeInfoMap; + + public TypeHierarchyTranslationUnit(Map typeInfoMap) { + this.typeInfoMap = new LinkedHashMap<>(typeInfoMap); + } + + @Override + public Collection getTranslatedPartialSymbols() { + return null; + } + + @Override + public void configure(Collection advices) { + + } + + @Override + public List call(CallPolarity polarity, Modality modality, PartialRelation target, + List arguments) { + return null; + } + + @Override + public Map createPartialInterpretations(Model model) { + return null; + } + + @Override + public void initializeModel(Model model, int nodeCount) { + + } +} diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeInfo.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeInfo.java new file mode 100644 index 00000000..1b0922fe --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeInfo.java @@ -0,0 +1,46 @@ +package tools.refinery.store.partial.translator.typehierarchy; + +import tools.refinery.store.partial.representation.PartialRelation; + +import java.util.*; + +public record TypeInfo(Collection supertypes, boolean abstractType) { + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private final Set supertypes = new LinkedHashSet<>(); + private boolean abstractType; + + private Builder() { + } + + public Builder supertypes(Collection supertypes) { + this.supertypes.addAll(supertypes); + return this; + } + + public Builder supertypes(PartialRelation... supertypes) { + return supertypes(List.of(supertypes)); + } + + public Builder supertype(PartialRelation supertype) { + supertypes.add(supertype); + return this; + } + + public Builder abstractType(boolean abstractType) { + this.abstractType = abstractType; + return this; + } + + public Builder abstractType() { + return abstractType(true); + } + + public TypeInfo build() { + return new TypeInfo(Collections.unmodifiableSet(supertypes), abstractType); + } + } +} diff --git a/subprojects/store-partial/src/test/java/tools/refinery/store/partial/translator/typehierarchy/InferredTypeTest.java b/subprojects/store-partial/src/test/java/tools/refinery/store/partial/translator/typehierarchy/InferredTypeTest.java new file mode 100644 index 00000000..9efa76ef --- /dev/null +++ b/subprojects/store-partial/src/test/java/tools/refinery/store/partial/translator/typehierarchy/InferredTypeTest.java @@ -0,0 +1,32 @@ +package tools.refinery.store.partial.translator.typehierarchy; + +import org.junit.jupiter.api.Test; +import tools.refinery.store.partial.representation.PartialRelation; + +import java.util.Set; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +class InferredTypeTest { + private final PartialRelation c1 = new PartialRelation("C1", 1); + private final PartialRelation c2 = new PartialRelation("C2", 1); + + @Test + void untypedIsConsistentTest() { + var sut = new InferredType(Set.of(), Set.of(c1, c2), null); + assertThat(sut.isConsistent(), is(true)); + } + + @Test + void typedIsConsistentTest() { + var sut = new InferredType(Set.of(c1), Set.of(c1, c2), c1); + assertThat(sut.isConsistent(), is(true)); + } + + @Test + void typedIsInconsistentTest() { + var sut = new InferredType(Set.of(c1), Set.of(), null); + assertThat(sut.isConsistent(), is(false)); + } +} diff --git a/subprojects/store-partial/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerExampleHierarchyTest.java b/subprojects/store-partial/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerExampleHierarchyTest.java new file mode 100644 index 00000000..ad81e28f --- /dev/null +++ b/subprojects/store-partial/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerExampleHierarchyTest.java @@ -0,0 +1,204 @@ +package tools.refinery.store.partial.translator.typehierarchy; + +import org.hamcrest.Matchers; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import tools.refinery.store.partial.representation.PartialRelation; +import tools.refinery.store.representation.TruthValue; + +import java.util.LinkedHashMap; +import java.util.Set; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.junit.jupiter.api.Assertions.assertAll; + +class TypeAnalyzerExampleHierarchyTest { + private final PartialRelation a1 = new PartialRelation("A1", 1); + private final PartialRelation a2 = new PartialRelation("A2", 1); + private final PartialRelation a3 = new PartialRelation("A3", 1); + private final PartialRelation a4 = new PartialRelation("A4", 1); + private final PartialRelation a5 = new PartialRelation("A5", 1); + private final PartialRelation c1 = new PartialRelation("C1", 1); + private final PartialRelation c2 = new PartialRelation("C2", 1); + private final PartialRelation c3 = new PartialRelation("C3", 1); + private final PartialRelation c4 = new PartialRelation("C4", 1); + + private TypeAnalyzer sut; + private TypeAnalyzerTester tester; + + @BeforeEach + void beforeEach() { + var typeInfoMap = new LinkedHashMap(); + typeInfoMap.put(a1, TypeInfo.builder().abstractType().build()); + typeInfoMap.put(a2, TypeInfo.builder().abstractType().build()); + typeInfoMap.put(a3, TypeInfo.builder().abstractType().build()); + typeInfoMap.put(a4, TypeInfo.builder().abstractType().build()); + typeInfoMap.put(a5, TypeInfo.builder().abstractType().build()); + typeInfoMap.put(c1, TypeInfo.builder().supertypes(a1, a4).build()); + typeInfoMap.put(c2, TypeInfo.builder().supertypes(a1, a2, a3, a4).build()); + typeInfoMap.put(c3, TypeInfo.builder().supertype(a3).build()); + typeInfoMap.put(c4, TypeInfo.builder().supertype(a4).build()); + sut = new TypeAnalyzer(typeInfoMap); + tester = new TypeAnalyzerTester(sut); + } + + @Test + void analysisResultsTest() { + assertAll( + () -> tester.assertAbstractType(a1, c1, c2), + () -> tester.assertEliminatedType(a2, c2), + () -> tester.assertAbstractType(a3, c2, c3), + () -> tester.assertAbstractType(a4, c1, c2, c4), + () -> tester.assertVacuousType(a5), + () -> tester.assertConcreteType(c1), + () -> tester.assertConcreteType(c2), + () -> tester.assertConcreteType(c3), + () -> tester.assertConcreteType(c4) + ); + } + + @Test + void inferredTypesTest() { + assertAll( + () -> assertThat(sut.getUnknownType(), Matchers.is(new InferredType(Set.of(), Set.of(c1, c2, c3, c4), null))), + () -> assertThat(tester.getInferredType(a1), Matchers.is(new InferredType(Set.of(a1, a4), Set.of(c1, c2), c1))), + () -> assertThat(tester.getInferredType(a3), Matchers.is(new InferredType(Set.of(a3), Set.of(c2, c3), c2))), + () -> assertThat(tester.getInferredType(a4), Matchers.is(new InferredType(Set.of(a4), Set.of(c1, c2, c4), c1))), + () -> assertThat(tester.getInferredType(a5), Matchers.is(new InferredType(Set.of(a5), Set.of(), null))), + () -> assertThat(tester.getInferredType(c1), Matchers.is(new InferredType(Set.of(a1, a4, c1), Set.of(c1), c1))), + () -> assertThat(tester.getInferredType(c2), + Matchers.is(new InferredType(Set.of(a1, a3, a4, c2), Set.of(c2), c2))), + () -> assertThat(tester.getInferredType(c3), Matchers.is(new InferredType(Set.of(a3, c3), Set.of(c3), c3))), + () -> assertThat(tester.getInferredType(c4), Matchers.is(new InferredType(Set.of(a4, c4), Set.of(c4), c4))) + ); + } + + @Test + void consistentMustTest() { + var a1Result = tester.getPreservedType(a1); + var a3Result = tester.getPreservedType(a3); + var expected = new InferredType(Set.of(a1, a3, a4, c2), Set.of(c2), c2); + assertAll( + () -> assertThat(a1Result.merge(a3Result.asInferredType(), TruthValue.TRUE), Matchers.is(expected)), + () -> assertThat(a3Result.merge(a1Result.asInferredType(), TruthValue.TRUE), Matchers.is(expected)), + () -> assertThat(a1Result.merge(sut.getUnknownType(), TruthValue.TRUE), is(a1Result.asInferredType())), + () -> assertThat(a3Result.merge(sut.getUnknownType(), TruthValue.TRUE), is(a3Result.asInferredType())), + () -> assertThat(a1Result.merge(a1Result.asInferredType(), TruthValue.TRUE), + is(a1Result.asInferredType())) + ); + } + + @Test + void consistentMayNotTest() { + var a1Result = tester.getPreservedType(a1); + var a3Result = tester.getPreservedType(a3); + var a4Result = tester.getPreservedType(a4); + assertAll( + () -> assertThat(a1Result.merge(a3Result.asInferredType(), TruthValue.FALSE), + Matchers.is(new InferredType(Set.of(a3, c3), Set.of(c3), c3))), + () -> assertThat(a3Result.merge(a1Result.asInferredType(), TruthValue.FALSE), + Matchers.is(new InferredType(Set.of(a1, a4, c1), Set.of(c1), c1))), + () -> assertThat(a4Result.merge(a3Result.asInferredType(), TruthValue.FALSE), + Matchers.is(new InferredType(Set.of(a3, c3), Set.of(c3), c3))), + () -> assertThat(a3Result.merge(a4Result.asInferredType(), TruthValue.FALSE), + Matchers.is(new InferredType(Set.of(a4), Set.of(c1, c4), c1))), + () -> assertThat(a1Result.merge(sut.getUnknownType(), TruthValue.FALSE), + Matchers.is(new InferredType(Set.of(), Set.of(c3, c4), null))), + () -> assertThat(a3Result.merge(sut.getUnknownType(), TruthValue.FALSE), + Matchers.is(new InferredType(Set.of(), Set.of(c1, c4), null))), + () -> assertThat(a4Result.merge(sut.getUnknownType(), TruthValue.FALSE), + Matchers.is(new InferredType(Set.of(), Set.of(c3), null))) + ); + } + + @Test + void consistentErrorTest() { + var c1Result = tester.getPreservedType(c1); + var a4Result = tester.getPreservedType(a4); + var expected = new InferredType(Set.of(c1, a1, a4), Set.of(), null); + assertAll( + () -> assertThat(c1Result.merge(a4Result.asInferredType(), TruthValue.ERROR), Matchers.is(expected)), + () -> assertThat(a4Result.merge(c1Result.asInferredType(), TruthValue.ERROR), Matchers.is(expected)) + ); + } + + @Test + void consistentUnknownTest() { + var c1Result = tester.getPreservedType(c1); + var a4Result = tester.getPreservedType(a4); + assertAll( + () -> assertThat(c1Result.merge(a4Result.asInferredType(), TruthValue.UNKNOWN), + is(a4Result.asInferredType())), + () -> assertThat(a4Result.merge(c1Result.asInferredType(), TruthValue.UNKNOWN), + is(c1Result.asInferredType())) + ); + } + + @Test + void inconsistentMustTest() { + var a1Result = tester.getPreservedType(a1); + var c3Result = tester.getPreservedType(c3); + assertAll( + () -> assertThat(a1Result.merge(c3Result.asInferredType(), TruthValue.TRUE), + Matchers.is(new InferredType(Set.of(a1, a3, c3), Set.of(), null))), + () -> assertThat(c3Result.merge(a1Result.asInferredType(), TruthValue.TRUE), + Matchers.is(new InferredType(Set.of(a1, a3, a4, c3), Set.of(), null))) + ); + } + + @Test + void inconsistentMayNotTest() { + var a1Result = tester.getPreservedType(a1); + var a4Result = tester.getPreservedType(a4); + var c1Result = tester.getPreservedType(c1); + assertAll( + () -> assertThat(a4Result.merge(a1Result.asInferredType(), TruthValue.FALSE), + Matchers.is(new InferredType(Set.of(a1, a4), Set.of(), null))), + () -> assertThat(a1Result.merge(c1Result.asInferredType(), TruthValue.FALSE), + Matchers.is(new InferredType(Set.of(a1, a4, c1), Set.of(), null))), + () -> assertThat(a4Result.merge(c1Result.asInferredType(), TruthValue.FALSE), + Matchers.is(new InferredType(Set.of(a1, a4, c1), Set.of(), null))), + () -> assertThat(a1Result.merge(a1Result.asInferredType(), TruthValue.FALSE), + Matchers.is(new InferredType(Set.of(a1, a4), Set.of(), null))) + ); + } + + @Test + void vacuousMustTest() { + var c1Result = tester.getPreservedType(c1); + var a5Result = tester.getPreservedType(a5); + assertAll( + () -> assertThat(c1Result.merge(a5Result.asInferredType(), TruthValue.TRUE), + Matchers.is(new InferredType(Set.of(a1, a4, a5, c1), Set.of(), null))), + () -> assertThat(a5Result.merge(c1Result.asInferredType(), TruthValue.TRUE), + Matchers.is(new InferredType(Set.of(a1, a4, a5, c1), Set.of(), null))) + ); + } + + @Test + void vacuousMayNotTest() { + var c1Result = tester.getPreservedType(c1); + var a5Result = tester.getPreservedType(a5); + assertAll( + () -> assertThat(c1Result.merge(a5Result.asInferredType(), TruthValue.FALSE), + is(a5Result.asInferredType())), + () -> assertThat(a5Result.merge(c1Result.asInferredType(), TruthValue.FALSE), + is(c1Result.asInferredType())) + ); + } + + @Test + void vacuousErrorTest() { + var c1Result = tester.getPreservedType(c1); + var a5Result = tester.getPreservedType(a5); + assertAll( + () -> assertThat(c1Result.merge(a5Result.asInferredType(), TruthValue.ERROR), + Matchers.is(new InferredType(Set.of(a1, a4, a5, c1), Set.of(), null))), + () -> assertThat(a5Result.merge(c1Result.asInferredType(), TruthValue.ERROR), + Matchers.is(new InferredType(Set.of(a1, a4, a5, c1), Set.of(), null))), + () -> assertThat(a5Result.merge(a5Result.asInferredType(), TruthValue.ERROR), + is(a5Result.asInferredType())) + ); + } +} diff --git a/subprojects/store-partial/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTest.java b/subprojects/store-partial/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTest.java new file mode 100644 index 00000000..1aab75bb --- /dev/null +++ b/subprojects/store-partial/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTest.java @@ -0,0 +1,201 @@ +package tools.refinery.store.partial.translator.typehierarchy; + +import org.hamcrest.Matchers; +import org.junit.jupiter.api.Test; +import tools.refinery.store.partial.representation.PartialRelation; +import tools.refinery.store.representation.TruthValue; + +import java.util.LinkedHashMap; +import java.util.Set; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.junit.jupiter.api.Assertions.assertAll; +import static org.junit.jupiter.api.Assertions.assertThrows; + +class TypeAnalyzerTest { + @Test + void directSupertypesTest() { + var c1 = new PartialRelation("C1", 1); + var c2 = new PartialRelation("C2", 1); + var c3 = new PartialRelation("C3", 1); + var typeInfoMap = new LinkedHashMap(); + typeInfoMap.put(c1, TypeInfo.builder().supertypes(c2, c3).build()); + typeInfoMap.put(c2, TypeInfo.builder().supertype(c3).build()); + typeInfoMap.put(c3, TypeInfo.builder().build()); + + var sut = new TypeAnalyzer(typeInfoMap); + var tester = new TypeAnalyzerTester(sut); + + assertAll( + () -> tester.assertConcreteType(c1), + () -> tester.assertConcreteType(c2, c1), + () -> tester.assertConcreteType(c3, c2) + ); + } + + @Test + void typeEliminationAbstractToConcreteTest() { + var c1 = new PartialRelation("C1", 1); + var c2 = new PartialRelation("C2", 1); + var a11 = new PartialRelation("A11", 1); + var a12 = new PartialRelation("A12", 1); + var a21 = new PartialRelation("A21", 1); + var a22 = new PartialRelation("A22", 1); + var a3 = new PartialRelation("A3", 1); + var typeInfoMap = new LinkedHashMap(); + typeInfoMap.put(a3, TypeInfo.builder().abstractType().build()); + typeInfoMap.put(a21, TypeInfo.builder().abstractType().supertype(a3).build()); + typeInfoMap.put(a22, TypeInfo.builder().abstractType().supertype(a3).build()); + typeInfoMap.put(a11, TypeInfo.builder().abstractType().supertypes(a21, a22).build()); + typeInfoMap.put(a12, TypeInfo.builder().abstractType().supertypes(a21, a22).build()); + typeInfoMap.put(c1, TypeInfo.builder().supertypes(a11, a12).build()); + typeInfoMap.put(c2, TypeInfo.builder().supertype(a3).build()); + + var sut = new TypeAnalyzer(typeInfoMap); + var tester = new TypeAnalyzerTester(sut); + + assertAll( + () -> tester.assertConcreteType(c1), + () -> tester.assertConcreteType(c2), + () -> tester.assertEliminatedType(a11, c1), + () -> tester.assertEliminatedType(a12, c1), + () -> tester.assertEliminatedType(a21, c1), + () -> tester.assertEliminatedType(a22, c1), + () -> tester.assertAbstractType(a3, c1, c2) + ); + } + + @Test + void typeEliminationConcreteToAbstractTest() { + var c1 = new PartialRelation("C1", 1); + var c2 = new PartialRelation("C2", 1); + var a11 = new PartialRelation("A11", 1); + var a12 = new PartialRelation("A12", 1); + var a21 = new PartialRelation("A21", 1); + var a22 = new PartialRelation("A22", 1); + var a3 = new PartialRelation("A3", 1); + var typeInfoMap = new LinkedHashMap(); + typeInfoMap.put(c1, TypeInfo.builder().supertypes(a11, a12).build()); + typeInfoMap.put(c2, TypeInfo.builder().supertype(a3).build()); + typeInfoMap.put(a11, TypeInfo.builder().abstractType().supertypes(a21, a22).build()); + typeInfoMap.put(a12, TypeInfo.builder().abstractType().supertypes(a21, a22).build()); + typeInfoMap.put(a21, TypeInfo.builder().abstractType().supertype(a3).build()); + typeInfoMap.put(a22, TypeInfo.builder().abstractType().supertype(a3).build()); + typeInfoMap.put(a3, TypeInfo.builder().abstractType().build()); + + var sut = new TypeAnalyzer(typeInfoMap); + var tester = new TypeAnalyzerTester(sut); + + assertAll( + () -> tester.assertConcreteType(c1), + () -> tester.assertConcreteType(c2), + () -> tester.assertEliminatedType(a11, c1), + () -> tester.assertEliminatedType(a12, c1), + () -> tester.assertEliminatedType(a21, c1), + () -> tester.assertEliminatedType(a22, c1), + () -> tester.assertAbstractType(a3, c1, c2) + ); + } + + @Test + void preserveConcreteTypeTest() { + var c1 = new PartialRelation("C1", 1); + var a1 = new PartialRelation("A1", 1); + var c2 = new PartialRelation("C2", 1); + var a2 = new PartialRelation("A2", 1); + var typeInfoMap = new LinkedHashMap(); + typeInfoMap.put(c1, TypeInfo.builder().supertype(a1).build()); + typeInfoMap.put(a1, TypeInfo.builder().abstractType().supertype(c2).build()); + typeInfoMap.put(c2, TypeInfo.builder().supertype(a2).build()); + typeInfoMap.put(a2, TypeInfo.builder().abstractType().build()); + + var sut = new TypeAnalyzer(typeInfoMap); + var tester = new TypeAnalyzerTester(sut); + + assertAll( + () -> tester.assertConcreteType(c1), + () -> tester.assertEliminatedType(a1, c1), + () -> tester.assertConcreteType(c2, c1), + () -> tester.assertEliminatedType(a2, c2) + ); + } + + @Test + void mostGeneralCurrentTypeTest() { + var c1 = new PartialRelation("C1", 1); + var c2 = new PartialRelation("C2", 1); + var c3 = new PartialRelation("C3", 1); + var typeInfoMap = new LinkedHashMap(); + typeInfoMap.put(c1, TypeInfo.builder().supertype(c3).build()); + typeInfoMap.put(c2, TypeInfo.builder().supertype(c3).build()); + typeInfoMap.put(c3, TypeInfo.builder().build()); + + var sut = new TypeAnalyzer(typeInfoMap); + var tester = new TypeAnalyzerTester(sut); + var c3Result = tester.getPreservedType(c3); + + var expected = new InferredType(Set.of(c3), Set.of(c1, c2, c3), c3); + assertAll( + () -> assertThat(tester.getInferredType(c3), Matchers.is(expected)), + () -> assertThat(c3Result.merge(sut.getUnknownType(), TruthValue.TRUE), Matchers.is(expected)) + ); + } + + @Test + void preferFirstConcreteTypeTest() { + var a1 = new PartialRelation("A1", 1); + var c1 = new PartialRelation("C1", 1); + var c2 = new PartialRelation("C2", 1); + var c3 = new PartialRelation("C3", 1); + var c4 = new PartialRelation("C4", 1); + var typeInfoMap = new LinkedHashMap(); + typeInfoMap.put(c1, TypeInfo.builder().supertype(a1).build()); + typeInfoMap.put(c2, TypeInfo.builder().supertype(a1).build()); + typeInfoMap.put(c3, TypeInfo.builder().supertype(a1).build()); + typeInfoMap.put(c4, TypeInfo.builder().supertype(c3).build()); + typeInfoMap.put(a1, TypeInfo.builder().abstractType().build()); + + var sut = new TypeAnalyzer(typeInfoMap); + var tester = new TypeAnalyzerTester(sut); + var c1Result = tester.getPreservedType(c1); + var a1Result = tester.getPreservedType(a1); + + assertThat(c1Result.merge(a1Result.asInferredType(), TruthValue.FALSE), + Matchers.is(new InferredType(Set.of(a1), Set.of(c2, c3, c4), c2))); + } + + @Test + void preferFirstMostGeneralConcreteTypeTest() { + var a1 = new PartialRelation("A1", 1); + var c1 = new PartialRelation("C1", 1); + var c2 = new PartialRelation("C2", 1); + var c3 = new PartialRelation("C3", 1); + var c4 = new PartialRelation("C4", 1); + var typeInfoMap = new LinkedHashMap(); + typeInfoMap.put(c4, TypeInfo.builder().supertype(c3).build()); + typeInfoMap.put(c3, TypeInfo.builder().supertype(a1).build()); + typeInfoMap.put(c2, TypeInfo.builder().supertype(a1).build()); + typeInfoMap.put(c1, TypeInfo.builder().supertype(a1).build()); + typeInfoMap.put(a1, TypeInfo.builder().abstractType().build()); + + var sut = new TypeAnalyzer(typeInfoMap); + var tester = new TypeAnalyzerTester(sut); + var c1Result = tester.getPreservedType(c1); + var a1Result = tester.getPreservedType(a1); + + assertThat(c1Result.merge(a1Result.asInferredType(), TruthValue.FALSE), + Matchers.is(new InferredType(Set.of(a1), Set.of(c2, c3, c4), c3))); + } + + @Test + void circularTypeHierarchyTest() { + var c1 = new PartialRelation("C1", 1); + var c2 = new PartialRelation("C2", 1); + var typeInfoMap = new LinkedHashMap(); + typeInfoMap.put(c1, TypeInfo.builder().supertype(c2).build()); + typeInfoMap.put(c2, TypeInfo.builder().supertype(c1).build()); + + assertThrows(IllegalArgumentException.class, () -> new TypeAnalyzer(typeInfoMap)); + } +} diff --git a/subprojects/store-partial/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTester.java b/subprojects/store-partial/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTester.java new file mode 100644 index 00000000..ce600ea6 --- /dev/null +++ b/subprojects/store-partial/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTester.java @@ -0,0 +1,51 @@ +package tools.refinery.store.partial.translator.typehierarchy; + +import tools.refinery.store.partial.representation.PartialRelation; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.is; + +class TypeAnalyzerTester { + private final TypeAnalyzer sut; + + public TypeAnalyzerTester(TypeAnalyzer sut) { + this.sut = sut; + } + + public void assertAbstractType(PartialRelation partialRelation, PartialRelation... directSubtypes) { + assertPreservedType(partialRelation, true, false, directSubtypes); + } + + public void assertVacuousType(PartialRelation partialRelation) { + assertPreservedType(partialRelation, true, true); + } + + public void assertConcreteType(PartialRelation partialRelation, PartialRelation... directSubtypes) { + assertPreservedType(partialRelation, false, false, directSubtypes); + } + + private void assertPreservedType(PartialRelation partialRelation, boolean isAbstract, boolean isVacuous, + PartialRelation... directSubtypes) { + var result = sut.getAnalysisResults().get(partialRelation); + assertThat(result, is(instanceOf(PreservedType.class))); + var preservedResult = (PreservedType) result; + assertThat(preservedResult.isAbstractType(), is(isAbstract)); + assertThat(preservedResult.isVacuous(), is(isVacuous)); + assertThat(preservedResult.getDirectSubtypes(), hasItems(directSubtypes)); + } + + public void assertEliminatedType(PartialRelation partialRelation, PartialRelation replacement) { + var result = sut.getAnalysisResults().get(partialRelation); + assertThat(result, is(instanceOf(EliminatedType.class))); + assertThat(((EliminatedType) result).replacement(), is(replacement)); + } + + public PreservedType getPreservedType(PartialRelation partialRelation) { + return (PreservedType) sut.getAnalysisResults().get(partialRelation); + } + + public InferredType getInferredType(PartialRelation partialRelation) { + return getPreservedType(partialRelation).asInferredType(); + } +} diff --git a/subprojects/store-query-viatra/build.gradle b/subprojects/store-query-viatra/build.gradle index c12b48fe..13a7544f 100644 --- a/subprojects/store-query-viatra/build.gradle +++ b/subprojects/store-query-viatra/build.gradle @@ -10,7 +10,7 @@ configurations.testRuntimeClasspath { dependencies { implementation libs.ecore api libs.viatra - api project(':refinery-store') + api project(':refinery-store-query') testImplementation libs.slf4j.simple testImplementation libs.slf4j.log4j } diff --git a/subprojects/store-query/build.gradle b/subprojects/store-query/build.gradle new file mode 100644 index 00000000..2b76e608 --- /dev/null +++ b/subprojects/store-query/build.gradle @@ -0,0 +1,7 @@ +plugins { + id 'refinery-java-library' +} + +dependencies { + api project(':refinery-store') +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/Dnf.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/Dnf.java new file mode 100644 index 00000000..760b264b --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/Dnf.java @@ -0,0 +1,112 @@ +package tools.refinery.store.query; + +import tools.refinery.store.query.literal.CallPolarity; +import tools.refinery.store.query.literal.DnfCallLiteral; +import tools.refinery.store.query.literal.LiteralReduction; + +import java.util.*; + +public final class Dnf implements RelationLike { + private final String name; + + private final String uniqueName; + + private final List parameters; + + private final List> functionalDependencies; + + private final List clauses; + + Dnf(String name, List parameters, List> functionalDependencies, + List clauses) { + validateFunctionalDependencies(parameters, functionalDependencies); + this.name = name; + this.uniqueName = DnfUtils.generateUniqueName(name); + this.parameters = parameters; + this.functionalDependencies = functionalDependencies; + this.clauses = clauses; + } + + private static void validateFunctionalDependencies( + Collection parameters, Collection> functionalDependencies) { + var parameterSet = new HashSet<>(parameters); + for (var functionalDependency : functionalDependencies) { + validateParameters(parameters, parameterSet, functionalDependency.forEach(), functionalDependency); + validateParameters(parameters, parameterSet, functionalDependency.unique(), functionalDependency); + } + } + + private static void validateParameters(Collection parameters, Set parameterSet, + Collection toValidate, + FunctionalDependency functionalDependency) { + for (var variable : toValidate) { + if (!parameterSet.contains(variable)) { + throw new IllegalArgumentException( + "Variable %s of functional dependency %s does not appear in the parameter list %s" + .formatted(variable, functionalDependency, parameters)); + } + } + } + + @Override + public String name() { + return name; + } + + public String getUniqueName() { + return uniqueName; + } + + public List getParameters() { + return parameters; + } + + public List> getFunctionalDependencies() { + return functionalDependencies; + } + + @Override + public int arity() { + return parameters.size(); + } + + public List getClauses() { + return clauses; + } + + public LiteralReduction getReduction() { + if (clauses.isEmpty()) { + return LiteralReduction.ALWAYS_FALSE; + } + for (var clause : clauses) { + if (clause.literals().isEmpty()) { + return LiteralReduction.ALWAYS_TRUE; + } + } + return LiteralReduction.NOT_REDUCIBLE; + } + + public DnfCallLiteral call(CallPolarity polarity, List arguments) { + return new DnfCallLiteral(polarity, this, arguments); + } + + public DnfCallLiteral call(CallPolarity polarity, Variable... arguments) { + return call(polarity, List.of(arguments)); + } + + public DnfCallLiteral call(Variable... arguments) { + return call(CallPolarity.POSITIVE, arguments); + } + + public DnfCallLiteral callTransitive(Variable left, Variable right) { + return call(CallPolarity.TRANSITIVE, List.of(left, right)); + } + + public static DnfBuilder builder() { + return builder(null); + } + + public static DnfBuilder builder(String name) { + return new DnfBuilder(name); + } +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/DnfBuilder.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/DnfBuilder.java new file mode 100644 index 00000000..b18b5177 --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/DnfBuilder.java @@ -0,0 +1,108 @@ +package tools.refinery.store.query; + +import tools.refinery.store.query.literal.Literal; + +import java.util.*; + +@SuppressWarnings("UnusedReturnValue") +public class DnfBuilder { + private final String name; + + private final List parameters = new ArrayList<>(); + + private final List> functionalDependencies = new ArrayList<>(); + + private final List> clauses = new ArrayList<>(); + + DnfBuilder(String name) { + this.name = name; + } + + public DnfBuilder parameter(Variable variable) { + parameters.add(variable); + return this; + } + + public DnfBuilder parameters(Variable... variables) { + return parameters(List.of(variables)); + } + + public DnfBuilder parameters(Collection variables) { + parameters.addAll(variables); + return this; + } + + public DnfBuilder functionalDependencies(Collection> functionalDependencies) { + this.functionalDependencies.addAll(functionalDependencies); + return this; + } + + public DnfBuilder functionalDependency(FunctionalDependency functionalDependency) { + functionalDependencies.add(functionalDependency); + return this; + } + + public DnfBuilder functionalDependency(Set forEach, Set unique) { + return functionalDependency(new FunctionalDependency<>(forEach, unique)); + } + + public DnfBuilder clause(Literal... literals) { + clause(List.of(literals)); + return this; + } + + public DnfBuilder clause(Collection literals) { + var filteredLiterals = new ArrayList(literals.size()); + for (var literal : literals) { + var reduction = literal.getReduction(); + switch (reduction) { + case NOT_REDUCIBLE -> filteredLiterals.add(literal); + case ALWAYS_TRUE -> { + // Literals reducible to {@code true} can be omitted, because the model is always assumed to have at + // least on object. + } + case ALWAYS_FALSE -> { + // Clauses with {@code false} literals can be omitted entirely. + return this; + } + default -> throw new IllegalStateException("Invalid reduction %s".formatted(reduction)); + } + } + clauses.add(Collections.unmodifiableList(filteredLiterals)); + return this; + } + + public DnfBuilder clause(DnfClause clause) { + return clause(clause.literals()); + } + + public DnfBuilder clauses(DnfClause... clauses) { + for (var clause : clauses) { + this.clause(clause); + } + return this; + } + + public DnfBuilder clauses(Collection clauses) { + for (var clause : clauses) { + this.clause(clause); + } + return this; + } + + public Dnf build() { + var postProcessedClauses = new ArrayList(clauses.size()); + for (var constraints : clauses) { + var variables = new HashSet(); + for (var constraint : constraints) { + constraint.collectAllVariables(variables); + } + parameters.forEach(variables::remove); + postProcessedClauses.add(new DnfClause(Collections.unmodifiableSet(variables), + Collections.unmodifiableList(constraints))); + } + return new Dnf(name, Collections.unmodifiableList(parameters), + Collections.unmodifiableList(functionalDependencies), + Collections.unmodifiableList(postProcessedClauses)); + } +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/DnfClause.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/DnfClause.java new file mode 100644 index 00000000..2ba6becc --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/DnfClause.java @@ -0,0 +1,9 @@ +package tools.refinery.store.query; + +import tools.refinery.store.query.literal.Literal; + +import java.util.List; +import java.util.Set; + +public record DnfClause(Set quantifiedVariables, List literals) { +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/DnfUtils.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/DnfUtils.java new file mode 100644 index 00000000..17564d43 --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/DnfUtils.java @@ -0,0 +1,24 @@ +package tools.refinery.store.query; + +import java.util.Map; +import java.util.UUID; + +public final class DnfUtils { + private DnfUtils() { + throw new IllegalStateException("This is a static utility class and should not be instantiated directly"); + } + + public static String generateUniqueName(String originalName) { + UUID uuid = UUID.randomUUID(); + String uniqueString = "_" + uuid.toString().replace('-', '_'); + if (originalName == null) { + return uniqueString; + } else { + return originalName + uniqueString; + } + } + + public static Variable maybeSubstitute(Variable variable, Map substitution) { + return substitution.getOrDefault(variable, variable); + } +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/FunctionalDependency.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/FunctionalDependency.java new file mode 100644 index 00000000..63a81713 --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/FunctionalDependency.java @@ -0,0 +1,15 @@ +package tools.refinery.store.query; + +import java.util.HashSet; +import java.util.Set; + +public record FunctionalDependency(Set forEach, Set unique) { + public FunctionalDependency { + var uniqueForEach = new HashSet<>(unique); + uniqueForEach.retainAll(forEach); + if (!uniqueForEach.isEmpty()) { + throw new IllegalArgumentException("Variables %s appear on both sides of the functional dependency" + .formatted(uniqueForEach)); + } + } +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQuery.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQuery.java new file mode 100644 index 00000000..6a1aeabb --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQuery.java @@ -0,0 +1,11 @@ +package tools.refinery.store.query; + +import tools.refinery.store.adapter.ModelAdapterType; + +public final class ModelQuery extends ModelAdapterType { + public static final ModelQuery ADAPTER = new ModelQuery(); + + private ModelQuery() { + super(ModelQueryAdapter.class, ModelQueryStoreAdapter.class, ModelQueryBuilder.class); + } +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQueryAdapter.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQueryAdapter.java new file mode 100644 index 00000000..f7762444 --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQueryAdapter.java @@ -0,0 +1,13 @@ +package tools.refinery.store.query; + +import tools.refinery.store.adapter.ModelAdapter; + +public interface ModelQueryAdapter extends ModelAdapter { + ModelQueryStoreAdapter getStoreAdapter(); + + ResultSet getResultSet(Dnf query); + + boolean hasPendingChanges(); + + void flushChanges(); +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQueryBuilder.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQueryBuilder.java new file mode 100644 index 00000000..b3cfb4b4 --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQueryBuilder.java @@ -0,0 +1,23 @@ +package tools.refinery.store.query; + +import tools.refinery.store.adapter.ModelAdapterBuilder; +import tools.refinery.store.model.ModelStore; + +import java.util.Collection; +import java.util.List; + +public interface ModelQueryBuilder extends ModelAdapterBuilder { + default ModelQueryBuilder queries(Dnf... queries) { + return queries(List.of(queries)); + } + + default ModelQueryBuilder queries(Collection queries) { + queries.forEach(this::query); + return this; + } + + ModelQueryBuilder query(Dnf query); + + @Override + ModelQueryStoreAdapter createStoreAdapter(ModelStore store); +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQueryStoreAdapter.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQueryStoreAdapter.java new file mode 100644 index 00000000..091d6d06 --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQueryStoreAdapter.java @@ -0,0 +1,16 @@ +package tools.refinery.store.query; + +import tools.refinery.store.query.view.AnyRelationView; +import tools.refinery.store.adapter.ModelStoreAdapter; +import tools.refinery.store.model.Model; + +import java.util.Collection; + +public interface ModelQueryStoreAdapter extends ModelStoreAdapter { + Collection getRelationViews(); + + Collection getQueries(); + + @Override + ModelQueryAdapter createModelAdapter(Model model); +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/RelationLike.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/RelationLike.java new file mode 100644 index 00000000..8c784d8b --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/RelationLike.java @@ -0,0 +1,11 @@ +package tools.refinery.store.query; + +public interface RelationLike { + String name(); + + int arity(); + + default boolean invalidIndex(int i) { + return i < 0 || i >= arity(); + } +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/ResultSet.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/ResultSet.java new file mode 100644 index 00000000..3542e252 --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/ResultSet.java @@ -0,0 +1,25 @@ +package tools.refinery.store.query; + +import tools.refinery.store.tuple.Tuple; +import tools.refinery.store.tuple.TupleLike; + +import java.util.Optional; +import java.util.stream.Stream; + +public interface ResultSet { + boolean hasResult(); + + boolean hasResult(Tuple parameters); + + Optional oneResult(); + + Optional oneResult(Tuple parameters); + + Stream allResults(); + + Stream allResults(Tuple parameters); + + int countResults(); + + int countResults(Tuple parameters); +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/Variable.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/Variable.java new file mode 100644 index 00000000..2eb87649 --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/Variable.java @@ -0,0 +1,58 @@ +package tools.refinery.store.query; + +import tools.refinery.store.query.literal.ConstantLiteral; +import tools.refinery.store.query.literal.EquivalenceLiteral; + +import java.util.Objects; + +public class Variable { + private final String name; + private final String uniqueName; + + public Variable() { + this(null); + } + + public Variable(String name) { + super(); + this.name = name; + this.uniqueName = DnfUtils.generateUniqueName(name); + + } + public String getName() { + return name; + } + + public String getUniqueName() { + return uniqueName; + } + + public boolean isNamed() { + return name != null; + } + + public ConstantLiteral isConstant(int value) { + return new ConstantLiteral(this, value); + } + + public EquivalenceLiteral isEquivalent(Variable other) { + return new EquivalenceLiteral(true, this, other); + } + + public EquivalenceLiteral notEquivalent(Variable other) { + return new EquivalenceLiteral(false, this, other); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Variable variable = (Variable) o; + return Objects.equals(uniqueName, variable.uniqueName); + } + + @Override + public int hashCode() { + return Objects.hash(uniqueName); + } +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/BooleanLiteral.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/BooleanLiteral.java new file mode 100644 index 00000000..fd2f1eec --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/BooleanLiteral.java @@ -0,0 +1,37 @@ +package tools.refinery.store.query.literal; + +import tools.refinery.store.query.Variable; + +import java.util.Map; +import java.util.Set; + +public class BooleanLiteral implements Literal { + public static final BooleanLiteral TRUE = new BooleanLiteral(LiteralReduction.ALWAYS_TRUE); + public static final BooleanLiteral FALSE = new BooleanLiteral(LiteralReduction.ALWAYS_FALSE); + + private final LiteralReduction reduction; + + private BooleanLiteral(LiteralReduction reduction) { + this.reduction = reduction; + } + + @Override + public void collectAllVariables(Set variables) { + // No variables to collect. + } + + @Override + public Literal substitute(Map substitution) { + // No variables to substitute. + return this; + } + + @Override + public LiteralReduction getReduction() { + return reduction; + } + + public static BooleanLiteral fromBoolean(boolean value) { + return value ? TRUE : FALSE; + } +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/CallLiteral.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/CallLiteral.java new file mode 100644 index 00000000..5e1ae94d --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/CallLiteral.java @@ -0,0 +1,66 @@ +package tools.refinery.store.query.literal; + +import tools.refinery.store.query.DnfUtils; +import tools.refinery.store.query.RelationLike; +import tools.refinery.store.query.Variable; + +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +public abstract class CallLiteral implements Literal { + private final CallPolarity polarity; + private final T target; + private final List arguments; + + protected CallLiteral(CallPolarity polarity, T target, List arguments) { + if (arguments.size() != target.arity()) { + throw new IllegalArgumentException("%s needs %d arguments, but got %s".formatted(target.name(), + target.arity(), arguments.size())); + } + if (polarity.isTransitive() && target.arity() != 2) { + throw new IllegalArgumentException("Transitive closures can only take binary relations"); + } + this.polarity = polarity; + this.target = target; + this.arguments = arguments; + } + + public CallPolarity getPolarity() { + return polarity; + } + + public T getTarget() { + return target; + } + + public List getArguments() { + return arguments; + } + + @Override + public void collectAllVariables(Set variables) { + if (polarity.isPositive()) { + variables.addAll(arguments); + } + } + + protected List substituteArguments(Map substitution) { + return arguments.stream().map(variable -> DnfUtils.maybeSubstitute(variable, substitution)).toList(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CallLiteral callAtom = (CallLiteral) o; + return polarity == callAtom.polarity && Objects.equals(target, callAtom.target) && + Objects.equals(arguments, callAtom.arguments); + } + + @Override + public int hashCode() { + return Objects.hash(polarity, target, arguments); + } +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/CallPolarity.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/CallPolarity.java new file mode 100644 index 00000000..84b4b771 --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/CallPolarity.java @@ -0,0 +1,32 @@ +package tools.refinery.store.query.literal; + +public enum CallPolarity { + POSITIVE(true, false), + NEGATIVE(false, false), + TRANSITIVE(true, true); + + private final boolean positive; + + private final boolean transitive; + + CallPolarity(boolean positive, boolean transitive) { + this.positive = positive; + this.transitive = transitive; + } + + public boolean isPositive() { + return positive; + } + + public boolean isTransitive() { + return transitive; + } + + public CallPolarity negate() { + return switch (this) { + case POSITIVE -> NEGATIVE; + case NEGATIVE -> POSITIVE; + case TRANSITIVE -> throw new IllegalArgumentException("Transitive polarity cannot be negated"); + }; + } +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/ConstantLiteral.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/ConstantLiteral.java new file mode 100644 index 00000000..746d23af --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/ConstantLiteral.java @@ -0,0 +1,19 @@ +package tools.refinery.store.query.literal; + +import tools.refinery.store.query.DnfUtils; +import tools.refinery.store.query.Variable; + +import java.util.Map; +import java.util.Set; + +public record ConstantLiteral(Variable variable, int nodeId) implements Literal { + @Override + public void collectAllVariables(Set variables) { + variables.add(variable); + } + + @Override + public ConstantLiteral substitute(Map substitution) { + return new ConstantLiteral(DnfUtils.maybeSubstitute(variable, substitution), nodeId); + } +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/DnfCallLiteral.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/DnfCallLiteral.java new file mode 100644 index 00000000..de6c6005 --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/DnfCallLiteral.java @@ -0,0 +1,29 @@ +package tools.refinery.store.query.literal; + +import tools.refinery.store.query.Dnf; +import tools.refinery.store.query.Variable; + +import java.util.List; +import java.util.Map; + +public final class DnfCallLiteral extends CallLiteral implements PolarLiteral { + public DnfCallLiteral(CallPolarity polarity, Dnf target, List arguments) { + super(polarity, target, arguments); + } + + @Override + public DnfCallLiteral substitute(Map substitution) { + return new DnfCallLiteral(getPolarity(), getTarget(), substituteArguments(substitution)); + } + + @Override + public DnfCallLiteral negate() { + return new DnfCallLiteral(getPolarity().negate(), getTarget(), getArguments()); + } + + @Override + public LiteralReduction getReduction() { + var dnfReduction = getTarget().getReduction(); + return getPolarity().isPositive() ? dnfReduction : dnfReduction.negate(); + } +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/EquivalenceLiteral.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/EquivalenceLiteral.java new file mode 100644 index 00000000..f30179b2 --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/EquivalenceLiteral.java @@ -0,0 +1,35 @@ +package tools.refinery.store.query.literal; + +import tools.refinery.store.query.DnfUtils; +import tools.refinery.store.query.Variable; + +import java.util.Map; +import java.util.Set; + +public record EquivalenceLiteral(boolean positive, Variable left, Variable right) + implements PolarLiteral { + @Override + public void collectAllVariables(Set variables) { + variables.add(left); + variables.add(right); + } + + @Override + public EquivalenceLiteral negate() { + return new EquivalenceLiteral(!positive, left, right); + } + + @Override + public EquivalenceLiteral substitute(Map substitution) { + return new EquivalenceLiteral(positive, DnfUtils.maybeSubstitute(left, substitution), + DnfUtils.maybeSubstitute(right, substitution)); + } + + @Override + public LiteralReduction getReduction() { + if (left.equals(right)) { + return positive ? LiteralReduction.ALWAYS_TRUE : LiteralReduction.ALWAYS_FALSE; + } + return LiteralReduction.NOT_REDUCIBLE; + } +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/Literal.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/Literal.java new file mode 100644 index 00000000..a6893acf --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/Literal.java @@ -0,0 +1,16 @@ +package tools.refinery.store.query.literal; + +import tools.refinery.store.query.Variable; + +import java.util.Map; +import java.util.Set; + +public interface Literal { + void collectAllVariables(Set variables); + + Literal substitute(Map substitution); + + default LiteralReduction getReduction() { + return LiteralReduction.NOT_REDUCIBLE; + } +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/LiteralReduction.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/LiteralReduction.java new file mode 100644 index 00000000..146089f6 --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/LiteralReduction.java @@ -0,0 +1,26 @@ +package tools.refinery.store.query.literal; + +public enum LiteralReduction { + /** + * Signifies that a literal should be preserved in the clause. + */ + NOT_REDUCIBLE, + + /** + * Signifies that the literal may be omitted from the cause (if the model being queried is nonempty). + */ + ALWAYS_TRUE, + + /** + * Signifies that the clause with the literal may be omitted entirely. + */ + ALWAYS_FALSE; + + public LiteralReduction negate() { + return switch (this) { + case NOT_REDUCIBLE -> NOT_REDUCIBLE; + case ALWAYS_TRUE -> ALWAYS_FALSE; + case ALWAYS_FALSE -> ALWAYS_TRUE; + }; + } +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/Literals.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/Literals.java new file mode 100644 index 00000000..2c7e893f --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/Literals.java @@ -0,0 +1,11 @@ +package tools.refinery.store.query.literal; + +public final class Literals { + private Literals() { + throw new IllegalStateException("This is a static utility class and should not be instantiated directly"); + } + + public static > T not(PolarLiteral literal) { + return literal.negate(); + } +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/PolarLiteral.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/PolarLiteral.java new file mode 100644 index 00000000..32523675 --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/PolarLiteral.java @@ -0,0 +1,5 @@ +package tools.refinery.store.query.literal; + +public interface PolarLiteral> extends Literal { + T negate(); +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/RelationViewLiteral.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/RelationViewLiteral.java new file mode 100644 index 00000000..4718b550 --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/RelationViewLiteral.java @@ -0,0 +1,24 @@ +package tools.refinery.store.query.literal; + +import tools.refinery.store.query.Variable; +import tools.refinery.store.query.view.AnyRelationView; + +import java.util.List; +import java.util.Map; + +public final class RelationViewLiteral extends CallLiteral + implements PolarLiteral { + public RelationViewLiteral(CallPolarity polarity, AnyRelationView target, List arguments) { + super(polarity, target, arguments); + } + + @Override + public RelationViewLiteral substitute(Map substitution) { + return new RelationViewLiteral(getPolarity(), getTarget(), substituteArguments(substitution)); + } + + @Override + public RelationViewLiteral negate() { + return new RelationViewLiteral(getPolarity().negate(), getTarget(), getArguments()); + } +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/AnyRelationView.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/AnyRelationView.java new file mode 100644 index 00000000..328cde3a --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/AnyRelationView.java @@ -0,0 +1,24 @@ +package tools.refinery.store.query.view; + +import tools.refinery.store.model.Model; +import tools.refinery.store.query.FunctionalDependency; +import tools.refinery.store.representation.AnySymbol; +import tools.refinery.store.query.RelationLike; + +import java.util.Set; + +public sealed interface AnyRelationView extends RelationLike permits RelationView { + AnySymbol getSymbol(); + + default Set> getFunctionalDependencies() { + return Set.of(); + } + + default Set getImpliedRelationViews() { + return Set.of(); + } + + boolean get(Model model, Object[] tuple); + + Iterable getAll(Model model); +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/FilteredRelationView.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/FilteredRelationView.java new file mode 100644 index 00000000..64c601bb --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/FilteredRelationView.java @@ -0,0 +1,49 @@ +package tools.refinery.store.query.view; + +import tools.refinery.store.tuple.Tuple; +import tools.refinery.store.representation.Symbol; + +import java.util.Objects; +import java.util.function.BiPredicate; +import java.util.function.Predicate; + +public class FilteredRelationView extends TuplePreservingRelationView { + private final BiPredicate predicate; + + public FilteredRelationView(Symbol symbol, String name, BiPredicate predicate) { + super(symbol, name); + this.predicate = predicate; + } + + public FilteredRelationView(Symbol symbol, BiPredicate predicate) { + super(symbol); + this.predicate = predicate; + } + + public FilteredRelationView(Symbol symbol, String name, Predicate predicate) { + this(symbol, name, (k, v) -> predicate.test(v)); + } + + public FilteredRelationView(Symbol symbol, Predicate predicate) { + this(symbol, (k, v) -> predicate.test(v)); + } + + @Override + public boolean filter(Tuple key, T value) { + return this.predicate.test(key, value); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + if (!super.equals(o)) return false; + FilteredRelationView that = (FilteredRelationView) o; + return Objects.equals(predicate, that.predicate); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), predicate); + } +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/FunctionalRelationView.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/FunctionalRelationView.java new file mode 100644 index 00000000..3d278a8b --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/FunctionalRelationView.java @@ -0,0 +1,71 @@ +package tools.refinery.store.query.view; + +import tools.refinery.store.model.Model; +import tools.refinery.store.query.FunctionalDependency; +import tools.refinery.store.representation.Symbol; +import tools.refinery.store.tuple.Tuple; +import tools.refinery.store.tuple.Tuple1; + +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +public final class FunctionalRelationView extends RelationView { + public FunctionalRelationView(Symbol symbol, String name) { + super(symbol, name); + } + + public FunctionalRelationView(Symbol symbol) { + super(symbol); + } + + @Override + public Set> getFunctionalDependencies() { + var arity = getSymbol().arity(); + var forEach = IntStream.range(0, arity).boxed().collect(Collectors.toUnmodifiableSet()); + var unique = Set.of(arity); + return Set.of(new FunctionalDependency<>(forEach, unique)); + } + + @Override + public Set getImpliedRelationViews() { + var symbol = getSymbol(); + var impliedIndices = IntStream.range(0, symbol.arity()).boxed().toList(); + var keyOnlyRelationView = new KeyOnlyRelationView<>(symbol); + return Set.of(new RelationViewImplication(this, keyOnlyRelationView, impliedIndices)); + } + + @Override + public boolean filter(Tuple key, T value) { + return true; + } + + @Override + public Object[] forwardMap(Tuple key, T value) { + int size = key.getSize(); + Object[] result = new Object[size + 1]; + for (int i = 0; i < size; i++) { + result[i] = Tuple.of(key.get(i)); + } + result[key.getSize()] = value; + return result; + } + + @Override + public boolean get(Model model, Object[] tuple) { + int[] content = new int[tuple.length - 1]; + for (int i = 0; i < tuple.length - 1; i++) { + content[i] = ((Tuple1) tuple[i]).value0(); + } + Tuple key = Tuple.of(content); + @SuppressWarnings("unchecked") + T valueInTuple = (T) tuple[tuple.length - 1]; + T valueInMap = model.getInterpretation(getSymbol()).get(key); + return valueInTuple.equals(valueInMap); + } + + @Override + public int arity() { + return getSymbol().arity() + 1; + } +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/KeyOnlyRelationView.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/KeyOnlyRelationView.java new file mode 100644 index 00000000..e1b2e45b --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/KeyOnlyRelationView.java @@ -0,0 +1,36 @@ +package tools.refinery.store.query.view; + +import tools.refinery.store.representation.Symbol; +import tools.refinery.store.tuple.Tuple; + +import java.util.Objects; + +public final class KeyOnlyRelationView extends TuplePreservingRelationView { + public static final String VIEW_NAME = "key"; + + private final T defaultValue; + + public KeyOnlyRelationView(Symbol symbol) { + super(symbol, VIEW_NAME); + defaultValue = symbol.defaultValue(); + } + + @Override + public boolean filter(Tuple key, T value) { + return !Objects.equals(value, defaultValue); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + if (!super.equals(o)) return false; + KeyOnlyRelationView that = (KeyOnlyRelationView) o; + return Objects.equals(defaultValue, that.defaultValue); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), defaultValue); + } +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/RelationView.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/RelationView.java new file mode 100644 index 00000000..2714a8c5 --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/RelationView.java @@ -0,0 +1,82 @@ +package tools.refinery.store.query.view; + +import tools.refinery.store.query.Variable; +import tools.refinery.store.map.CursorAsIterator; +import tools.refinery.store.model.Model; +import tools.refinery.store.query.literal.CallPolarity; +import tools.refinery.store.query.literal.RelationViewLiteral; +import tools.refinery.store.representation.Symbol; +import tools.refinery.store.tuple.Tuple; + +import java.util.List; +import java.util.Objects; +import java.util.UUID; + +/** + * Represents a view of a {@link Symbol} that can be queried. + * + * @param + * @author Oszkar Semerath + */ +public abstract non-sealed class RelationView implements AnyRelationView { + private final Symbol symbol; + + private final String name; + + protected RelationView(Symbol symbol, String name) { + this.symbol = symbol; + this.name = name; + } + + protected RelationView(Symbol representation) { + this(representation, UUID.randomUUID().toString()); + } + + @Override + public Symbol getSymbol() { + return symbol; + } + + @Override + public String name() { + return symbol.name() + "#" + name; + } + + public abstract boolean filter(Tuple key, T value); + + public abstract Object[] forwardMap(Tuple key, T value); + + @Override + public Iterable getAll(Model model) { + return (() -> new CursorAsIterator<>(model.getInterpretation(symbol).getAll(), this::forwardMap, this::filter)); + } + + public RelationViewLiteral call(CallPolarity polarity, List arguments) { + return new RelationViewLiteral(polarity, this, arguments); + } + + public RelationViewLiteral call(CallPolarity polarity, Variable... arguments) { + return call(polarity, List.of(arguments)); + } + + public RelationViewLiteral call(Variable... arguments) { + return call(CallPolarity.POSITIVE, arguments); + } + + public RelationViewLiteral callTransitive(Variable left, Variable right) { + return call(CallPolarity.TRANSITIVE, List.of(left, right)); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + RelationView that = (RelationView) o; + return Objects.equals(symbol, that.symbol) && Objects.equals(name, that.name); + } + + @Override + public int hashCode() { + return Objects.hash(symbol, name); + } +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/RelationViewImplication.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/RelationViewImplication.java new file mode 100644 index 00000000..2ba1fcc4 --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/RelationViewImplication.java @@ -0,0 +1,19 @@ +package tools.refinery.store.query.view; + +import java.util.List; + +public record RelationViewImplication(AnyRelationView implyingRelationView, AnyRelationView impliedRelationView, + List impliedIndices) { + public RelationViewImplication { + if (impliedIndices.size() != impliedRelationView.arity()) { + throw new IllegalArgumentException("Expected %d implied indices for %s, but %d are provided" + .formatted(impliedRelationView.arity(), impliedRelationView, impliedIndices.size())); + } + for (var index : impliedIndices) { + if (impliedRelationView.invalidIndex(index)) { + throw new IllegalArgumentException("%d is not a valid index for %s".formatted(index, + implyingRelationView)); + } + } + } +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/TuplePreservingRelationView.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/TuplePreservingRelationView.java new file mode 100644 index 00000000..8cc4986e --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/TuplePreservingRelationView.java @@ -0,0 +1,44 @@ +package tools.refinery.store.query.view; + +import tools.refinery.store.model.Model; +import tools.refinery.store.tuple.Tuple; +import tools.refinery.store.tuple.Tuple1; +import tools.refinery.store.representation.Symbol; + +public abstract class TuplePreservingRelationView extends RelationView { + protected TuplePreservingRelationView(Symbol symbol, String name) { + super(symbol, name); + } + + protected TuplePreservingRelationView(Symbol symbol) { + super(symbol); + } + + public Object[] forwardMap(Tuple key) { + Object[] result = new Object[key.getSize()]; + for (int i = 0; i < key.getSize(); i++) { + result[i] = Tuple.of(key.get(i)); + } + return result; + } + + @Override + public Object[] forwardMap(Tuple key, T value) { + return forwardMap(key); + } + + @Override + public boolean get(Model model, Object[] tuple) { + int[] content = new int[tuple.length]; + for (int i = 0; i < tuple.length; i++) { + content[i] = ((Tuple1) tuple[i]).value0(); + } + Tuple key = Tuple.of(content); + T value = model.getInterpretation(getSymbol()).get(key); + return filter(key, value); + } + + public int arity() { + return this.getSymbol().arity(); + } +} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/PartialInterpretation.java b/subprojects/store/src/main/java/tools/refinery/store/partial/PartialInterpretation.java deleted file mode 100644 index 331fa294..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/partial/PartialInterpretation.java +++ /dev/null @@ -1,19 +0,0 @@ -package tools.refinery.store.partial; - -import tools.refinery.store.adapter.ModelAdapterBuilderFactory; -import tools.refinery.store.model.ModelStoreBuilder; -import tools.refinery.store.partial.internal.PartialInterpretationBuilderImpl; - -public final class PartialInterpretation extends ModelAdapterBuilderFactory { - public static final PartialInterpretation ADAPTER = new PartialInterpretation(); - - private PartialInterpretation() { - super(PartialInterpretationAdapter.class, PartialInterpretationStoreAdapter.class, PartialInterpretationBuilder.class); - } - - @Override - public PartialInterpretationBuilder createBuilder(ModelStoreBuilder storeBuilder) { - return new PartialInterpretationBuilderImpl(storeBuilder); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/PartialInterpretationAdapter.java b/subprojects/store/src/main/java/tools/refinery/store/partial/PartialInterpretationAdapter.java deleted file mode 100644 index 2c83a200..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/partial/PartialInterpretationAdapter.java +++ /dev/null @@ -1,9 +0,0 @@ -package tools.refinery.store.partial; - -import tools.refinery.store.adapter.ModelAdapter; - -public interface PartialInterpretationAdapter extends ModelAdapter { - @Override - PartialInterpretationStoreAdapter getStoreAdapter(); -} - diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/PartialInterpretationBuilder.java b/subprojects/store/src/main/java/tools/refinery/store/partial/PartialInterpretationBuilder.java deleted file mode 100644 index 0ec13836..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/partial/PartialInterpretationBuilder.java +++ /dev/null @@ -1,9 +0,0 @@ -package tools.refinery.store.partial; - -import tools.refinery.store.adapter.ModelAdapterBuilder; -import tools.refinery.store.model.ModelStore; - -public interface PartialInterpretationBuilder extends ModelAdapterBuilder { - @Override - PartialInterpretationStoreAdapter createStoreAdapter(ModelStore store); -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/PartialInterpretationStoreAdapter.java b/subprojects/store/src/main/java/tools/refinery/store/partial/PartialInterpretationStoreAdapter.java deleted file mode 100644 index d4eb770d..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/partial/PartialInterpretationStoreAdapter.java +++ /dev/null @@ -1,9 +0,0 @@ -package tools.refinery.store.partial; - -import tools.refinery.store.adapter.ModelStoreAdapter; -import tools.refinery.store.model.Model; - -public interface PartialInterpretationStoreAdapter extends ModelStoreAdapter { - @Override - PartialInterpretationAdapter createModelAdapter(Model model); -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/internal/PartialInterpretationAdapterImpl.java b/subprojects/store/src/main/java/tools/refinery/store/partial/internal/PartialInterpretationAdapterImpl.java deleted file mode 100644 index 4b3977c0..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/partial/internal/PartialInterpretationAdapterImpl.java +++ /dev/null @@ -1,24 +0,0 @@ -package tools.refinery.store.partial.internal; - -import tools.refinery.store.model.Model; -import tools.refinery.store.partial.PartialInterpretationAdapter; - -public class PartialInterpretationAdapterImpl implements PartialInterpretationAdapter { - private final Model model; - private final PartialInterpretationStoreAdapterImpl storeAdapter; - - PartialInterpretationAdapterImpl(Model model, PartialInterpretationStoreAdapterImpl storeAdapter) { - this.model = model; - this.storeAdapter = storeAdapter; - } - - @Override - public Model getModel() { - return model; - } - - @Override - public PartialInterpretationStoreAdapterImpl getStoreAdapter() { - return storeAdapter; - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/internal/PartialInterpretationBuilderImpl.java b/subprojects/store/src/main/java/tools/refinery/store/partial/internal/PartialInterpretationBuilderImpl.java deleted file mode 100644 index 4609dc32..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/partial/internal/PartialInterpretationBuilderImpl.java +++ /dev/null @@ -1,17 +0,0 @@ -package tools.refinery.store.partial.internal; - -import tools.refinery.store.adapter.AbstractModelAdapterBuilder; -import tools.refinery.store.model.ModelStore; -import tools.refinery.store.model.ModelStoreBuilder; -import tools.refinery.store.partial.PartialInterpretationBuilder; - -public class PartialInterpretationBuilderImpl extends AbstractModelAdapterBuilder implements PartialInterpretationBuilder { - public PartialInterpretationBuilderImpl(ModelStoreBuilder storeBuilder) { - super(storeBuilder); - } - - @Override - public PartialInterpretationStoreAdapterImpl createStoreAdapter(ModelStore store) { - return null; - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/internal/PartialInterpretationStoreAdapterImpl.java b/subprojects/store/src/main/java/tools/refinery/store/partial/internal/PartialInterpretationStoreAdapterImpl.java deleted file mode 100644 index 970b802b..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/partial/internal/PartialInterpretationStoreAdapterImpl.java +++ /dev/null @@ -1,23 +0,0 @@ -package tools.refinery.store.partial.internal; - -import tools.refinery.store.model.Model; -import tools.refinery.store.model.ModelStore; -import tools.refinery.store.partial.PartialInterpretationStoreAdapter; - -public class PartialInterpretationStoreAdapterImpl implements PartialInterpretationStoreAdapter { - private final ModelStore store; - - PartialInterpretationStoreAdapterImpl(ModelStore store) { - this.store = store; - } - - @Override - public ModelStore getStore() { - return store; - } - - @Override - public PartialInterpretationAdapterImpl createModelAdapter(Model model) { - return new PartialInterpretationAdapterImpl(model, this); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/literal/ModalDnfCallLiteral.java b/subprojects/store/src/main/java/tools/refinery/store/partial/literal/ModalDnfCallLiteral.java deleted file mode 100644 index 8070726a..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/partial/literal/ModalDnfCallLiteral.java +++ /dev/null @@ -1,30 +0,0 @@ -package tools.refinery.store.partial.literal; - -import tools.refinery.store.query.Dnf; -import tools.refinery.store.query.Variable; -import tools.refinery.store.query.literal.CallPolarity; -import tools.refinery.store.query.literal.DnfCallLiteral; -import tools.refinery.store.query.literal.PolarLiteral; - -import java.util.List; -import java.util.Map; - -public class ModalDnfCallLiteral extends ModalLiteral implements PolarLiteral { - public ModalDnfCallLiteral(CallPolarity polarity, Modality modality, Dnf target, List arguments) { - super(polarity, modality, target, arguments); - } - - public ModalDnfCallLiteral(Modality modality, DnfCallLiteral baseLiteral) { - super(modality.commute(baseLiteral.getPolarity()), baseLiteral); - } - - @Override - public ModalDnfCallLiteral substitute(Map substitution) { - return new ModalDnfCallLiteral(getPolarity(), getModality(), getTarget(), substituteArguments(substitution)); - } - - @Override - public ModalDnfCallLiteral negate() { - return new ModalDnfCallLiteral(getPolarity().negate(), getModality(), getTarget(), getArguments()); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/literal/ModalLiteral.java b/subprojects/store/src/main/java/tools/refinery/store/partial/literal/ModalLiteral.java deleted file mode 100644 index a1b6c83e..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/partial/literal/ModalLiteral.java +++ /dev/null @@ -1,45 +0,0 @@ -package tools.refinery.store.partial.literal; - -import tools.refinery.store.query.RelationLike; -import tools.refinery.store.query.Variable; -import tools.refinery.store.query.literal.CallLiteral; -import tools.refinery.store.query.literal.CallPolarity; - -import java.util.List; -import java.util.Objects; - -public abstract class ModalLiteral extends CallLiteral { - private final Modality modality; - - protected ModalLiteral(CallPolarity polarity, Modality modality, T target, List arguments) { - super(polarity, target, arguments); - this.modality = modality; - } - - protected ModalLiteral(Modality modality, CallLiteral baseLiteral) { - this(baseLiteral.getPolarity(), commute(modality, baseLiteral.getPolarity()), baseLiteral.getTarget(), - baseLiteral.getArguments()); - } - - public Modality getModality() { - return modality; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; - ModalLiteral that = (ModalLiteral) o; - return modality == that.modality; - } - - @Override - public int hashCode() { - return Objects.hash(super.hashCode(), modality); - } - - private static Modality commute(Modality modality, CallPolarity polarity) { - return polarity.isPositive() ? modality : modality.negate(); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/literal/ModalRelationLiteral.java b/subprojects/store/src/main/java/tools/refinery/store/partial/literal/ModalRelationLiteral.java deleted file mode 100644 index dbaa524f..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/partial/literal/ModalRelationLiteral.java +++ /dev/null @@ -1,31 +0,0 @@ -package tools.refinery.store.partial.literal; - -import tools.refinery.store.partial.representation.PartialRelation; -import tools.refinery.store.query.Variable; -import tools.refinery.store.query.literal.CallPolarity; -import tools.refinery.store.query.literal.PolarLiteral; - -import java.util.List; -import java.util.Map; - -public final class ModalRelationLiteral extends ModalLiteral - implements PolarLiteral { - public ModalRelationLiteral(CallPolarity polarity, Modality modality, PartialRelation target, - List arguments) { - super(polarity, modality, target, arguments); - } - - public ModalRelationLiteral(Modality modality, PartialRelationLiteral baseLiteral) { - super(modality, baseLiteral); - } - - @Override - public ModalRelationLiteral substitute(Map substitution) { - return new ModalRelationLiteral(getPolarity(), getModality(), getTarget(), substituteArguments(substitution)); - } - - @Override - public ModalRelationLiteral negate() { - return new ModalRelationLiteral(getPolarity().negate(), getModality(), getTarget(), getArguments()); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/literal/Modality.java b/subprojects/store/src/main/java/tools/refinery/store/partial/literal/Modality.java deleted file mode 100644 index d647ef0a..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/partial/literal/Modality.java +++ /dev/null @@ -1,31 +0,0 @@ -package tools.refinery.store.partial.literal; - -import tools.refinery.store.query.literal.CallPolarity; - -import java.util.Locale; - -public enum Modality { - MUST, - MAY, - CURRENT; - - public Modality negate() { - return switch(this) { - case MUST -> MAY; - case MAY -> MUST; - case CURRENT -> CURRENT; - }; - } - - public Modality commute(CallPolarity polarity) { - if (polarity.isPositive()) { - return this; - } - return this.negate(); - } - - @Override - public String toString() { - return name().toLowerCase(Locale.ROOT); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/literal/PartialLiterals.java b/subprojects/store/src/main/java/tools/refinery/store/partial/literal/PartialLiterals.java deleted file mode 100644 index 51d388d3..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/partial/literal/PartialLiterals.java +++ /dev/null @@ -1,33 +0,0 @@ -package tools.refinery.store.partial.literal; - -import tools.refinery.store.query.literal.DnfCallLiteral; - -public final class PartialLiterals { - private PartialLiterals() { - throw new IllegalStateException("This is a static utility class and should not be instantiated directly"); - } - - public ModalRelationLiteral may(PartialRelationLiteral literal) { - return new ModalRelationLiteral(Modality.MAY, literal); - } - - public ModalRelationLiteral must(PartialRelationLiteral literal) { - return new ModalRelationLiteral(Modality.MUST, literal); - } - - public ModalRelationLiteral current(PartialRelationLiteral literal) { - return new ModalRelationLiteral(Modality.CURRENT, literal); - } - - public ModalDnfCallLiteral may(DnfCallLiteral literal) { - return new ModalDnfCallLiteral(Modality.MAY, literal); - } - - public ModalDnfCallLiteral must(DnfCallLiteral literal) { - return new ModalDnfCallLiteral(Modality.MUST, literal); - } - - public ModalDnfCallLiteral current(DnfCallLiteral literal) { - return new ModalDnfCallLiteral(Modality.CURRENT, literal); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/literal/PartialRelationLiteral.java b/subprojects/store/src/main/java/tools/refinery/store/partial/literal/PartialRelationLiteral.java deleted file mode 100644 index dc1a1da3..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/partial/literal/PartialRelationLiteral.java +++ /dev/null @@ -1,27 +0,0 @@ -package tools.refinery.store.partial.literal; - -import tools.refinery.store.partial.representation.PartialRelation; -import tools.refinery.store.query.Variable; -import tools.refinery.store.query.literal.CallLiteral; -import tools.refinery.store.query.literal.CallPolarity; -import tools.refinery.store.query.literal.PolarLiteral; - -import java.util.List; -import java.util.Map; - -public final class PartialRelationLiteral extends CallLiteral - implements PolarLiteral { - public PartialRelationLiteral(CallPolarity polarity, PartialRelation target, List substitution) { - super(polarity, target, substitution); - } - - @Override - public PartialRelationLiteral substitute(Map substitution) { - return new PartialRelationLiteral(getPolarity(), getTarget(), substituteArguments(substitution)); - } - - @Override - public PartialRelationLiteral negate() { - return new PartialRelationLiteral(getPolarity().negate(), getTarget(), getArguments()); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/representation/AnyPartialFunction.java b/subprojects/store/src/main/java/tools/refinery/store/partial/representation/AnyPartialFunction.java deleted file mode 100644 index 1113245e..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/partial/representation/AnyPartialFunction.java +++ /dev/null @@ -1,4 +0,0 @@ -package tools.refinery.store.partial.representation; - -public sealed interface AnyPartialFunction extends AnyPartialSymbol permits PartialFunction { -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/representation/AnyPartialSymbol.java b/subprojects/store/src/main/java/tools/refinery/store/partial/representation/AnyPartialSymbol.java deleted file mode 100644 index 25096e74..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/partial/representation/AnyPartialSymbol.java +++ /dev/null @@ -1,11 +0,0 @@ -package tools.refinery.store.partial.representation; - -import tools.refinery.store.representation.AnyAbstractDomain; - -public sealed interface AnyPartialSymbol permits AnyPartialFunction, PartialSymbol { - String name(); - - int arity(); - - AnyAbstractDomain abstractDomain(); -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/representation/PartialFunction.java b/subprojects/store/src/main/java/tools/refinery/store/partial/representation/PartialFunction.java deleted file mode 100644 index 3c186f6f..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/partial/representation/PartialFunction.java +++ /dev/null @@ -1,32 +0,0 @@ -package tools.refinery.store.partial.representation; - -import tools.refinery.store.representation.AbstractDomain; - -public record PartialFunction(String name, int arity, AbstractDomain abstractDomain) - implements AnyPartialFunction, PartialSymbol { - @Override - public A defaultValue() { - return null; - } - - @Override - public C defaultConcreteValue() { - return null; - } - - @Override - public boolean equals(Object o) { - return this == o; - } - - @Override - public int hashCode() { - // Compare by identity to make hash table lookups more efficient. - return System.identityHashCode(this); - } - - @Override - public String toString() { - return "%s/%d".formatted(name, arity); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/representation/PartialRelation.java b/subprojects/store/src/main/java/tools/refinery/store/partial/representation/PartialRelation.java deleted file mode 100644 index 127355ca..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/partial/representation/PartialRelation.java +++ /dev/null @@ -1,66 +0,0 @@ -package tools.refinery.store.partial.representation; - -import tools.refinery.store.partial.literal.ModalRelationLiteral; -import tools.refinery.store.partial.literal.PartialRelationLiteral; -import tools.refinery.store.query.RelationLike; -import tools.refinery.store.query.Variable; -import tools.refinery.store.query.literal.CallPolarity; -import tools.refinery.store.partial.literal.Modality; -import tools.refinery.store.representation.AbstractDomain; -import tools.refinery.store.representation.TruthValue; -import tools.refinery.store.representation.TruthValueDomain; - -import java.util.List; - -public record PartialRelation(String name, int arity) implements PartialSymbol, RelationLike { - @Override - public AbstractDomain abstractDomain() { - return TruthValueDomain.INSTANCE; - } - - @Override - public TruthValue defaultValue() { - return TruthValue.FALSE; - } - - @Override - public Boolean defaultConcreteValue() { - return false; - } - - public ModalRelationLiteral call(CallPolarity polarity, Modality modality, List arguments) { - return new ModalRelationLiteral(polarity, modality, this, arguments); - } - - public PartialRelationLiteral call(CallPolarity polarity, List arguments) { - return new PartialRelationLiteral(polarity, this, arguments); - } - - public PartialRelationLiteral call(CallPolarity polarity, Variable... arguments) { - return call(polarity, List.of(arguments)); - } - - public PartialRelationLiteral call(Variable... arguments) { - return call(CallPolarity.POSITIVE, arguments); - } - - public PartialRelationLiteral callTransitive(Variable left, Variable right) { - return call(CallPolarity.TRANSITIVE, List.of(left, right)); - } - - @Override - public boolean equals(Object o) { - return this == o; - } - - @Override - public int hashCode() { - // Compare by identity to make hash table lookups more efficient. - return System.identityHashCode(this); - } - - @Override - public String toString() { - return "%s/%d".formatted(name, arity); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/representation/PartialSymbol.java b/subprojects/store/src/main/java/tools/refinery/store/partial/representation/PartialSymbol.java deleted file mode 100644 index 38533fa9..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/partial/representation/PartialSymbol.java +++ /dev/null @@ -1,12 +0,0 @@ -package tools.refinery.store.partial.representation; - -import tools.refinery.store.representation.AbstractDomain; - -public sealed interface PartialSymbol extends AnyPartialSymbol permits PartialFunction, PartialRelation { - @Override - AbstractDomain abstractDomain(); - - A defaultValue(); - - C defaultConcreteValue(); -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/EliminatedType.java b/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/EliminatedType.java deleted file mode 100644 index 9adf6bc8..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/EliminatedType.java +++ /dev/null @@ -1,6 +0,0 @@ -package tools.refinery.store.partial.translator.typehierarchy; - -import tools.refinery.store.partial.representation.PartialRelation; - -record EliminatedType(PartialRelation replacement) implements TypeAnalysisResult { -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/ExtendedTypeInfo.java b/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/ExtendedTypeInfo.java deleted file mode 100644 index d3f66a4c..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/ExtendedTypeInfo.java +++ /dev/null @@ -1,101 +0,0 @@ -package tools.refinery.store.partial.translator.typehierarchy; - -import org.jetbrains.annotations.NotNull; -import tools.refinery.store.partial.representation.PartialRelation; - -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.Objects; -import java.util.Set; - -final class ExtendedTypeInfo implements Comparable { - private final int index; - private final PartialRelation type; - private final TypeInfo typeInfo; - private final Set allSubtypes = new LinkedHashSet<>(); - private final Set allSupertypes; - private final Set concreteSubtypesAndSelf = new LinkedHashSet<>(); - private Set directSubtypes; - private final Set unsortedDirectSupertypes = new HashSet<>(); - - public ExtendedTypeInfo(int index, PartialRelation type, TypeInfo typeInfo) { - this.index = index; - this.type = type; - this.typeInfo = typeInfo; - this.allSupertypes = new LinkedHashSet<>(typeInfo.supertypes()); - } - - public PartialRelation getType() { - return type; - } - - public TypeInfo getTypeInfo() { - return typeInfo; - } - - public boolean isAbstractType() { - return getTypeInfo().abstractType(); - } - - public Set getAllSubtypes() { - return allSubtypes; - } - - public Set getAllSupertypes() { - return allSupertypes; - } - - public Set getAllSupertypesAndSelf() { - var allSubtypesAndSelf = new HashSet(allSupertypes.size() + 1); - addMust(allSubtypesAndSelf); - return allSubtypesAndSelf; - } - - public Set getConcreteSubtypesAndSelf() { - return concreteSubtypesAndSelf; - } - - public Set getDirectSubtypes() { - return directSubtypes; - } - - public Set getUnsortedDirectSupertypes() { - return unsortedDirectSupertypes; - } - - public void setDirectSubtypes(Set directSubtypes) { - this.directSubtypes = directSubtypes; - } - - public boolean allowsAllConcreteTypes(Set concreteTypes) { - for (var concreteType : concreteTypes) { - if (!concreteSubtypesAndSelf.contains(concreteType)) { - return false; - } - } - return true; - } - - public void addMust(Set mustTypes) { - mustTypes.add(type); - mustTypes.addAll(allSupertypes); - } - - @Override - public int compareTo(@NotNull ExtendedTypeInfo extendedTypeInfo) { - return Integer.compare(index, extendedTypeInfo.index); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - ExtendedTypeInfo that = (ExtendedTypeInfo) o; - return index == that.index; - } - - @Override - public int hashCode() { - return Objects.hash(index); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/InferredType.java b/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/InferredType.java deleted file mode 100644 index 729b1fb5..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/InferredType.java +++ /dev/null @@ -1,30 +0,0 @@ -package tools.refinery.store.partial.translator.typehierarchy; - -import tools.refinery.store.partial.representation.PartialRelation; - -import java.util.Collections; -import java.util.Set; - -record InferredType(Set mustTypes, Set mayConcreteTypes, - PartialRelation currentType) { - public static final InferredType UNTYPED = new InferredType(Set.of(), Set.of(), null); - - public InferredType(Set mustTypes, Set mayConcreteTypes, - PartialRelation currentType) { - this.mustTypes = Collections.unmodifiableSet(mustTypes); - this.mayConcreteTypes = Collections.unmodifiableSet(mayConcreteTypes); - this.currentType = currentType; - } - - public boolean isConsistent() { - return currentType != null || mustTypes.isEmpty(); - } - - public boolean isMust(PartialRelation partialRelation) { - return mustTypes.contains(partialRelation); - } - - public boolean isMayConcrete(PartialRelation partialRelation) { - return mayConcreteTypes.contains(partialRelation); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/PreservedType.java b/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/PreservedType.java deleted file mode 100644 index 0299ae03..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/PreservedType.java +++ /dev/null @@ -1,136 +0,0 @@ -package tools.refinery.store.partial.translator.typehierarchy; - -import tools.refinery.store.partial.representation.PartialRelation; -import tools.refinery.store.representation.TruthValue; - -import java.util.*; - -final class PreservedType implements TypeAnalysisResult { - private final ExtendedTypeInfo extendedTypeInfo; - private final List directSubtypes; - private final List allExternalTypeInfoList; - private final InferredType inferredType; - - public PreservedType(ExtendedTypeInfo extendedTypeInfo, List allExternalTypeInfoList) { - this.extendedTypeInfo = extendedTypeInfo; - directSubtypes = List.copyOf(extendedTypeInfo.getDirectSubtypes()); - this.allExternalTypeInfoList = allExternalTypeInfoList; - inferredType = propagateMust(extendedTypeInfo.getAllSupertypesAndSelf(), - extendedTypeInfo.getConcreteSubtypesAndSelf()); - } - - public PartialRelation type() { - return extendedTypeInfo.getType(); - } - - public List getDirectSubtypes() { - return directSubtypes; - } - - public boolean isAbstractType() { - return extendedTypeInfo.isAbstractType(); - } - - public boolean isVacuous() { - return isAbstractType() && directSubtypes.isEmpty(); - } - - public InferredType asInferredType() { - return inferredType; - } - - public InferredType merge(InferredType inferredType, TruthValue value) { - return switch (value) { - case UNKNOWN -> inferredType; - case TRUE -> addMust(inferredType); - case FALSE -> removeMay(inferredType); - case ERROR -> addError(inferredType); - }; - } - - private InferredType addMust(InferredType inferredType) { - var originalMustTypes = inferredType.mustTypes(); - if (originalMustTypes.contains(type())) { - return inferredType; - } - var mustTypes = new HashSet<>(originalMustTypes); - extendedTypeInfo.addMust(mustTypes); - var originalMayConcreteTypes = inferredType.mayConcreteTypes(); - var mayConcreteTypes = new LinkedHashSet<>(originalMayConcreteTypes); - Set mayConcreteTypesResult; - if (mayConcreteTypes.retainAll(extendedTypeInfo.getConcreteSubtypesAndSelf())) { - mayConcreteTypesResult = mayConcreteTypes; - } else { - mayConcreteTypesResult = originalMayConcreteTypes; - } - return propagateMust(mustTypes, mayConcreteTypesResult); - } - - private InferredType removeMay(InferredType inferredType) { - var originalMayConcreteTypes = inferredType.mayConcreteTypes(); - var mayConcreteTypes = new LinkedHashSet<>(originalMayConcreteTypes); - if (!mayConcreteTypes.removeAll(extendedTypeInfo.getConcreteSubtypesAndSelf())) { - return inferredType; - } - return propagateMust(inferredType.mustTypes(), mayConcreteTypes); - } - - private InferredType addError(InferredType inferredType) { - var originalMustTypes = inferredType.mustTypes(); - if (originalMustTypes.contains(type())) { - if (inferredType.mayConcreteTypes().isEmpty()) { - return inferredType; - } - return new InferredType(originalMustTypes, Set.of(), null); - } - var mustTypes = new HashSet<>(originalMustTypes); - extendedTypeInfo.addMust(mustTypes); - return new InferredType(mustTypes, Set.of(), null); - } - - private InferredType propagateMust(Set originalMustTypes, - Set mayConcreteTypes) { - // It is possible that there is not type at all, do not force one by propagation. - var maybeUntyped = originalMustTypes.isEmpty(); - // Para-consistent case, do not propagate must types to avoid logical explosion. - var paraConsistentOrSurelyUntyped = mayConcreteTypes.isEmpty(); - if (maybeUntyped || paraConsistentOrSurelyUntyped) { - return new InferredType(originalMustTypes, mayConcreteTypes, null); - } - var currentType = computeCurrentType(mayConcreteTypes); - var mustTypes = new HashSet<>(originalMustTypes); - boolean changed = false; - for (var newMustExtendedTypeInfo : allExternalTypeInfoList) { - var newMustType = newMustExtendedTypeInfo.getType(); - if (mustTypes.contains(newMustType)) { - continue; - } - if (newMustExtendedTypeInfo.allowsAllConcreteTypes(mayConcreteTypes)) { - newMustExtendedTypeInfo.addMust(mustTypes); - changed = true; - } - } - if (!changed) { - return new InferredType(originalMustTypes, mayConcreteTypes, currentType); - } - return new InferredType(mustTypes, mayConcreteTypes, currentType); - } - - /** - * Returns a concrete type that is allowed by a (consistent, i.e., nonempty) set of may concrete types. - * - * @param mayConcreteTypes The set of allowed concrete types. Must not be empty. - * @return The first concrete type that is allowed by {@code matConcreteTypes}. - */ - private PartialRelation computeCurrentType(Set mayConcreteTypes) { - for (var concreteExtendedTypeInfo : allExternalTypeInfoList) { - var concreteType = concreteExtendedTypeInfo.getType(); - if (!concreteExtendedTypeInfo.isAbstractType() && mayConcreteTypes.contains(concreteType)) { - return concreteType; - } - } - // We have already filtered out the para-consistent case in {@link #propagateMust(Set, - // Set}. - throw new AssertionError("No concrete type in %s".formatted(mayConcreteTypes)); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalysisResult.java b/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalysisResult.java deleted file mode 100644 index 0745f84e..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalysisResult.java +++ /dev/null @@ -1,4 +0,0 @@ -package tools.refinery.store.partial.translator.typehierarchy; - -sealed interface TypeAnalysisResult permits EliminatedType, PreservedType { -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzer.java b/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzer.java deleted file mode 100644 index 062b4c49..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzer.java +++ /dev/null @@ -1,202 +0,0 @@ -package tools.refinery.store.partial.translator.typehierarchy; - -import tools.refinery.store.partial.representation.PartialRelation; - -import java.util.*; - -class TypeAnalyzer { - private final Map extendedTypeInfoMap; - private final Map replacements = new LinkedHashMap<>(); - private final InferredType unknownType; - private final Map analysisResults; - - public TypeAnalyzer(Map typeInfoMap) { - int size = typeInfoMap.size(); - extendedTypeInfoMap = new LinkedHashMap<>(size); - var concreteTypes = new LinkedHashSet(); - int index = 0; - for (var entry : typeInfoMap.entrySet()) { - var type = entry.getKey(); - var typeInfo = entry.getValue(); - extendedTypeInfoMap.put(type, new ExtendedTypeInfo(index, type, typeInfo)); - if (!typeInfo.abstractType()) { - concreteTypes.add(type); - } - index++; - } - unknownType = new InferredType(Set.of(), concreteTypes, null); - computeAllSupertypes(); - computeAllAndConcreteSubtypes(); - computeDirectSubtypes(); - eliminateTrivialSupertypes(); - analysisResults = computeAnalysisResults(); - } - - public InferredType getUnknownType() { - return unknownType; - } - - public Map getAnalysisResults() { - return analysisResults; - } - - private void computeAllSupertypes() { - boolean changed; - do { - changed = false; - for (var extendedTypeInfo : extendedTypeInfoMap.values()) { - var found = new HashSet(); - var allSupertypes = extendedTypeInfo.getAllSupertypes(); - for (var supertype : allSupertypes) { - found.addAll(extendedTypeInfoMap.get(supertype).getAllSupertypes()); - } - if (allSupertypes.addAll(found)) { - changed = true; - } - } - } while (changed); - } - - private void computeAllAndConcreteSubtypes() { - for (var extendedTypeInfo : extendedTypeInfoMap.values()) { - var type = extendedTypeInfo.getType(); - if (!extendedTypeInfo.isAbstractType()) { - extendedTypeInfo.getConcreteSubtypesAndSelf().add(type); - } - for (var supertype : extendedTypeInfo.getAllSupertypes()) { - if (type.equals(supertype)) { - throw new IllegalArgumentException("%s cannot be a supertype of itself".formatted(type)); - } - var supertypeInfo = extendedTypeInfoMap.get(supertype); - supertypeInfo.getAllSubtypes().add(type); - if (!extendedTypeInfo.isAbstractType()) { - supertypeInfo.getConcreteSubtypesAndSelf().add(type); - } - } - } - } - - private void computeDirectSubtypes() { - for (var extendedTypeInfo : extendedTypeInfoMap.values()) { - var allSubtypes = extendedTypeInfo.getAllSubtypes(); - var directSubtypes = new LinkedHashSet<>(allSubtypes); - var indirectSubtypes = new LinkedHashSet(allSubtypes.size()); - for (var subtype : allSubtypes) { - indirectSubtypes.addAll(extendedTypeInfoMap.get(subtype).getAllSubtypes()); - } - directSubtypes.removeAll(indirectSubtypes); - extendedTypeInfo.setDirectSubtypes(directSubtypes); - } - } - - private void eliminateTrivialSupertypes() { - boolean changed; - do { - var toRemove = new ArrayList(); - for (var entry : extendedTypeInfoMap.entrySet()) { - var extendedTypeInfo = entry.getValue(); - boolean isAbstract = extendedTypeInfo.isAbstractType(); - // Do not eliminate abstract types with 0 subtypes, because they can be used para-consistently, i.e., - // an object determined to must have an abstract type with 0 subtypes may not ever exist. - boolean hasSingleDirectSubtype = extendedTypeInfo.getDirectSubtypes().size() == 1; - if (isAbstract && hasSingleDirectSubtype) { - toRemove.add(entry.getKey()); - } - } - toRemove.forEach(this::removeTrivialType); - changed = !toRemove.isEmpty(); - } while (changed); - } - - private void removeTrivialType(PartialRelation trivialType) { - var extendedTypeInfo = extendedTypeInfoMap.get(trivialType); - var iterator = extendedTypeInfo.getDirectSubtypes().iterator(); - if (!iterator.hasNext()) { - throw new AssertionError("Expected trivial supertype %s to have a direct subtype" - .formatted(trivialType)); - } - PartialRelation replacement = setReplacement(trivialType, iterator.next()); - if (iterator.hasNext()) { - throw new AssertionError("Expected trivial supertype %s to have at most 1 direct subtype" - .formatted(trivialType)); - } - replacements.put(trivialType, replacement); - for (var supertype : extendedTypeInfo.getAllSupertypes()) { - var extendedSupertypeInfo = extendedTypeInfoMap.get(supertype); - if (!extendedSupertypeInfo.getAllSubtypes().remove(trivialType)) { - throw new AssertionError("Expected %s to be subtype of %s".formatted(trivialType, supertype)); - } - var directSubtypes = extendedSupertypeInfo.getDirectSubtypes(); - if (directSubtypes.remove(trivialType)) { - directSubtypes.add(replacement); - } - } - for (var subtype : extendedTypeInfo.getAllSubtypes()) { - var extendedSubtypeInfo = extendedTypeInfoMap.get(subtype); - if (!extendedSubtypeInfo.getAllSupertypes().remove(trivialType)) { - throw new AssertionError("Expected %s to be supertype of %s".formatted(trivialType, subtype)); - } - } - extendedTypeInfoMap.remove(trivialType); - } - - private PartialRelation setReplacement(PartialRelation trivialRelation, PartialRelation replacement) { - if (replacement == null) { - return trivialRelation; - } - var resolved = setReplacement(replacement, replacements.get(replacement)); - replacements.put(trivialRelation, resolved); - return resolved; - } - - private Map computeAnalysisResults() { - var allExtendedTypeInfoList = sortTypes(); - var results = new LinkedHashMap( - allExtendedTypeInfoList.size() + replacements.size()); - for (var extendedTypeInfo : allExtendedTypeInfoList) { - var type = extendedTypeInfo.getType(); - results.put(type, new PreservedType(extendedTypeInfo, allExtendedTypeInfoList)); - } - for (var entry : replacements.entrySet()) { - var type = entry.getKey(); - results.put(type, new EliminatedType(entry.getValue())); - } - return Collections.unmodifiableMap(results); - } - - private List sortTypes() { - // Invert {@code directSubtypes} to keep track of the out-degree of types. - for (var extendedTypeInfo : extendedTypeInfoMap.values()) { - for (var directSubtype : extendedTypeInfo.getDirectSubtypes()) { - var extendedDirectSubtypeInfo = extendedTypeInfoMap.get(directSubtype); - extendedDirectSubtypeInfo.getUnsortedDirectSupertypes().add(extendedTypeInfo.getType()); - } - } - // Build a inverse topological order ({@code extends} edges always points to earlier nodes in the order, - // breaking ties according to the original order ({@link ExtendedTypeInfo#index}) to form a 'stable' sort. - // See, e.g., https://stackoverflow.com/a/11236027. - var priorityQueue = new PriorityQueue(); - for (var extendedTypeInfo : extendedTypeInfoMap.values()) { - if (extendedTypeInfo.getUnsortedDirectSupertypes().isEmpty()) { - priorityQueue.add(extendedTypeInfo); - } - } - var sorted = new ArrayList(extendedTypeInfoMap.size()); - while (!priorityQueue.isEmpty()) { - var extendedTypeInfo = priorityQueue.remove(); - sorted.add(extendedTypeInfo); - for (var directSubtype : extendedTypeInfo.getDirectSubtypes()) { - var extendedDirectSubtypeInfo = extendedTypeInfoMap.get(directSubtype); - var unsortedDirectSupertypes = extendedDirectSubtypeInfo.getUnsortedDirectSupertypes(); - if (!unsortedDirectSupertypes.remove(extendedTypeInfo.getType())) { - throw new AssertionError("Expected %s to be a direct supertype of %s" - .formatted(extendedTypeInfo.getType(), directSubtype)); - } - if (unsortedDirectSupertypes.isEmpty()) { - priorityQueue.add(extendedDirectSubtypeInfo); - } - } - } - return Collections.unmodifiableList(sorted); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeInfo.java b/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeInfo.java deleted file mode 100644 index 1b0922fe..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/partial/translator/typehierarchy/TypeInfo.java +++ /dev/null @@ -1,46 +0,0 @@ -package tools.refinery.store.partial.translator.typehierarchy; - -import tools.refinery.store.partial.representation.PartialRelation; - -import java.util.*; - -public record TypeInfo(Collection supertypes, boolean abstractType) { - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private final Set supertypes = new LinkedHashSet<>(); - private boolean abstractType; - - private Builder() { - } - - public Builder supertypes(Collection supertypes) { - this.supertypes.addAll(supertypes); - return this; - } - - public Builder supertypes(PartialRelation... supertypes) { - return supertypes(List.of(supertypes)); - } - - public Builder supertype(PartialRelation supertype) { - supertypes.add(supertype); - return this; - } - - public Builder abstractType(boolean abstractType) { - this.abstractType = abstractType; - return this; - } - - public Builder abstractType() { - return abstractType(true); - } - - public TypeInfo build() { - return new TypeInfo(Collections.unmodifiableSet(supertypes), abstractType); - } - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/Dnf.java b/subprojects/store/src/main/java/tools/refinery/store/query/Dnf.java deleted file mode 100644 index b080094f..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/Dnf.java +++ /dev/null @@ -1,187 +0,0 @@ -package tools.refinery.store.query; - -import tools.refinery.store.query.literal.CallPolarity; -import tools.refinery.store.query.literal.DnfCallLiteral; -import tools.refinery.store.query.literal.Literal; - -import java.util.*; - -public final class Dnf implements RelationLike { - private final String name; - - private final String uniqueName; - - private final List parameters; - - private final List> functionalDependencies; - - private final List clauses; - - private Dnf(String name, List parameters, List> functionalDependencies, - List clauses) { - validateFunctionalDependencies(parameters, functionalDependencies); - this.name = name; - this.uniqueName = DnfUtils.generateUniqueName(name); - this.parameters = parameters; - this.functionalDependencies = functionalDependencies; - this.clauses = clauses; - } - - private static void validateFunctionalDependencies( - Collection parameters, Collection> functionalDependencies) { - var parameterSet = new HashSet<>(parameters); - for (var functionalDependency : functionalDependencies) { - validateParameters(parameters, parameterSet, functionalDependency.forEach(), functionalDependency); - validateParameters(parameters, parameterSet, functionalDependency.unique(), functionalDependency); - } - } - - private static void validateParameters(Collection parameters, Set parameterSet, - Collection toValidate, - FunctionalDependency functionalDependency) { - for (var variable : toValidate) { - if (!parameterSet.contains(variable)) { - throw new IllegalArgumentException( - "Variable %s of functional dependency %s does not appear in the parameter list %s" - .formatted(variable, functionalDependency, parameters)); - } - } - } - - @Override - public String name() { - return name; - } - - public String getUniqueName() { - return uniqueName; - } - - public List getParameters() { - return parameters; - } - - public List> getFunctionalDependencies() { - return functionalDependencies; - } - - @Override - public int arity() { - return parameters.size(); - } - - public List getClauses() { - return clauses; - } - - public DnfCallLiteral call(CallPolarity polarity, List arguments) { - return new DnfCallLiteral(polarity, this, arguments); - } - - public DnfCallLiteral call(CallPolarity polarity, Variable... arguments) { - return call(polarity, List.of(arguments)); - } - - public DnfCallLiteral call(Variable... arguments) { - return call(CallPolarity.POSITIVE, arguments); - } - - public DnfCallLiteral callTransitive(Variable left, Variable right) { - return call(CallPolarity.TRANSITIVE, List.of(left, right)); - } - - public static Builder builder() { - return builder(null); - } - - public static Builder builder(String name) { - return new Builder(name); - } - - @SuppressWarnings("UnusedReturnValue") - public static class Builder { - private final String name; - - private final List parameters = new ArrayList<>(); - - private final List> functionalDependencies = new ArrayList<>(); - - private final List> clauses = new ArrayList<>(); - - private Builder(String name) { - this.name = name; - } - - public Builder parameter(Variable variable) { - parameters.add(variable); - return this; - } - - public Builder parameters(Variable... variables) { - return parameters(List.of(variables)); - } - - public Builder parameters(Collection variables) { - parameters.addAll(variables); - return this; - } - - public Builder functionalDependencies(Collection> functionalDependencies) { - this.functionalDependencies.addAll(functionalDependencies); - return this; - } - - public Builder functionalDependency(FunctionalDependency functionalDependency) { - functionalDependencies.add(functionalDependency); - return this; - } - - public Builder functionalDependency(Set forEach, Set unique) { - return functionalDependency(new FunctionalDependency<>(forEach, unique)); - } - - public Builder clause(Literal... atoms) { - clauses.add(List.of(atoms)); - return this; - } - - public Builder clause(Collection atoms) { - clauses.add(List.copyOf(atoms)); - return this; - } - - public Builder clause(DnfClause clause) { - return clause(clause.literals()); - } - - public Builder clauses(DnfClause... clauses) { - for (var clause : clauses) { - this.clause(clause); - } - return this; - } - - public Builder clauses(Collection clauses) { - for (var clause : clauses) { - this.clause(clause); - } - return this; - } - - public Dnf build() { - var postProcessedClauses = new ArrayList(); - for (var constraints : clauses) { - var variables = new HashSet(); - for (var constraint : constraints) { - constraint.collectAllVariables(variables); - } - parameters.forEach(variables::remove); - postProcessedClauses.add(new DnfClause(Collections.unmodifiableSet(variables), - Collections.unmodifiableList(constraints))); - } - return new Dnf(name, Collections.unmodifiableList(parameters), - Collections.unmodifiableList(functionalDependencies), - Collections.unmodifiableList(postProcessedClauses)); - } - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/DnfClause.java b/subprojects/store/src/main/java/tools/refinery/store/query/DnfClause.java deleted file mode 100644 index 2ba6becc..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/DnfClause.java +++ /dev/null @@ -1,9 +0,0 @@ -package tools.refinery.store.query; - -import tools.refinery.store.query.literal.Literal; - -import java.util.List; -import java.util.Set; - -public record DnfClause(Set quantifiedVariables, List literals) { -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/DnfUtils.java b/subprojects/store/src/main/java/tools/refinery/store/query/DnfUtils.java deleted file mode 100644 index 17564d43..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/DnfUtils.java +++ /dev/null @@ -1,24 +0,0 @@ -package tools.refinery.store.query; - -import java.util.Map; -import java.util.UUID; - -public final class DnfUtils { - private DnfUtils() { - throw new IllegalStateException("This is a static utility class and should not be instantiated directly"); - } - - public static String generateUniqueName(String originalName) { - UUID uuid = UUID.randomUUID(); - String uniqueString = "_" + uuid.toString().replace('-', '_'); - if (originalName == null) { - return uniqueString; - } else { - return originalName + uniqueString; - } - } - - public static Variable maybeSubstitute(Variable variable, Map substitution) { - return substitution.getOrDefault(variable, variable); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/FunctionalDependency.java b/subprojects/store/src/main/java/tools/refinery/store/query/FunctionalDependency.java deleted file mode 100644 index 63a81713..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/FunctionalDependency.java +++ /dev/null @@ -1,15 +0,0 @@ -package tools.refinery.store.query; - -import java.util.HashSet; -import java.util.Set; - -public record FunctionalDependency(Set forEach, Set unique) { - public FunctionalDependency { - var uniqueForEach = new HashSet<>(unique); - uniqueForEach.retainAll(forEach); - if (!uniqueForEach.isEmpty()) { - throw new IllegalArgumentException("Variables %s appear on both sides of the functional dependency" - .formatted(uniqueForEach)); - } - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/ModelQuery.java b/subprojects/store/src/main/java/tools/refinery/store/query/ModelQuery.java deleted file mode 100644 index 6a1aeabb..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/ModelQuery.java +++ /dev/null @@ -1,11 +0,0 @@ -package tools.refinery.store.query; - -import tools.refinery.store.adapter.ModelAdapterType; - -public final class ModelQuery extends ModelAdapterType { - public static final ModelQuery ADAPTER = new ModelQuery(); - - private ModelQuery() { - super(ModelQueryAdapter.class, ModelQueryStoreAdapter.class, ModelQueryBuilder.class); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/ModelQueryAdapter.java b/subprojects/store/src/main/java/tools/refinery/store/query/ModelQueryAdapter.java deleted file mode 100644 index f7762444..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/ModelQueryAdapter.java +++ /dev/null @@ -1,13 +0,0 @@ -package tools.refinery.store.query; - -import tools.refinery.store.adapter.ModelAdapter; - -public interface ModelQueryAdapter extends ModelAdapter { - ModelQueryStoreAdapter getStoreAdapter(); - - ResultSet getResultSet(Dnf query); - - boolean hasPendingChanges(); - - void flushChanges(); -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/ModelQueryBuilder.java b/subprojects/store/src/main/java/tools/refinery/store/query/ModelQueryBuilder.java deleted file mode 100644 index b3cfb4b4..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/ModelQueryBuilder.java +++ /dev/null @@ -1,23 +0,0 @@ -package tools.refinery.store.query; - -import tools.refinery.store.adapter.ModelAdapterBuilder; -import tools.refinery.store.model.ModelStore; - -import java.util.Collection; -import java.util.List; - -public interface ModelQueryBuilder extends ModelAdapterBuilder { - default ModelQueryBuilder queries(Dnf... queries) { - return queries(List.of(queries)); - } - - default ModelQueryBuilder queries(Collection queries) { - queries.forEach(this::query); - return this; - } - - ModelQueryBuilder query(Dnf query); - - @Override - ModelQueryStoreAdapter createStoreAdapter(ModelStore store); -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/ModelQueryStoreAdapter.java b/subprojects/store/src/main/java/tools/refinery/store/query/ModelQueryStoreAdapter.java deleted file mode 100644 index 3efeacaa..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/ModelQueryStoreAdapter.java +++ /dev/null @@ -1,16 +0,0 @@ -package tools.refinery.store.query; - -import tools.refinery.store.adapter.ModelStoreAdapter; -import tools.refinery.store.model.Model; -import tools.refinery.store.query.view.AnyRelationView; - -import java.util.Collection; - -public interface ModelQueryStoreAdapter extends ModelStoreAdapter { - Collection getRelationViews(); - - Collection getQueries(); - - @Override - ModelQueryAdapter createModelAdapter(Model model); -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/RelationLike.java b/subprojects/store/src/main/java/tools/refinery/store/query/RelationLike.java deleted file mode 100644 index 8c784d8b..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/RelationLike.java +++ /dev/null @@ -1,11 +0,0 @@ -package tools.refinery.store.query; - -public interface RelationLike { - String name(); - - int arity(); - - default boolean invalidIndex(int i) { - return i < 0 || i >= arity(); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/ResultSet.java b/subprojects/store/src/main/java/tools/refinery/store/query/ResultSet.java deleted file mode 100644 index 3542e252..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/ResultSet.java +++ /dev/null @@ -1,25 +0,0 @@ -package tools.refinery.store.query; - -import tools.refinery.store.tuple.Tuple; -import tools.refinery.store.tuple.TupleLike; - -import java.util.Optional; -import java.util.stream.Stream; - -public interface ResultSet { - boolean hasResult(); - - boolean hasResult(Tuple parameters); - - Optional oneResult(); - - Optional oneResult(Tuple parameters); - - Stream allResults(); - - Stream allResults(Tuple parameters); - - int countResults(); - - int countResults(Tuple parameters); -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/Variable.java b/subprojects/store/src/main/java/tools/refinery/store/query/Variable.java deleted file mode 100644 index 2eb87649..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/Variable.java +++ /dev/null @@ -1,58 +0,0 @@ -package tools.refinery.store.query; - -import tools.refinery.store.query.literal.ConstantLiteral; -import tools.refinery.store.query.literal.EquivalenceLiteral; - -import java.util.Objects; - -public class Variable { - private final String name; - private final String uniqueName; - - public Variable() { - this(null); - } - - public Variable(String name) { - super(); - this.name = name; - this.uniqueName = DnfUtils.generateUniqueName(name); - - } - public String getName() { - return name; - } - - public String getUniqueName() { - return uniqueName; - } - - public boolean isNamed() { - return name != null; - } - - public ConstantLiteral isConstant(int value) { - return new ConstantLiteral(this, value); - } - - public EquivalenceLiteral isEquivalent(Variable other) { - return new EquivalenceLiteral(true, this, other); - } - - public EquivalenceLiteral notEquivalent(Variable other) { - return new EquivalenceLiteral(false, this, other); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Variable variable = (Variable) o; - return Objects.equals(uniqueName, variable.uniqueName); - } - - @Override - public int hashCode() { - return Objects.hash(uniqueName); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/literal/CallLiteral.java b/subprojects/store/src/main/java/tools/refinery/store/query/literal/CallLiteral.java deleted file mode 100644 index 5e1ae94d..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/literal/CallLiteral.java +++ /dev/null @@ -1,66 +0,0 @@ -package tools.refinery.store.query.literal; - -import tools.refinery.store.query.DnfUtils; -import tools.refinery.store.query.RelationLike; -import tools.refinery.store.query.Variable; - -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; - -public abstract class CallLiteral implements Literal { - private final CallPolarity polarity; - private final T target; - private final List arguments; - - protected CallLiteral(CallPolarity polarity, T target, List arguments) { - if (arguments.size() != target.arity()) { - throw new IllegalArgumentException("%s needs %d arguments, but got %s".formatted(target.name(), - target.arity(), arguments.size())); - } - if (polarity.isTransitive() && target.arity() != 2) { - throw new IllegalArgumentException("Transitive closures can only take binary relations"); - } - this.polarity = polarity; - this.target = target; - this.arguments = arguments; - } - - public CallPolarity getPolarity() { - return polarity; - } - - public T getTarget() { - return target; - } - - public List getArguments() { - return arguments; - } - - @Override - public void collectAllVariables(Set variables) { - if (polarity.isPositive()) { - variables.addAll(arguments); - } - } - - protected List substituteArguments(Map substitution) { - return arguments.stream().map(variable -> DnfUtils.maybeSubstitute(variable, substitution)).toList(); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - CallLiteral callAtom = (CallLiteral) o; - return polarity == callAtom.polarity && Objects.equals(target, callAtom.target) && - Objects.equals(arguments, callAtom.arguments); - } - - @Override - public int hashCode() { - return Objects.hash(polarity, target, arguments); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/literal/CallPolarity.java b/subprojects/store/src/main/java/tools/refinery/store/query/literal/CallPolarity.java deleted file mode 100644 index 84b4b771..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/literal/CallPolarity.java +++ /dev/null @@ -1,32 +0,0 @@ -package tools.refinery.store.query.literal; - -public enum CallPolarity { - POSITIVE(true, false), - NEGATIVE(false, false), - TRANSITIVE(true, true); - - private final boolean positive; - - private final boolean transitive; - - CallPolarity(boolean positive, boolean transitive) { - this.positive = positive; - this.transitive = transitive; - } - - public boolean isPositive() { - return positive; - } - - public boolean isTransitive() { - return transitive; - } - - public CallPolarity negate() { - return switch (this) { - case POSITIVE -> NEGATIVE; - case NEGATIVE -> POSITIVE; - case TRANSITIVE -> throw new IllegalArgumentException("Transitive polarity cannot be negated"); - }; - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/literal/ConstantLiteral.java b/subprojects/store/src/main/java/tools/refinery/store/query/literal/ConstantLiteral.java deleted file mode 100644 index 746d23af..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/literal/ConstantLiteral.java +++ /dev/null @@ -1,19 +0,0 @@ -package tools.refinery.store.query.literal; - -import tools.refinery.store.query.DnfUtils; -import tools.refinery.store.query.Variable; - -import java.util.Map; -import java.util.Set; - -public record ConstantLiteral(Variable variable, int nodeId) implements Literal { - @Override - public void collectAllVariables(Set variables) { - variables.add(variable); - } - - @Override - public ConstantLiteral substitute(Map substitution) { - return new ConstantLiteral(DnfUtils.maybeSubstitute(variable, substitution), nodeId); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/literal/DnfCallLiteral.java b/subprojects/store/src/main/java/tools/refinery/store/query/literal/DnfCallLiteral.java deleted file mode 100644 index 40499222..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/literal/DnfCallLiteral.java +++ /dev/null @@ -1,23 +0,0 @@ -package tools.refinery.store.query.literal; - -import tools.refinery.store.query.Dnf; -import tools.refinery.store.query.Variable; - -import java.util.List; -import java.util.Map; - -public final class DnfCallLiteral extends CallLiteral implements PolarLiteral { - public DnfCallLiteral(CallPolarity polarity, Dnf target, List arguments) { - super(polarity, target, arguments); - } - - @Override - public DnfCallLiteral substitute(Map substitution) { - return new DnfCallLiteral(getPolarity(), getTarget(), substituteArguments(substitution)); - } - - @Override - public DnfCallLiteral negate() { - return new DnfCallLiteral(getPolarity().negate(), getTarget(), getArguments()); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/literal/EquivalenceLiteral.java b/subprojects/store/src/main/java/tools/refinery/store/query/literal/EquivalenceLiteral.java deleted file mode 100644 index 5fee54b1..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/literal/EquivalenceLiteral.java +++ /dev/null @@ -1,27 +0,0 @@ -package tools.refinery.store.query.literal; - -import tools.refinery.store.query.DnfUtils; -import tools.refinery.store.query.Variable; - -import java.util.Map; -import java.util.Set; - -public record EquivalenceLiteral(boolean positive, Variable left, Variable right) - implements PolarLiteral { - @Override - public void collectAllVariables(Set variables) { - variables.add(left); - variables.add(right); - } - - @Override - public EquivalenceLiteral negate() { - return new EquivalenceLiteral(!positive, left, right); - } - - @Override - public EquivalenceLiteral substitute(Map substitution) { - return new EquivalenceLiteral(positive, DnfUtils.maybeSubstitute(left, substitution), - DnfUtils.maybeSubstitute(right, substitution)); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/literal/Literal.java b/subprojects/store/src/main/java/tools/refinery/store/query/literal/Literal.java deleted file mode 100644 index e0f5f605..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/literal/Literal.java +++ /dev/null @@ -1,12 +0,0 @@ -package tools.refinery.store.query.literal; - -import tools.refinery.store.query.Variable; - -import java.util.Map; -import java.util.Set; - -public interface Literal { - void collectAllVariables(Set variables); - - Literal substitute(Map substitution); -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/literal/Literals.java b/subprojects/store/src/main/java/tools/refinery/store/query/literal/Literals.java deleted file mode 100644 index 2c7e893f..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/literal/Literals.java +++ /dev/null @@ -1,11 +0,0 @@ -package tools.refinery.store.query.literal; - -public final class Literals { - private Literals() { - throw new IllegalStateException("This is a static utility class and should not be instantiated directly"); - } - - public static > T not(PolarLiteral literal) { - return literal.negate(); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/literal/PolarLiteral.java b/subprojects/store/src/main/java/tools/refinery/store/query/literal/PolarLiteral.java deleted file mode 100644 index 32523675..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/literal/PolarLiteral.java +++ /dev/null @@ -1,5 +0,0 @@ -package tools.refinery.store.query.literal; - -public interface PolarLiteral> extends Literal { - T negate(); -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/literal/RelationViewLiteral.java b/subprojects/store/src/main/java/tools/refinery/store/query/literal/RelationViewLiteral.java deleted file mode 100644 index 4718b550..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/literal/RelationViewLiteral.java +++ /dev/null @@ -1,24 +0,0 @@ -package tools.refinery.store.query.literal; - -import tools.refinery.store.query.Variable; -import tools.refinery.store.query.view.AnyRelationView; - -import java.util.List; -import java.util.Map; - -public final class RelationViewLiteral extends CallLiteral - implements PolarLiteral { - public RelationViewLiteral(CallPolarity polarity, AnyRelationView target, List arguments) { - super(polarity, target, arguments); - } - - @Override - public RelationViewLiteral substitute(Map substitution) { - return new RelationViewLiteral(getPolarity(), getTarget(), substituteArguments(substitution)); - } - - @Override - public RelationViewLiteral negate() { - return new RelationViewLiteral(getPolarity().negate(), getTarget(), getArguments()); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/view/AnyRelationView.java b/subprojects/store/src/main/java/tools/refinery/store/query/view/AnyRelationView.java deleted file mode 100644 index 328cde3a..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/view/AnyRelationView.java +++ /dev/null @@ -1,24 +0,0 @@ -package tools.refinery.store.query.view; - -import tools.refinery.store.model.Model; -import tools.refinery.store.query.FunctionalDependency; -import tools.refinery.store.representation.AnySymbol; -import tools.refinery.store.query.RelationLike; - -import java.util.Set; - -public sealed interface AnyRelationView extends RelationLike permits RelationView { - AnySymbol getSymbol(); - - default Set> getFunctionalDependencies() { - return Set.of(); - } - - default Set getImpliedRelationViews() { - return Set.of(); - } - - boolean get(Model model, Object[] tuple); - - Iterable getAll(Model model); -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/view/FilteredRelationView.java b/subprojects/store/src/main/java/tools/refinery/store/query/view/FilteredRelationView.java deleted file mode 100644 index 64c601bb..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/view/FilteredRelationView.java +++ /dev/null @@ -1,49 +0,0 @@ -package tools.refinery.store.query.view; - -import tools.refinery.store.tuple.Tuple; -import tools.refinery.store.representation.Symbol; - -import java.util.Objects; -import java.util.function.BiPredicate; -import java.util.function.Predicate; - -public class FilteredRelationView extends TuplePreservingRelationView { - private final BiPredicate predicate; - - public FilteredRelationView(Symbol symbol, String name, BiPredicate predicate) { - super(symbol, name); - this.predicate = predicate; - } - - public FilteredRelationView(Symbol symbol, BiPredicate predicate) { - super(symbol); - this.predicate = predicate; - } - - public FilteredRelationView(Symbol symbol, String name, Predicate predicate) { - this(symbol, name, (k, v) -> predicate.test(v)); - } - - public FilteredRelationView(Symbol symbol, Predicate predicate) { - this(symbol, (k, v) -> predicate.test(v)); - } - - @Override - public boolean filter(Tuple key, T value) { - return this.predicate.test(key, value); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; - FilteredRelationView that = (FilteredRelationView) o; - return Objects.equals(predicate, that.predicate); - } - - @Override - public int hashCode() { - return Objects.hash(super.hashCode(), predicate); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/view/FunctionalRelationView.java b/subprojects/store/src/main/java/tools/refinery/store/query/view/FunctionalRelationView.java deleted file mode 100644 index 3d278a8b..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/view/FunctionalRelationView.java +++ /dev/null @@ -1,71 +0,0 @@ -package tools.refinery.store.query.view; - -import tools.refinery.store.model.Model; -import tools.refinery.store.query.FunctionalDependency; -import tools.refinery.store.representation.Symbol; -import tools.refinery.store.tuple.Tuple; -import tools.refinery.store.tuple.Tuple1; - -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.IntStream; - -public final class FunctionalRelationView extends RelationView { - public FunctionalRelationView(Symbol symbol, String name) { - super(symbol, name); - } - - public FunctionalRelationView(Symbol symbol) { - super(symbol); - } - - @Override - public Set> getFunctionalDependencies() { - var arity = getSymbol().arity(); - var forEach = IntStream.range(0, arity).boxed().collect(Collectors.toUnmodifiableSet()); - var unique = Set.of(arity); - return Set.of(new FunctionalDependency<>(forEach, unique)); - } - - @Override - public Set getImpliedRelationViews() { - var symbol = getSymbol(); - var impliedIndices = IntStream.range(0, symbol.arity()).boxed().toList(); - var keyOnlyRelationView = new KeyOnlyRelationView<>(symbol); - return Set.of(new RelationViewImplication(this, keyOnlyRelationView, impliedIndices)); - } - - @Override - public boolean filter(Tuple key, T value) { - return true; - } - - @Override - public Object[] forwardMap(Tuple key, T value) { - int size = key.getSize(); - Object[] result = new Object[size + 1]; - for (int i = 0; i < size; i++) { - result[i] = Tuple.of(key.get(i)); - } - result[key.getSize()] = value; - return result; - } - - @Override - public boolean get(Model model, Object[] tuple) { - int[] content = new int[tuple.length - 1]; - for (int i = 0; i < tuple.length - 1; i++) { - content[i] = ((Tuple1) tuple[i]).value0(); - } - Tuple key = Tuple.of(content); - @SuppressWarnings("unchecked") - T valueInTuple = (T) tuple[tuple.length - 1]; - T valueInMap = model.getInterpretation(getSymbol()).get(key); - return valueInTuple.equals(valueInMap); - } - - @Override - public int arity() { - return getSymbol().arity() + 1; - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/view/KeyOnlyRelationView.java b/subprojects/store/src/main/java/tools/refinery/store/query/view/KeyOnlyRelationView.java deleted file mode 100644 index e1b2e45b..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/view/KeyOnlyRelationView.java +++ /dev/null @@ -1,36 +0,0 @@ -package tools.refinery.store.query.view; - -import tools.refinery.store.representation.Symbol; -import tools.refinery.store.tuple.Tuple; - -import java.util.Objects; - -public final class KeyOnlyRelationView extends TuplePreservingRelationView { - public static final String VIEW_NAME = "key"; - - private final T defaultValue; - - public KeyOnlyRelationView(Symbol symbol) { - super(symbol, VIEW_NAME); - defaultValue = symbol.defaultValue(); - } - - @Override - public boolean filter(Tuple key, T value) { - return !Objects.equals(value, defaultValue); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; - KeyOnlyRelationView that = (KeyOnlyRelationView) o; - return Objects.equals(defaultValue, that.defaultValue); - } - - @Override - public int hashCode() { - return Objects.hash(super.hashCode(), defaultValue); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/view/RelationView.java b/subprojects/store/src/main/java/tools/refinery/store/query/view/RelationView.java deleted file mode 100644 index 6accd27a..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/view/RelationView.java +++ /dev/null @@ -1,82 +0,0 @@ -package tools.refinery.store.query.view; - -import tools.refinery.store.map.CursorAsIterator; -import tools.refinery.store.model.Model; -import tools.refinery.store.query.Variable; -import tools.refinery.store.query.literal.CallPolarity; -import tools.refinery.store.query.literal.RelationViewLiteral; -import tools.refinery.store.representation.Symbol; -import tools.refinery.store.tuple.Tuple; - -import java.util.List; -import java.util.Objects; -import java.util.UUID; - -/** - * Represents a view of a {@link Symbol} that can be queried. - * - * @param - * @author Oszkar Semerath - */ -public abstract non-sealed class RelationView implements AnyRelationView { - private final Symbol symbol; - - private final String name; - - protected RelationView(Symbol symbol, String name) { - this.symbol = symbol; - this.name = name; - } - - protected RelationView(Symbol representation) { - this(representation, UUID.randomUUID().toString()); - } - - @Override - public Symbol getSymbol() { - return symbol; - } - - @Override - public String name() { - return symbol.name() + "#" + name; - } - - public abstract boolean filter(Tuple key, T value); - - public abstract Object[] forwardMap(Tuple key, T value); - - @Override - public Iterable getAll(Model model) { - return (() -> new CursorAsIterator<>(model.getInterpretation(symbol).getAll(), this::forwardMap, this::filter)); - } - - public RelationViewLiteral call(CallPolarity polarity, List arguments) { - return new RelationViewLiteral(polarity, this, arguments); - } - - public RelationViewLiteral call(CallPolarity polarity, Variable... arguments) { - return call(polarity, List.of(arguments)); - } - - public RelationViewLiteral call(Variable... arguments) { - return call(CallPolarity.POSITIVE, arguments); - } - - public RelationViewLiteral callTransitive(Variable left, Variable right) { - return call(CallPolarity.TRANSITIVE, List.of(left, right)); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - RelationView that = (RelationView) o; - return Objects.equals(symbol, that.symbol) && Objects.equals(name, that.name); - } - - @Override - public int hashCode() { - return Objects.hash(symbol, name); - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/view/RelationViewImplication.java b/subprojects/store/src/main/java/tools/refinery/store/query/view/RelationViewImplication.java deleted file mode 100644 index 2ba1fcc4..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/view/RelationViewImplication.java +++ /dev/null @@ -1,19 +0,0 @@ -package tools.refinery.store.query.view; - -import java.util.List; - -public record RelationViewImplication(AnyRelationView implyingRelationView, AnyRelationView impliedRelationView, - List impliedIndices) { - public RelationViewImplication { - if (impliedIndices.size() != impliedRelationView.arity()) { - throw new IllegalArgumentException("Expected %d implied indices for %s, but %d are provided" - .formatted(impliedRelationView.arity(), impliedRelationView, impliedIndices.size())); - } - for (var index : impliedIndices) { - if (impliedRelationView.invalidIndex(index)) { - throw new IllegalArgumentException("%d is not a valid index for %s".formatted(index, - implyingRelationView)); - } - } - } -} diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/view/TuplePreservingRelationView.java b/subprojects/store/src/main/java/tools/refinery/store/query/view/TuplePreservingRelationView.java deleted file mode 100644 index 8cc4986e..00000000 --- a/subprojects/store/src/main/java/tools/refinery/store/query/view/TuplePreservingRelationView.java +++ /dev/null @@ -1,44 +0,0 @@ -package tools.refinery.store.query.view; - -import tools.refinery.store.model.Model; -import tools.refinery.store.tuple.Tuple; -import tools.refinery.store.tuple.Tuple1; -import tools.refinery.store.representation.Symbol; - -public abstract class TuplePreservingRelationView extends RelationView { - protected TuplePreservingRelationView(Symbol symbol, String name) { - super(symbol, name); - } - - protected TuplePreservingRelationView(Symbol symbol) { - super(symbol); - } - - public Object[] forwardMap(Tuple key) { - Object[] result = new Object[key.getSize()]; - for (int i = 0; i < key.getSize(); i++) { - result[i] = Tuple.of(key.get(i)); - } - return result; - } - - @Override - public Object[] forwardMap(Tuple key, T value) { - return forwardMap(key); - } - - @Override - public boolean get(Model model, Object[] tuple) { - int[] content = new int[tuple.length]; - for (int i = 0; i < tuple.length; i++) { - content[i] = ((Tuple1) tuple[i]).value0(); - } - Tuple key = Tuple.of(content); - T value = model.getInterpretation(getSymbol()).get(key); - return filter(key, value); - } - - public int arity() { - return this.getSymbol().arity(); - } -} diff --git a/subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/InferredTypeTest.java b/subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/InferredTypeTest.java deleted file mode 100644 index 9efa76ef..00000000 --- a/subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/InferredTypeTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package tools.refinery.store.partial.translator.typehierarchy; - -import org.junit.jupiter.api.Test; -import tools.refinery.store.partial.representation.PartialRelation; - -import java.util.Set; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; - -class InferredTypeTest { - private final PartialRelation c1 = new PartialRelation("C1", 1); - private final PartialRelation c2 = new PartialRelation("C2", 1); - - @Test - void untypedIsConsistentTest() { - var sut = new InferredType(Set.of(), Set.of(c1, c2), null); - assertThat(sut.isConsistent(), is(true)); - } - - @Test - void typedIsConsistentTest() { - var sut = new InferredType(Set.of(c1), Set.of(c1, c2), c1); - assertThat(sut.isConsistent(), is(true)); - } - - @Test - void typedIsInconsistentTest() { - var sut = new InferredType(Set.of(c1), Set.of(), null); - assertThat(sut.isConsistent(), is(false)); - } -} diff --git a/subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerExampleHierarchyTest.java b/subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerExampleHierarchyTest.java deleted file mode 100644 index 5f528328..00000000 --- a/subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerExampleHierarchyTest.java +++ /dev/null @@ -1,203 +0,0 @@ -package tools.refinery.store.partial.translator.typehierarchy; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import tools.refinery.store.partial.representation.PartialRelation; -import tools.refinery.store.representation.TruthValue; - -import java.util.LinkedHashMap; -import java.util.Set; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.junit.jupiter.api.Assertions.assertAll; - -class TypeAnalyzerExampleHierarchyTest { - private final PartialRelation a1 = new PartialRelation("A1", 1); - private final PartialRelation a2 = new PartialRelation("A2", 1); - private final PartialRelation a3 = new PartialRelation("A3", 1); - private final PartialRelation a4 = new PartialRelation("A4", 1); - private final PartialRelation a5 = new PartialRelation("A5", 1); - private final PartialRelation c1 = new PartialRelation("C1", 1); - private final PartialRelation c2 = new PartialRelation("C2", 1); - private final PartialRelation c3 = new PartialRelation("C3", 1); - private final PartialRelation c4 = new PartialRelation("C4", 1); - - private TypeAnalyzer sut; - private TypeAnalyzerTester tester; - - @BeforeEach - void beforeEach() { - var typeInfoMap = new LinkedHashMap(); - typeInfoMap.put(a1, TypeInfo.builder().abstractType().build()); - typeInfoMap.put(a2, TypeInfo.builder().abstractType().build()); - typeInfoMap.put(a3, TypeInfo.builder().abstractType().build()); - typeInfoMap.put(a4, TypeInfo.builder().abstractType().build()); - typeInfoMap.put(a5, TypeInfo.builder().abstractType().build()); - typeInfoMap.put(c1, TypeInfo.builder().supertypes(a1, a4).build()); - typeInfoMap.put(c2, TypeInfo.builder().supertypes(a1, a2, a3, a4).build()); - typeInfoMap.put(c3, TypeInfo.builder().supertype(a3).build()); - typeInfoMap.put(c4, TypeInfo.builder().supertype(a4).build()); - sut = new TypeAnalyzer(typeInfoMap); - tester = new TypeAnalyzerTester(sut); - } - - @Test - void analysisResultsTest() { - assertAll( - () -> tester.assertAbstractType(a1, c1, c2), - () -> tester.assertEliminatedType(a2, c2), - () -> tester.assertAbstractType(a3, c2, c3), - () -> tester.assertAbstractType(a4, c1, c2, c4), - () -> tester.assertVacuousType(a5), - () -> tester.assertConcreteType(c1), - () -> tester.assertConcreteType(c2), - () -> tester.assertConcreteType(c3), - () -> tester.assertConcreteType(c4) - ); - } - - @Test - void inferredTypesTest() { - assertAll( - () -> assertThat(sut.getUnknownType(), is(new InferredType(Set.of(), Set.of(c1, c2, c3, c4), null))), - () -> assertThat(tester.getInferredType(a1), is(new InferredType(Set.of(a1, a4), Set.of(c1, c2), c1))), - () -> assertThat(tester.getInferredType(a3), is(new InferredType(Set.of(a3), Set.of(c2, c3), c2))), - () -> assertThat(tester.getInferredType(a4), is(new InferredType(Set.of(a4), Set.of(c1, c2, c4), c1))), - () -> assertThat(tester.getInferredType(a5), is(new InferredType(Set.of(a5), Set.of(), null))), - () -> assertThat(tester.getInferredType(c1), is(new InferredType(Set.of(a1, a4, c1), Set.of(c1), c1))), - () -> assertThat(tester.getInferredType(c2), - is(new InferredType(Set.of(a1, a3, a4, c2), Set.of(c2), c2))), - () -> assertThat(tester.getInferredType(c3), is(new InferredType(Set.of(a3, c3), Set.of(c3), c3))), - () -> assertThat(tester.getInferredType(c4), is(new InferredType(Set.of(a4, c4), Set.of(c4), c4))) - ); - } - - @Test - void consistentMustTest() { - var a1Result = tester.getPreservedType(a1); - var a3Result = tester.getPreservedType(a3); - var expected = new InferredType(Set.of(a1, a3, a4, c2), Set.of(c2), c2); - assertAll( - () -> assertThat(a1Result.merge(a3Result.asInferredType(), TruthValue.TRUE), is(expected)), - () -> assertThat(a3Result.merge(a1Result.asInferredType(), TruthValue.TRUE), is(expected)), - () -> assertThat(a1Result.merge(sut.getUnknownType(), TruthValue.TRUE), is(a1Result.asInferredType())), - () -> assertThat(a3Result.merge(sut.getUnknownType(), TruthValue.TRUE), is(a3Result.asInferredType())), - () -> assertThat(a1Result.merge(a1Result.asInferredType(), TruthValue.TRUE), - is(a1Result.asInferredType())) - ); - } - - @Test - void consistentMayNotTest() { - var a1Result = tester.getPreservedType(a1); - var a3Result = tester.getPreservedType(a3); - var a4Result = tester.getPreservedType(a4); - assertAll( - () -> assertThat(a1Result.merge(a3Result.asInferredType(), TruthValue.FALSE), - is(new InferredType(Set.of(a3, c3), Set.of(c3), c3))), - () -> assertThat(a3Result.merge(a1Result.asInferredType(), TruthValue.FALSE), - is(new InferredType(Set.of(a1, a4, c1), Set.of(c1), c1))), - () -> assertThat(a4Result.merge(a3Result.asInferredType(), TruthValue.FALSE), - is(new InferredType(Set.of(a3, c3), Set.of(c3), c3))), - () -> assertThat(a3Result.merge(a4Result.asInferredType(), TruthValue.FALSE), - is(new InferredType(Set.of(a4), Set.of(c1, c4), c1))), - () -> assertThat(a1Result.merge(sut.getUnknownType(), TruthValue.FALSE), - is(new InferredType(Set.of(), Set.of(c3, c4), null))), - () -> assertThat(a3Result.merge(sut.getUnknownType(), TruthValue.FALSE), - is(new InferredType(Set.of(), Set.of(c1, c4), null))), - () -> assertThat(a4Result.merge(sut.getUnknownType(), TruthValue.FALSE), - is(new InferredType(Set.of(), Set.of(c3), null))) - ); - } - - @Test - void consistentErrorTest() { - var c1Result = tester.getPreservedType(c1); - var a4Result = tester.getPreservedType(a4); - var expected = new InferredType(Set.of(c1, a1, a4), Set.of(), null); - assertAll( - () -> assertThat(c1Result.merge(a4Result.asInferredType(), TruthValue.ERROR), is(expected)), - () -> assertThat(a4Result.merge(c1Result.asInferredType(), TruthValue.ERROR), is(expected)) - ); - } - - @Test - void consistentUnknownTest() { - var c1Result = tester.getPreservedType(c1); - var a4Result = tester.getPreservedType(a4); - assertAll( - () -> assertThat(c1Result.merge(a4Result.asInferredType(), TruthValue.UNKNOWN), - is(a4Result.asInferredType())), - () -> assertThat(a4Result.merge(c1Result.asInferredType(), TruthValue.UNKNOWN), - is(c1Result.asInferredType())) - ); - } - - @Test - void inconsistentMustTest() { - var a1Result = tester.getPreservedType(a1); - var c3Result = tester.getPreservedType(c3); - assertAll( - () -> assertThat(a1Result.merge(c3Result.asInferredType(), TruthValue.TRUE), - is(new InferredType(Set.of(a1, a3, c3), Set.of(), null))), - () -> assertThat(c3Result.merge(a1Result.asInferredType(), TruthValue.TRUE), - is(new InferredType(Set.of(a1, a3, a4, c3), Set.of(), null))) - ); - } - - @Test - void inconsistentMayNotTest() { - var a1Result = tester.getPreservedType(a1); - var a4Result = tester.getPreservedType(a4); - var c1Result = tester.getPreservedType(c1); - assertAll( - () -> assertThat(a4Result.merge(a1Result.asInferredType(), TruthValue.FALSE), - is(new InferredType(Set.of(a1, a4), Set.of(), null))), - () -> assertThat(a1Result.merge(c1Result.asInferredType(), TruthValue.FALSE), - is(new InferredType(Set.of(a1, a4, c1), Set.of(), null))), - () -> assertThat(a4Result.merge(c1Result.asInferredType(), TruthValue.FALSE), - is(new InferredType(Set.of(a1, a4, c1), Set.of(), null))), - () -> assertThat(a1Result.merge(a1Result.asInferredType(), TruthValue.FALSE), - is(new InferredType(Set.of(a1, a4), Set.of(), null))) - ); - } - - @Test - void vacuousMustTest() { - var c1Result = tester.getPreservedType(c1); - var a5Result = tester.getPreservedType(a5); - assertAll( - () -> assertThat(c1Result.merge(a5Result.asInferredType(), TruthValue.TRUE), - is(new InferredType(Set.of(a1, a4, a5, c1), Set.of(), null))), - () -> assertThat(a5Result.merge(c1Result.asInferredType(), TruthValue.TRUE), - is(new InferredType(Set.of(a1, a4, a5, c1), Set.of(), null))) - ); - } - - @Test - void vacuousMayNotTest() { - var c1Result = tester.getPreservedType(c1); - var a5Result = tester.getPreservedType(a5); - assertAll( - () -> assertThat(c1Result.merge(a5Result.asInferredType(), TruthValue.FALSE), - is(a5Result.asInferredType())), - () -> assertThat(a5Result.merge(c1Result.asInferredType(), TruthValue.FALSE), - is(c1Result.asInferredType())) - ); - } - - @Test - void vacuousErrorTest() { - var c1Result = tester.getPreservedType(c1); - var a5Result = tester.getPreservedType(a5); - assertAll( - () -> assertThat(c1Result.merge(a5Result.asInferredType(), TruthValue.ERROR), - is(new InferredType(Set.of(a1, a4, a5, c1), Set.of(), null))), - () -> assertThat(a5Result.merge(c1Result.asInferredType(), TruthValue.ERROR), - is(new InferredType(Set.of(a1, a4, a5, c1), Set.of(), null))), - () -> assertThat(a5Result.merge(a5Result.asInferredType(), TruthValue.ERROR), - is(a5Result.asInferredType())) - ); - } -} diff --git a/subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTest.java b/subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTest.java deleted file mode 100644 index 02903026..00000000 --- a/subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTest.java +++ /dev/null @@ -1,200 +0,0 @@ -package tools.refinery.store.partial.translator.typehierarchy; - -import org.junit.jupiter.api.Test; -import tools.refinery.store.partial.representation.PartialRelation; -import tools.refinery.store.representation.TruthValue; - -import java.util.LinkedHashMap; -import java.util.Set; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.junit.jupiter.api.Assertions.assertAll; -import static org.junit.jupiter.api.Assertions.assertThrows; - -class TypeAnalyzerTest { - @Test - void directSupertypesTest() { - var c1 = new PartialRelation("C1", 1); - var c2 = new PartialRelation("C2", 1); - var c3 = new PartialRelation("C3", 1); - var typeInfoMap = new LinkedHashMap(); - typeInfoMap.put(c1, TypeInfo.builder().supertypes(c2, c3).build()); - typeInfoMap.put(c2, TypeInfo.builder().supertype(c3).build()); - typeInfoMap.put(c3, TypeInfo.builder().build()); - - var sut = new TypeAnalyzer(typeInfoMap); - var tester = new TypeAnalyzerTester(sut); - - assertAll( - () -> tester.assertConcreteType(c1), - () -> tester.assertConcreteType(c2, c1), - () -> tester.assertConcreteType(c3, c2) - ); - } - - @Test - void typeEliminationAbstractToConcreteTest() { - var c1 = new PartialRelation("C1", 1); - var c2 = new PartialRelation("C2", 1); - var a11 = new PartialRelation("A11", 1); - var a12 = new PartialRelation("A12", 1); - var a21 = new PartialRelation("A21", 1); - var a22 = new PartialRelation("A22", 1); - var a3 = new PartialRelation("A3", 1); - var typeInfoMap = new LinkedHashMap(); - typeInfoMap.put(a3, TypeInfo.builder().abstractType().build()); - typeInfoMap.put(a21, TypeInfo.builder().abstractType().supertype(a3).build()); - typeInfoMap.put(a22, TypeInfo.builder().abstractType().supertype(a3).build()); - typeInfoMap.put(a11, TypeInfo.builder().abstractType().supertypes(a21, a22).build()); - typeInfoMap.put(a12, TypeInfo.builder().abstractType().supertypes(a21, a22).build()); - typeInfoMap.put(c1, TypeInfo.builder().supertypes(a11, a12).build()); - typeInfoMap.put(c2, TypeInfo.builder().supertype(a3).build()); - - var sut = new TypeAnalyzer(typeInfoMap); - var tester = new TypeAnalyzerTester(sut); - - assertAll( - () -> tester.assertConcreteType(c1), - () -> tester.assertConcreteType(c2), - () -> tester.assertEliminatedType(a11, c1), - () -> tester.assertEliminatedType(a12, c1), - () -> tester.assertEliminatedType(a21, c1), - () -> tester.assertEliminatedType(a22, c1), - () -> tester.assertAbstractType(a3, c1, c2) - ); - } - - @Test - void typeEliminationConcreteToAbstractTest() { - var c1 = new PartialRelation("C1", 1); - var c2 = new PartialRelation("C2", 1); - var a11 = new PartialRelation("A11", 1); - var a12 = new PartialRelation("A12", 1); - var a21 = new PartialRelation("A21", 1); - var a22 = new PartialRelation("A22", 1); - var a3 = new PartialRelation("A3", 1); - var typeInfoMap = new LinkedHashMap(); - typeInfoMap.put(c1, TypeInfo.builder().supertypes(a11, a12).build()); - typeInfoMap.put(c2, TypeInfo.builder().supertype(a3).build()); - typeInfoMap.put(a11, TypeInfo.builder().abstractType().supertypes(a21, a22).build()); - typeInfoMap.put(a12, TypeInfo.builder().abstractType().supertypes(a21, a22).build()); - typeInfoMap.put(a21, TypeInfo.builder().abstractType().supertype(a3).build()); - typeInfoMap.put(a22, TypeInfo.builder().abstractType().supertype(a3).build()); - typeInfoMap.put(a3, TypeInfo.builder().abstractType().build()); - - var sut = new TypeAnalyzer(typeInfoMap); - var tester = new TypeAnalyzerTester(sut); - - assertAll( - () -> tester.assertConcreteType(c1), - () -> tester.assertConcreteType(c2), - () -> tester.assertEliminatedType(a11, c1), - () -> tester.assertEliminatedType(a12, c1), - () -> tester.assertEliminatedType(a21, c1), - () -> tester.assertEliminatedType(a22, c1), - () -> tester.assertAbstractType(a3, c1, c2) - ); - } - - @Test - void preserveConcreteTypeTest() { - var c1 = new PartialRelation("C1", 1); - var a1 = new PartialRelation("A1", 1); - var c2 = new PartialRelation("C2", 1); - var a2 = new PartialRelation("A2", 1); - var typeInfoMap = new LinkedHashMap(); - typeInfoMap.put(c1, TypeInfo.builder().supertype(a1).build()); - typeInfoMap.put(a1, TypeInfo.builder().abstractType().supertype(c2).build()); - typeInfoMap.put(c2, TypeInfo.builder().supertype(a2).build()); - typeInfoMap.put(a2, TypeInfo.builder().abstractType().build()); - - var sut = new TypeAnalyzer(typeInfoMap); - var tester = new TypeAnalyzerTester(sut); - - assertAll( - () -> tester.assertConcreteType(c1), - () -> tester.assertEliminatedType(a1, c1), - () -> tester.assertConcreteType(c2, c1), - () -> tester.assertEliminatedType(a2, c2) - ); - } - - @Test - void mostGeneralCurrentTypeTest() { - var c1 = new PartialRelation("C1", 1); - var c2 = new PartialRelation("C2", 1); - var c3 = new PartialRelation("C3", 1); - var typeInfoMap = new LinkedHashMap(); - typeInfoMap.put(c1, TypeInfo.builder().supertype(c3).build()); - typeInfoMap.put(c2, TypeInfo.builder().supertype(c3).build()); - typeInfoMap.put(c3, TypeInfo.builder().build()); - - var sut = new TypeAnalyzer(typeInfoMap); - var tester = new TypeAnalyzerTester(sut); - var c3Result = tester.getPreservedType(c3); - - var expected = new InferredType(Set.of(c3), Set.of(c1, c2, c3), c3); - assertAll( - () -> assertThat(tester.getInferredType(c3), is(expected)), - () -> assertThat(c3Result.merge(sut.getUnknownType(), TruthValue.TRUE), is(expected)) - ); - } - - @Test - void preferFirstConcreteTypeTest() { - var a1 = new PartialRelation("A1", 1); - var c1 = new PartialRelation("C1", 1); - var c2 = new PartialRelation("C2", 1); - var c3 = new PartialRelation("C3", 1); - var c4 = new PartialRelation("C4", 1); - var typeInfoMap = new LinkedHashMap(); - typeInfoMap.put(c1, TypeInfo.builder().supertype(a1).build()); - typeInfoMap.put(c2, TypeInfo.builder().supertype(a1).build()); - typeInfoMap.put(c3, TypeInfo.builder().supertype(a1).build()); - typeInfoMap.put(c4, TypeInfo.builder().supertype(c3).build()); - typeInfoMap.put(a1, TypeInfo.builder().abstractType().build()); - - var sut = new TypeAnalyzer(typeInfoMap); - var tester = new TypeAnalyzerTester(sut); - var c1Result = tester.getPreservedType(c1); - var a1Result = tester.getPreservedType(a1); - - assertThat(c1Result.merge(a1Result.asInferredType(), TruthValue.FALSE), - is(new InferredType(Set.of(a1), Set.of(c2, c3, c4), c2))); - } - - @Test - void preferFirstMostGeneralConcreteTypeTest() { - var a1 = new PartialRelation("A1", 1); - var c1 = new PartialRelation("C1", 1); - var c2 = new PartialRelation("C2", 1); - var c3 = new PartialRelation("C3", 1); - var c4 = new PartialRelation("C4", 1); - var typeInfoMap = new LinkedHashMap(); - typeInfoMap.put(c4, TypeInfo.builder().supertype(c3).build()); - typeInfoMap.put(c3, TypeInfo.builder().supertype(a1).build()); - typeInfoMap.put(c2, TypeInfo.builder().supertype(a1).build()); - typeInfoMap.put(c1, TypeInfo.builder().supertype(a1).build()); - typeInfoMap.put(a1, TypeInfo.builder().abstractType().build()); - - var sut = new TypeAnalyzer(typeInfoMap); - var tester = new TypeAnalyzerTester(sut); - var c1Result = tester.getPreservedType(c1); - var a1Result = tester.getPreservedType(a1); - - assertThat(c1Result.merge(a1Result.asInferredType(), TruthValue.FALSE), - is(new InferredType(Set.of(a1), Set.of(c2, c3, c4), c3))); - } - - @Test - void circularTypeHierarchyTest() { - var c1 = new PartialRelation("C1", 1); - var c2 = new PartialRelation("C2", 1); - var typeInfoMap = new LinkedHashMap(); - typeInfoMap.put(c1, TypeInfo.builder().supertype(c2).build()); - typeInfoMap.put(c2, TypeInfo.builder().supertype(c1).build()); - - assertThrows(IllegalArgumentException.class, () -> new TypeAnalyzer(typeInfoMap)); - } -} diff --git a/subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTester.java b/subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTester.java deleted file mode 100644 index ce600ea6..00000000 --- a/subprojects/store/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTester.java +++ /dev/null @@ -1,51 +0,0 @@ -package tools.refinery.store.partial.translator.typehierarchy; - -import tools.refinery.store.partial.representation.PartialRelation; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.is; - -class TypeAnalyzerTester { - private final TypeAnalyzer sut; - - public TypeAnalyzerTester(TypeAnalyzer sut) { - this.sut = sut; - } - - public void assertAbstractType(PartialRelation partialRelation, PartialRelation... directSubtypes) { - assertPreservedType(partialRelation, true, false, directSubtypes); - } - - public void assertVacuousType(PartialRelation partialRelation) { - assertPreservedType(partialRelation, true, true); - } - - public void assertConcreteType(PartialRelation partialRelation, PartialRelation... directSubtypes) { - assertPreservedType(partialRelation, false, false, directSubtypes); - } - - private void assertPreservedType(PartialRelation partialRelation, boolean isAbstract, boolean isVacuous, - PartialRelation... directSubtypes) { - var result = sut.getAnalysisResults().get(partialRelation); - assertThat(result, is(instanceOf(PreservedType.class))); - var preservedResult = (PreservedType) result; - assertThat(preservedResult.isAbstractType(), is(isAbstract)); - assertThat(preservedResult.isVacuous(), is(isVacuous)); - assertThat(preservedResult.getDirectSubtypes(), hasItems(directSubtypes)); - } - - public void assertEliminatedType(PartialRelation partialRelation, PartialRelation replacement) { - var result = sut.getAnalysisResults().get(partialRelation); - assertThat(result, is(instanceOf(EliminatedType.class))); - assertThat(((EliminatedType) result).replacement(), is(replacement)); - } - - public PreservedType getPreservedType(PartialRelation partialRelation) { - return (PreservedType) sut.getAnalysisResults().get(partialRelation); - } - - public InferredType getInferredType(PartialRelation partialRelation) { - return getPreservedType(partialRelation).asInferredType(); - } -} -- cgit v1.2.3-70-g09d2 From 12669b3bf4dcefda337d141ab2a2f2bf3cf04ee5 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Mon, 10 Apr 2023 00:55:10 +0200 Subject: chore: add copyright headers Make sure we obey the REUSE (https://reuse.software) specification and the origin, copyright owner, and license of all files are clearly marked. The whole project is under the EPL-2.0, except for trivial files where copyright is not applicable that are marked with the CC0-1.0 license. Moreover, code included from third parties is also available under the respective license. chore: add CONTRIBUTORS.md List all authors and supporting organizations in accordance with the REUSE specification. --- .editorconfig | 4 + .gitattributes | 4 + .github/workflows/build.yml | 4 + .gitignore | 4 + .reuse/dep5 | 29 +++ .vscode/extensions.json | 5 + .vscode/settings.json | 5 + .yarn/sdks/integrations.yml.license | 3 + .yarnrc.yml | 6 +- CONTRIBUTORS.md | 28 ++ LICENSE | 286 ++++----------------- LICENSES/Apache-2.0.txt | 73 ++++++ LICENSES/BSD-2-Clause.txt | 9 + LICENSES/CC0-1.0.txt | 121 +++++++++ LICENSES/EPL-2.0.txt | 80 ++++++ LICENSES/MIT.txt | 9 + README.md | 13 +- build.gradle.kts | 6 + buildSrc/build.gradle.kts | 6 + buildSrc/settings.gradle.kts | 6 + .../tools/refinery/gradle/utils/EclipseUtils.java | 5 + .../gradle/utils/SonarPropertiesUtils.java | 5 + .../tools/refinery/gradle/eclipse.gradle.kts | 5 + .../refinery/gradle/frontend-workspace.gradle.kts | 5 + .../refinery/gradle/frontend-worktree.gradle.kts | 5 + .../internal/frontend-conventions.gradle.kts | 5 + .../gradle/internal/java-conventions.gradle.kts | 5 + .../refinery/gradle/java-application.gradle.kts | 5 + .../tools/refinery/gradle/java-library.gradle.kts | 5 + .../refinery/gradle/java-test-fixtures.gradle.kts | 5 + .../kotlin/tools/refinery/gradle/jmh.gradle.kts | 5 + .../kotlin/tools/refinery/gradle/mwe2.gradle.kts | 5 + .../tools/refinery/gradle/sonarqube.gradle.kts | 5 + .../refinery/gradle/xtext-generated.gradle.kts | 5 + gradle.properties | 4 + gradle/libs.versions.toml | 4 + gradle/wrapper/gradle-wrapper.jar.license | 3 + gradle/wrapper/gradle-wrapper.properties.license | 3 + gradlew.bat.license | 3 + gradlew.license | 3 + package.json | 15 ++ settings.gradle.kts | 6 + subprojects/frontend/.eslintrc.cjs | 6 + .../frontend/assets-src/favicon.svg.license | 3 + subprojects/frontend/assets-src/icon.svg.license | 3 + .../frontend/assets-src/mask-icon.svg.license | 3 + subprojects/frontend/build.gradle.kts | 6 + .../frontend/config/backendConfigVitePlugin.ts | 6 + .../frontend/config/detectDevModeOptions.ts | 6 + subprojects/frontend/config/eslintReport.cjs | 6 + .../frontend/config/fetchPackageMetadata.ts | 6 + subprojects/frontend/config/manifest.ts | 8 +- .../frontend/config/minifyHTMLVitePlugin.ts | 6 + .../frontend/config/preloadFontsVitePlugin.ts | 6 + subprojects/frontend/index.html | 5 + subprojects/frontend/package.json | 9 +- subprojects/frontend/prettier.config.cjs | 6 + .../frontend/public/apple-touch-icon.png.license | 3 + .../frontend/public/favicon-96x96.png.license | 3 + subprojects/frontend/public/favicon.png.license | 3 + subprojects/frontend/public/favicon.svg.license | 3 + .../frontend/public/icon-192x192.png.license | 3 + .../frontend/public/icon-512x512.png.license | 3 + subprojects/frontend/public/icon-any.svg.license | 3 + subprojects/frontend/public/mask-icon.svg.license | 3 + subprojects/frontend/public/robots.txt | 4 + subprojects/frontend/src/App.tsx | 6 + subprojects/frontend/src/Loading.tsx | 6 + subprojects/frontend/src/PWAStore.ts | 6 + subprojects/frontend/src/Refinery.tsx | 6 + subprojects/frontend/src/RootStore.ts | 6 + subprojects/frontend/src/RootStoreProvider.tsx | 6 + subprojects/frontend/src/ToggleDarkModeButton.tsx | 6 + subprojects/frontend/src/TopBar.tsx | 6 + subprojects/frontend/src/UpdateNotification.tsx | 6 + .../frontend/src/WindowControlsOverlayColor.tsx | 6 + subprojects/frontend/src/editor/AnimatedButton.tsx | 6 + subprojects/frontend/src/editor/ConnectButton.tsx | 6 + .../src/editor/ConnectionStatusNotification.tsx | 6 + subprojects/frontend/src/editor/DiagnosticValue.ts | 6 + subprojects/frontend/src/editor/EditorArea.tsx | 6 + subprojects/frontend/src/editor/EditorButtons.tsx | 6 + subprojects/frontend/src/editor/EditorPane.tsx | 6 + subprojects/frontend/src/editor/EditorStore.ts | 6 + subprojects/frontend/src/editor/EditorTheme.ts | 6 + subprojects/frontend/src/editor/GenerateButton.tsx | 6 + subprojects/frontend/src/editor/LintPanelStore.ts | 6 + subprojects/frontend/src/editor/PanelStore.ts | 6 + subprojects/frontend/src/editor/SearchPanel.ts | 6 + .../frontend/src/editor/SearchPanelPortal.tsx | 6 + .../frontend/src/editor/SearchPanelStore.ts | 6 + subprojects/frontend/src/editor/SearchToolbar.tsx | 6 + .../frontend/src/editor/createEditorState.ts | 6 + .../src/editor/defineDecorationSetExtension.ts | 6 + .../frontend/src/editor/exposeDiagnostics.ts | 6 + subprojects/frontend/src/editor/findOccurrences.ts | 6 + .../src/editor/indentationMarkerViewPlugin.ts | 10 +- .../frontend/src/editor/scrollbarViewPlugin.ts | 6 + .../frontend/src/editor/semanticHighlighting.ts | 6 + subprojects/frontend/src/index.tsx | 6 + subprojects/frontend/src/language/folding.ts | 6 + subprojects/frontend/src/language/indentation.ts | 7 + subprojects/frontend/src/language/problem.grammar | 6 + .../src/language/problemLanguageSupport.ts | 6 + subprojects/frontend/src/language/props.ts | 6 + subprojects/frontend/src/theme/ThemeProvider.tsx | 6 + subprojects/frontend/src/theme/ThemeStore.ts | 6 + subprojects/frontend/src/utils/CancelledError.ts | 6 + subprojects/frontend/src/utils/PendingTask.ts | 6 + subprojects/frontend/src/utils/PriorityMutex.ts | 6 + subprojects/frontend/src/utils/TimeoutError.ts | 6 + subprojects/frontend/src/utils/getLogger.ts | 6 + .../frontend/src/utils/useDelayedSnackbar.ts | 6 + subprojects/frontend/src/xtext/BackendConfig.ts | 6 + .../frontend/src/xtext/ContentAssistService.ts | 6 + .../frontend/src/xtext/HighlightingService.ts | 6 + .../frontend/src/xtext/OccurrencesService.ts | 6 + subprojects/frontend/src/xtext/UpdateService.ts | 6 + .../frontend/src/xtext/UpdateStateTracker.ts | 6 + .../frontend/src/xtext/ValidationService.ts | 6 + subprojects/frontend/src/xtext/XtextClient.ts | 6 + .../frontend/src/xtext/XtextWebSocketClient.ts | 6 + .../frontend/src/xtext/fetchBackendConfig.ts | 6 + subprojects/frontend/src/xtext/webSocketMachine.ts | 6 + subprojects/frontend/src/xtext/xtextMessages.ts | 6 + .../frontend/src/xtext/xtextServiceResults.ts | 6 + subprojects/frontend/tsconfig.base.json | 13 + subprojects/frontend/tsconfig.json | 5 + subprojects/frontend/tsconfig.node.json | 5 + subprojects/frontend/tsconfig.shared.json | 7 +- subprojects/frontend/types/ImportMeta.d.ts | 7 + subprojects/frontend/types/grammar.d.ts | 7 + .../types/node/@lezer-generator-rollup.d.ts | 7 + .../frontend/types/windowControlsOverlay.d.ts | 6 + subprojects/frontend/vite.config.ts | 6 + subprojects/language-ide/build.gradle.kts | 6 + .../refinery/language/ide/ProblemIdeModule.java | 6 + .../refinery/language/ide/ProblemIdeSetup.java | 6 + .../language/ide/contentassist/FuzzyMatcher.java | 5 + .../ProblemCrossrefProposalProvider.java | 5 + ...InjectingPartialProblemContentAssistParser.java | 5 + .../TokenSourceInjectingProblemParser.java | 5 + .../contentassist/antlr/ProblemTokenSource.java | 6 + .../ProblemSemanticHighlightingCalculator.java | 5 + .../language-model/META-INF/MANIFEST.MF.license | 3 + subprojects/language-model/build.gradle.kts | 6 + subprojects/language-model/build.properties | 2 + subprojects/language-model/plugin.properties | 2 + subprojects/language-model/plugin.xml | 3 + subprojects/language-model/problem.aird.license | 3 + .../language/model/GenerateProblemModel.mwe2 | 5 + .../src/main/resources/model/problem.ecore.license | 3 + .../main/resources/model/problem.genmodel.license | 3 + subprojects/language-semantics/build.gradle.kts | 6 + .../language/semantics/model/ModelInitializer.java | 5 + .../semantics/model/internal/DecisionTree.java | 5 + .../model/internal/DecisionTreeCursor.java | 5 + .../semantics/model/internal/DecisionTreeNode.java | 5 + .../model/internal/DecisionTreeValue.java | 5 + .../semantics/model/internal/IntermediateNode.java | 5 + .../semantics/model/internal/TerminalNode.java | 5 + .../semantics/model/tests/DecisionTreeTests.java | 5 + subprojects/language-web/build.gradle.kts | 6 + .../refinery/language/web/CacheControlFilter.java | 5 + .../refinery/language/web/ProblemWebModule.java | 6 + .../refinery/language/web/ProblemWebSetup.java | 6 + .../language/web/ProblemWebSocketServlet.java | 5 + .../language/web/SecurityHeadersFilter.java | 5 + .../refinery/language/web/ServerLauncher.java | 6 + .../refinery/language/web/VirtualThreadUtils.java | 5 + .../language/web/config/BackendConfig.java | 5 + .../language/web/config/BackendConfigServlet.java | 5 + .../web/occurrences/ProblemOccurrencesService.java | 5 + .../VirtualThreadExecutorServiceProvider.java | 5 + .../language/web/xtext/server/PongResult.java | 5 + .../language/web/xtext/server/ResponseHandler.java | 5 + .../web/xtext/server/ResponseHandlerException.java | 5 + .../xtext/server/SubscribingServiceContext.java | 5 + .../web/xtext/server/TransactionExecutor.java | 5 + .../xtext/server/message/XtextWebErrorKind.java | 5 + .../server/message/XtextWebErrorResponse.java | 5 + .../xtext/server/message/XtextWebOkResponse.java | 5 + .../xtext/server/message/XtextWebPushMessage.java | 5 + .../web/xtext/server/message/XtextWebRequest.java | 5 + .../web/xtext/server/message/XtextWebResponse.java | 5 + .../xtext/server/push/PrecomputationListener.java | 5 + .../xtext/server/push/PushServiceDispatcher.java | 5 + .../web/xtext/server/push/PushWebDocument.java | 5 + .../xtext/server/push/PushWebDocumentAccess.java | 5 + .../xtext/server/push/PushWebDocumentProvider.java | 5 + .../web/xtext/servlet/SimpleServiceContext.java | 5 + .../language/web/xtext/servlet/SimpleSession.java | 5 + .../web/xtext/servlet/XtextStatusCode.java | 5 + .../language/web/xtext/servlet/XtextWebSocket.java | 5 + .../web/xtext/servlet/XtextWebSocketServlet.java | 5 + .../ProblemWebSocketServletIntegrationTest.java | 5 + .../AwaitTerminationExecutorServiceProvider.java | 5 + .../web/tests/ProblemWebInjectorProvider.java | 5 + .../web/tests/RestartableCachedThreadPool.java | 5 + .../web/tests/WebSocketIntegrationTestClient.java | 5 + .../web/xtext/servlet/TransactionExecutorTest.java | 5 + subprojects/language/build.gradle.kts | 6 + .../tools/refinery/language/GenerateProblem.mwe2 | 7 +- .../java/tools/refinery/language/Problem.xtext | 5 + .../refinery/language/ProblemRuntimeModule.java | 6 + .../refinery/language/ProblemStandaloneSetup.java | 6 + .../conversion/ProblemValueConverterService.java | 5 + .../conversion/UpperBoundValueConverter.java | 5 + .../language/formatting2/ProblemFormatter.java | 6 + .../tools/refinery/language/naming/NamingUtil.java | 5 + .../naming/ProblemQualifiedNameConverter.java | 5 + .../parser/antlr/IdentifierTokenProvider.java | 5 + .../language/parser/antlr/ProblemTokenSource.java | 6 + .../antlr/TokenSourceInjectingProblemParser.java | 5 + .../language/resource/DerivedVariableComputer.java | 5 + .../language/resource/ImplicitVariableScope.java | 5 + .../language/resource/NodeNameCollector.java | 5 + .../resource/ProblemDerivedStateComputer.java | 5 + .../resource/ProblemLocationInFileProvider.java | 5 + .../ProblemResourceDescriptionStrategy.java | 5 + .../language/resource/ReferenceCounter.java | 5 + .../scoping/ProblemGlobalScopeProvider.java | 5 + .../scoping/ProblemLocalScopeProvider.java | 5 + .../language/scoping/ProblemScopeProvider.java | 6 + ...ferShortAssertionsProblemSemanticSequencer.java | 5 + .../refinery/language/utils/BuiltinSymbols.java | 5 + .../refinery/language/utils/CollectedSymbols.java | 5 + .../refinery/language/utils/ContainmentRole.java | 5 + .../tools/refinery/language/utils/NodeInfo.java | 5 + .../refinery/language/utils/ProblemDesugarer.java | 5 + .../tools/refinery/language/utils/ProblemUtil.java | 5 + .../refinery/language/utils/RelationInfo.java | 5 + .../refinery/language/utils/SymbolCollector.java | 5 + .../language/validation/ProblemValidator.java | 6 + .../tools/refinery/language/builtin.problem | 3 + .../language/tests/ProblemParsingTest.java | 5 + .../tests/formatting2/ProblemFormatterTest.java | 5 + .../parser/antlr/IdentifierTokenProviderTest.java | 5 + .../tests/parser/antlr/ProblemTokenSourceTest.java | 5 + .../parser/antlr/TransitiveClosureParserTest.java | 5 + .../language/tests/rules/RuleParsingTest.java | 5 + .../language/tests/scoping/NodeScopingTest.java | 5 + .../tests/serializer/ProblemSerializerTest.java | 5 + .../language/tests/utils/SymbolCollectorTest.java | 5 + .../model/tests/utils/ProblemNavigationUtil.java | 5 + .../model/tests/utils/ProblemParseHelper.java | 5 + .../language/model/tests/utils/WrappedAction.java | 5 + .../model/tests/utils/WrappedArgument.java | 5 + .../model/tests/utils/WrappedAssertion.java | 5 + .../tests/utils/WrappedAssertionArgument.java | 5 + .../language/model/tests/utils/WrappedAtom.java | 5 + .../model/tests/utils/WrappedClassDeclaration.java | 5 + .../model/tests/utils/WrappedConjunction.java | 5 + .../model/tests/utils/WrappedConsequent.java | 5 + .../model/tests/utils/WrappedEnumDeclaration.java | 5 + .../language/model/tests/utils/WrappedLiteral.java | 5 + .../tests/utils/WrappedParametricDefinition.java | 5 + .../tests/utils/WrappedPredicateDefinition.java | 5 + .../language/model/tests/utils/WrappedProblem.java | 5 + .../model/tests/utils/WrappedRuleDefinition.java | 5 + subprojects/store-query-viatra/NOTICE.md | 87 +++++++ subprojects/store-query-viatra/build.gradle.kts | 6 + .../store/query/viatra/ViatraModelQuery.java | 5 + .../query/viatra/ViatraModelQueryAdapter.java | 5 + .../query/viatra/ViatraModelQueryBuilder.java | 5 + .../query/viatra/ViatraModelQueryStoreAdapter.java | 5 + .../query/viatra/internal/RelationalScope.java | 5 + .../internal/ViatraModelQueryAdapterImpl.java | 5 + .../internal/ViatraModelQueryBuilderImpl.java | 5 + .../internal/ViatraModelQueryStoreAdapterImpl.java | 5 + .../UpperCardinalitySumAggregationOperator.java | 5 + .../viatra/internal/context/DummyBaseIndexer.java | 5 + .../internal/context/RelationalEngineContext.java | 5 + .../context/RelationalQueryMetaContext.java | 5 + .../internal/context/RelationalRuntimeContext.java | 5 + .../localsearch/ExtendOperationExecutor.java | 1 + .../localsearch/ExtendPositivePatternCall.java | 1 + .../internal/localsearch/FlatCostFunction.java | 5 + .../internal/localsearch/GenericTypeExtend.java | 1 + .../RelationalLocalSearchBackendFactory.java | 5 + .../RelationalLocalSearchResultProvider.java | 5 + .../localsearch/RelationalOperationCompiler.java | 5 + .../viatra/internal/matcher/FunctionalCursor.java | 5 + .../internal/matcher/FunctionalViatraMatcher.java | 5 + .../viatra/internal/matcher/IndexerUtils.java | 5 + .../viatra/internal/matcher/MatcherUtils.java | 5 + .../viatra/internal/matcher/RawPatternMatcher.java | 5 + .../viatra/internal/matcher/RelationalCursor.java | 5 + .../internal/matcher/RelationalViatraMatcher.java | 5 + .../internal/matcher/UnsafeFunctionalCursor.java | 5 + .../internal/pquery/AssumptionEvaluator.java | 5 + .../query/viatra/internal/pquery/Dnf2PQuery.java | 5 + .../internal/pquery/QueryWrapperFactory.java | 5 + .../query/viatra/internal/pquery/RawPQuery.java | 5 + .../internal/pquery/RelationViewWrapper.java | 5 + .../pquery/StatefulMultisetAggregator.java | 5 + .../pquery/StatelessMultisetAggregator.java | 5 + .../viatra/internal/pquery/TermEvaluator.java | 5 + .../pquery/ValueProviderBasedValuation.java | 5 + .../internal/update/ModelUpdateListener.java | 5 + .../viatra/internal/update/RelationViewFilter.java | 5 + .../update/RelationViewUpdateListener.java | 5 + .../TupleChangingRelationViewUpdateListener.java | 5 + .../TuplePreservingRelationViewUpdateListener.java | 5 + .../store/query/viatra/DiagonalQueryTest.java | 5 + .../store/query/viatra/FunctionalQueryTest.java | 5 + .../refinery/store/query/viatra/QueryTest.java | 5 + .../store/query/viatra/QueryTransactionTest.java | 5 + ...ardinalitySumAggregationOperatorStreamTest.java | 5 + ...UpperCardinalitySumAggregationOperatorTest.java | 5 + .../viatra/internal/matcher/MatcherUtilsTest.java | 5 + .../store/query/viatra/tests/QueryAssertions.java | 5 + .../store/query/viatra/tests/QueryBackendHint.java | 5 + .../store/query/viatra/tests/QueryEngineTest.java | 5 + .../viatra/tests/QueryEvaluationHintSource.java | 5 + subprojects/store-query/build.gradle.kts | 6 + .../tools/refinery/store/query/AnyResultSet.java | 5 + .../tools/refinery/store/query/Constraint.java | 5 + .../tools/refinery/store/query/EmptyResultSet.java | 5 + .../tools/refinery/store/query/ModelQuery.java | 5 + .../refinery/store/query/ModelQueryAdapter.java | 5 + .../refinery/store/query/ModelQueryBuilder.java | 5 + .../store/query/ModelQueryStoreAdapter.java | 5 + .../java/tools/refinery/store/query/ResultSet.java | 5 + .../tools/refinery/store/query/dnf/AnyQuery.java | 5 + .../java/tools/refinery/store/query/dnf/Dnf.java | 5 + .../tools/refinery/store/query/dnf/DnfBuilder.java | 5 + .../tools/refinery/store/query/dnf/DnfClause.java | 5 + .../tools/refinery/store/query/dnf/DnfUtils.java | 5 + .../store/query/dnf/FunctionalDependency.java | 5 + .../refinery/store/query/dnf/FunctionalQuery.java | 5 + .../store/query/dnf/FunctionalQueryBuilder.java | 5 + .../java/tools/refinery/store/query/dnf/Query.java | 5 + .../refinery/store/query/dnf/QueryBuilder.java | 5 + .../refinery/store/query/dnf/RelationalQuery.java | 5 + .../query/equality/DeepDnfEqualityChecker.java | 5 + .../store/query/equality/DnfEqualityChecker.java | 5 + .../query/equality/LiteralEqualityHelper.java | 5 + .../store/query/literal/AbstractCallLiteral.java | 5 + .../store/query/literal/AggregationLiteral.java | 5 + .../store/query/literal/AssignLiteral.java | 5 + .../store/query/literal/AssumeLiteral.java | 5 + .../store/query/literal/BooleanLiteral.java | 5 + .../refinery/store/query/literal/CallLiteral.java | 5 + .../refinery/store/query/literal/CallPolarity.java | 5 + .../refinery/store/query/literal/CanNegate.java | 5 + .../store/query/literal/ConstantLiteral.java | 5 + .../refinery/store/query/literal/CountLiteral.java | 5 + .../store/query/literal/EquivalenceLiteral.java | 5 + .../refinery/store/query/literal/Literal.java | 5 + .../store/query/literal/LiteralReduction.java | 5 + .../refinery/store/query/literal/Literals.java | 5 + .../query/substitution/CompositeSubstitution.java | 5 + .../query/substitution/MapBasedSubstitution.java | 5 + .../query/substitution/RenewingSubstitution.java | 5 + .../query/substitution/StatelessSubstitution.java | 5 + .../store/query/substitution/Substitution.java | 5 + .../store/query/substitution/Substitutions.java | 5 + .../refinery/store/query/term/Aggregator.java | 5 + .../refinery/store/query/term/AnyDataVariable.java | 5 + .../tools/refinery/store/query/term/AnyTerm.java | 5 + .../store/query/term/ArithmeticBinaryOperator.java | 5 + .../store/query/term/ArithmeticBinaryTerm.java | 5 + .../store/query/term/ArithmeticUnaryOperator.java | 5 + .../store/query/term/ArithmeticUnaryTerm.java | 5 + .../refinery/store/query/term/AssignedValue.java | 5 + .../refinery/store/query/term/BinaryTerm.java | 5 + .../store/query/term/ComparisonOperator.java | 5 + .../refinery/store/query/term/ComparisonTerm.java | 5 + .../refinery/store/query/term/ConstantTerm.java | 5 + .../tools/refinery/store/query/term/DataSort.java | 5 + .../refinery/store/query/term/DataVariable.java | 5 + .../store/query/term/ExtremeValueAggregator.java | 5 + .../tools/refinery/store/query/term/NodeSort.java | 5 + .../refinery/store/query/term/NodeVariable.java | 5 + .../refinery/store/query/term/OpaqueTerm.java | 5 + .../java/tools/refinery/store/query/term/Sort.java | 5 + .../store/query/term/StatefulAggregate.java | 5 + .../store/query/term/StatefulAggregator.java | 5 + .../store/query/term/StatelessAggregator.java | 5 + .../java/tools/refinery/store/query/term/Term.java | 5 + .../tools/refinery/store/query/term/UnaryTerm.java | 5 + .../tools/refinery/store/query/term/Variable.java | 5 + .../store/query/term/bool/BoolConstantTerm.java | 5 + .../store/query/term/bool/BoolLogicBinaryTerm.java | 5 + .../store/query/term/bool/BoolNotTerm.java | 5 + .../refinery/store/query/term/bool/BoolTerms.java | 5 + .../store/query/term/bool/LogicBinaryOperator.java | 5 + .../query/term/int_/IntArithmeticBinaryTerm.java | 5 + .../query/term/int_/IntArithmeticUnaryTerm.java | 5 + .../store/query/term/int_/IntComparisonTerm.java | 5 + .../query/term/int_/IntExtremeValueAggregator.java | 5 + .../store/query/term/int_/IntSumAggregator.java | 5 + .../refinery/store/query/term/int_/IntTerms.java | 5 + .../store/query/term/int_/RealToIntTerm.java | 5 + .../store/query/term/real/IntToRealTerm.java | 5 + .../query/term/real/RealArithmeticBinaryTerm.java | 5 + .../query/term/real/RealArithmeticUnaryTerm.java | 5 + .../store/query/term/real/RealComparisonTerm.java | 5 + .../term/real/RealExtremeValueAggregator.java | 5 + .../store/query/term/real/RealSumAggregator.java | 5 + .../refinery/store/query/term/real/RealTerms.java | 5 + .../store/query/valuation/RestrictedValuation.java | 5 + .../query/valuation/SubstitutedValuation.java | 5 + .../refinery/store/query/valuation/Valuation.java | 5 + .../refinery/store/query/view/AnyRelationView.java | 5 + .../store/query/view/FilteredRelationView.java | 5 + .../store/query/view/ForbiddenRelationView.java | 5 + .../refinery/store/query/view/FunctionView.java | 25 ++ .../store/query/view/FunctionalRelationView.java | 5 + .../store/query/view/KeyOnlyRelationView.java | 5 + .../refinery/store/query/view/MayRelationView.java | 5 + .../store/query/view/MustRelationView.java | 5 + .../store/query/view/NodeFunctionView.java | 26 ++ .../refinery/store/query/view/RelationView.java | 5 + .../store/query/view/RelationViewImplication.java | 5 + .../query/view/TuplePreservingRelationView.java | 5 + .../refinery/store/query/view/ViewImplication.java | 23 ++ .../tools/refinery/store/query/DnfBuilderTest.java | 5 + .../store/query/DnfToDefinitionStringTest.java | 5 + .../store/query/tests/StructurallyEqualToTest.java | 5 + .../MismatchDescribingDnfEqualityChecker.java | 5 + .../refinery/store/query/tests/QueryMatchers.java | 5 + .../store/query/tests/StructurallyEqualTo.java | 5 + subprojects/store-reasoning/build.gradle.kts | 6 + .../store/reasoning/AnyPartialInterpretation.java | 5 + .../refinery/store/reasoning/MergeResult.java | 5 + .../store/reasoning/PartialInterpretation.java | 5 + .../tools/refinery/store/reasoning/Reasoning.java | 5 + .../refinery/store/reasoning/ReasoningAdapter.java | 5 + .../refinery/store/reasoning/ReasoningBuilder.java | 5 + .../store/reasoning/ReasoningStoreAdapter.java | 5 + .../reasoning/internal/ReasoningAdapterImpl.java | 5 + .../reasoning/internal/ReasoningBuilderImpl.java | 5 + .../internal/ReasoningStoreAdapterImpl.java | 5 + .../store/reasoning/lifting/DnfLifter.java | 5 + .../refinery/store/reasoning/lifting/ModalDnf.java | 5 + .../store/reasoning/literal/ModalConstraint.java | 5 + .../refinery/store/reasoning/literal/Modality.java | 5 + .../store/reasoning/literal/PartialLiterals.java | 5 + .../representation/AnyPartialFunction.java | 5 + .../reasoning/representation/AnyPartialSymbol.java | 5 + .../reasoning/representation/PartialFunction.java | 5 + .../reasoning/representation/PartialRelation.java | 5 + .../reasoning/representation/PartialSymbol.java | 5 + .../reasoning/rule/RelationRefinementAction.java | 5 + .../tools/refinery/store/reasoning/rule/Rule.java | 5 + .../refinery/store/reasoning/rule/RuleAction.java | 5 + .../store/reasoning/rule/RuleActionExecutor.java | 5 + .../store/reasoning/rule/RuleExecutor.java | 5 + .../tools/refinery/store/reasoning/seed/Seed.java | 5 + .../refinery/store/reasoning/seed/UniformSeed.java | 5 + .../store/reasoning/translator/Advice.java | 5 + .../store/reasoning/translator/AdviceSlot.java | 5 + .../reasoning/translator/TranslatedRelation.java | 5 + .../reasoning/translator/TranslationUnit.java | 5 + .../base/BaseDecisionInterpretation.java | 5 + .../base/BaseDecisionTranslationUnit.java | 5 + .../translator/base/TranslatedBaseDecision.java | 5 + .../translator/typehierarchy/EliminatedType.java | 5 + .../translator/typehierarchy/ExtendedTypeInfo.java | 5 + .../typehierarchy/InferredMayTypeRelationView.java | 5 + .../InferredMustTypeRelationView.java | 5 + .../translator/typehierarchy/InferredType.java | 5 + .../translator/typehierarchy/PreservedType.java | 5 + .../typehierarchy/TypeAnalysisResult.java | 5 + .../translator/typehierarchy/TypeAnalyzer.java | 5 + .../TypeHierarchyTranslationUnit.java | 5 + .../translator/typehierarchy/TypeInfo.java | 5 + .../translator/typehierarchy/InferredTypeTest.java | 5 + .../TypeAnalyzerExampleHierarchyTest.java | 5 + .../translator/typehierarchy/TypeAnalyzerTest.java | 5 + .../typehierarchy/TypeAnalyzerTester.java | 5 + subprojects/store/build.gradle.kts | 6 + .../map/benchmarks/ImmutablePutBenchmark.java | 5 + .../map/benchmarks/ImmutablePutExecutionPlan.java | 5 + .../store/adapter/AbstractModelAdapterBuilder.java | 5 + .../tools/refinery/store/adapter/AdapterList.java | 5 + .../store/adapter/AnyModelAdapterType.java | 5 + .../tools/refinery/store/adapter/ModelAdapter.java | 5 + .../store/adapter/ModelAdapterBuilder.java | 5 + .../store/adapter/ModelAdapterBuilderFactory.java | 5 + .../refinery/store/adapter/ModelAdapterType.java | 5 + .../refinery/store/adapter/ModelStoreAdapter.java | 5 + .../tools/refinery/store/map/AnyVersionedMap.java | 5 + .../tools/refinery/store/map/ContentHashCode.java | 5 + .../refinery/store/map/ContinousHashProvider.java | 5 + .../main/java/tools/refinery/store/map/Cursor.java | 5 + .../tools/refinery/store/map/CursorAsIterator.java | 5 + .../java/tools/refinery/store/map/Cursors.java | 5 + .../java/tools/refinery/store/map/DiffCursor.java | 5 + .../tools/refinery/store/map/MapAsIterable.java | 5 + .../java/tools/refinery/store/map/Versioned.java | 5 + .../tools/refinery/store/map/VersionedMap.java | 5 + .../refinery/store/map/VersionedMapStore.java | 5 + .../store/map/VersionedMapStoreConfiguration.java | 5 + .../refinery/store/map/VersionedMapStoreImpl.java | 5 + .../refinery/store/map/internal/HashClash.java | 5 + .../refinery/store/map/internal/ImmutableNode.java | 5 + .../refinery/store/map/internal/MapCursor.java | 5 + .../refinery/store/map/internal/MapDiffCursor.java | 5 + .../refinery/store/map/internal/MutableNode.java | 9 +- .../tools/refinery/store/map/internal/Node.java | 5 + .../refinery/store/map/internal/OldValueBox.java | 5 + .../store/map/internal/VersionedMapImpl.java | 5 + .../refinery/store/model/AnyInterpretation.java | 5 + .../tools/refinery/store/model/Interpretation.java | 5 + .../store/model/InterpretationListener.java | 5 + .../java/tools/refinery/store/model/Model.java | 5 + .../refinery/store/model/ModelDiffCursor.java | 5 + .../tools/refinery/store/model/ModelListener.java | 5 + .../tools/refinery/store/model/ModelStore.java | 5 + .../refinery/store/model/ModelStoreBuilder.java | 5 + .../refinery/store/model/TupleHashProvider.java | 5 + .../store/model/TupleHashProviderBitMagic.java | 5 + .../refinery/store/model/internal/ModelAction.java | 5 + .../refinery/store/model/internal/ModelImpl.java | 5 + .../model/internal/ModelStoreBuilderImpl.java | 5 + .../store/model/internal/ModelStoreImpl.java | 5 + .../model/internal/SymbolEquivalenceClass.java | 5 + .../model/internal/VersionedInterpretation.java | 5 + .../store/representation/AbstractDomain.java | 5 + .../store/representation/AnyAbstractDomain.java | 5 + .../refinery/store/representation/AnySymbol.java | 5 + .../refinery/store/representation/Symbol.java | 5 + .../refinery/store/representation/TruthValue.java | 5 + .../store/representation/TruthValueDomain.java | 5 + .../cardinality/CardinalityInterval.java | 5 + .../cardinality/CardinalityIntervals.java | 5 + .../cardinality/EmptyCardinalityInterval.java | 5 + .../cardinality/FiniteUpperCardinality.java | 5 + .../cardinality/NonEmptyCardinalityInterval.java | 5 + .../cardinality/UnboundedUpperCardinality.java | 5 + .../cardinality/UpperCardinalities.java | 5 + .../cardinality/UpperCardinality.java | 5 + .../java/tools/refinery/store/tuple/Tuple.java | 5 + .../java/tools/refinery/store/tuple/Tuple0.java | 5 + .../java/tools/refinery/store/tuple/Tuple1.java | 5 + .../java/tools/refinery/store/tuple/Tuple2.java | 5 + .../java/tools/refinery/store/tuple/Tuple3.java | 5 + .../java/tools/refinery/store/tuple/Tuple4.java | 5 + .../tools/refinery/store/tuple/TupleConstants.java | 5 + .../java/tools/refinery/store/tuple/TupleN.java | 5 + .../tools/refinery/store/util/CollectionsUtil.java | 5 + .../refinery/store/util/CycleDetectingMapper.java | 5 + .../refinery/store/map/tests/MapUnitTests.java | 5 + .../store/map/tests/fuzz/CommitFuzzTest.java | 5 + .../map/tests/fuzz/ContentEqualsFuzzTest.java | 5 + .../store/map/tests/fuzz/DiffCursorFuzzTest.java | 5 + .../store/map/tests/fuzz/MultiThreadFuzzTest.java | 5 + .../map/tests/fuzz/MultiThreadTestRunnable.java | 5 + .../store/map/tests/fuzz/MutableFuzzTest.java | 5 + .../fuzz/MutableImmutableCompareFuzzTest.java | 5 + .../store/map/tests/fuzz/RestoreFuzzTest.java | 5 + .../store/map/tests/fuzz/SharedStoreFuzzTest.java | 5 + .../store/map/tests/fuzz/utils/FuzzTestUtils.java | 5 + .../map/tests/fuzz/utils/FuzzTestUtilsTest.java | 5 + .../store/map/tests/utils/MapTestEnvironment.java | 5 + .../store/model/hashtests/HashEfficiencyTest.java | 5 + .../refinery/store/model/tests/ModelTest.java | 5 + .../cardinality/CardinalityIntervalTest.java | 5 + .../cardinality/CardinalityIntervalsTest.java | 5 + .../cardinality/EmptyCardinalityIntervalTest.java | 5 + .../cardinality/FiniteCardinalityIntervalTest.java | 5 + .../cardinality/FiniteUpperCardinalityTest.java | 5 + .../cardinality/UpperCardinalitiesTest.java | 5 + .../cardinality/UpperCardinalityTest.java | 5 + .../refinery/store/util/CollectionsUtilTests.java | 5 + yarn.lock.license | 3 + 569 files changed, 3406 insertions(+), 253 deletions(-) create mode 100644 .reuse/dep5 create mode 100644 .yarn/sdks/integrations.yml.license create mode 100644 CONTRIBUTORS.md create mode 100644 LICENSES/Apache-2.0.txt create mode 100644 LICENSES/BSD-2-Clause.txt create mode 100644 LICENSES/CC0-1.0.txt create mode 100644 LICENSES/EPL-2.0.txt create mode 100644 LICENSES/MIT.txt create mode 100644 gradle/wrapper/gradle-wrapper.jar.license create mode 100644 gradle/wrapper/gradle-wrapper.properties.license create mode 100644 gradlew.bat.license create mode 100644 gradlew.license create mode 100644 subprojects/frontend/assets-src/favicon.svg.license create mode 100644 subprojects/frontend/assets-src/icon.svg.license create mode 100644 subprojects/frontend/assets-src/mask-icon.svg.license create mode 100644 subprojects/frontend/public/apple-touch-icon.png.license create mode 100644 subprojects/frontend/public/favicon-96x96.png.license create mode 100644 subprojects/frontend/public/favicon.png.license create mode 100644 subprojects/frontend/public/favicon.svg.license create mode 100644 subprojects/frontend/public/icon-192x192.png.license create mode 100644 subprojects/frontend/public/icon-512x512.png.license create mode 100644 subprojects/frontend/public/icon-any.svg.license create mode 100644 subprojects/frontend/public/mask-icon.svg.license create mode 100644 subprojects/language-model/META-INF/MANIFEST.MF.license create mode 100644 subprojects/language-model/problem.aird.license create mode 100644 subprojects/language-model/src/main/resources/model/problem.ecore.license create mode 100644 subprojects/language-model/src/main/resources/model/problem.genmodel.license create mode 100644 subprojects/store-query-viatra/NOTICE.md create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/view/FunctionView.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/view/NodeFunctionView.java create mode 100644 subprojects/store-query/src/main/java/tools/refinery/store/query/view/ViewImplication.java create mode 100644 yarn.lock.license (limited to 'subprojects/store/src/test') diff --git a/.editorconfig b/.editorconfig index 64f6b1ac..7e5e9f16 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2021-2023 The Refinery Authors +# +# SPDX-License-Identifier: EPL-2.0 + root = true [*] diff --git a/.gitattributes b/.gitattributes index edd224df..847ceced 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2021-2023 The Refinery Authors +# +# SPDX-License-Identifier: CC0-1.0 + .yarn/releases/** binary .yarn/plugins/** binary *.cjs eol=lf diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 64aa23e4..15c62e89 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2021-2023 The Refinery Authors +# +# SPDX-License-Identifier: EPL-2.0 + name: Build on: push: diff --git a/.gitignore b/.gitignore index 559618ab..3117507a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2021-2023 The Refinery Authors +# +# SPDX-License-Identifier: CC0-1.0 + *._trace .classpath .idea/ diff --git a/.reuse/dep5 b/.reuse/dep5 new file mode 100644 index 00000000..523ac368 --- /dev/null +++ b/.reuse/dep5 @@ -0,0 +1,29 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: Refinery +Upstream-Contact: Dániel Varró +Source: https://github.com/graphs4value/refinery + +# Sample paragraph, commented out: +# +# Files: src/* +# Copyright: $YEAR $NAME <$CONTACT> +# License: ... + +Files: .yarn/releases/*.cjs +Copyright: (c) 2016-present, Yarn Contributors. All rights reserved. + (c) 2014-present, Jon Schlinkert. + (c) 2014-2016, Jon Schlinkert. + (c) 2014-2017, Jon Schlinkert. + © 2015-2018, Jon Schlinkert. + (c) 2015-present, Jon Schlinkert. + (c) 2015, Rebecca Turner + Joyent, Inc. and other Node contributors. + Node.js contributors. All rights reserved. + (c) 2014 Blake Embrey (hello@blakeembrey.com) + (c) Facebook, Inc. and its affiliates. +License: BSD-2-Clause AND MIT + +Files: .yarn/sdks/eslint/* + .yarn/sdks/typescript/* +Copyright: (c) 2016-present, Yarn Contributors. All rights reserved. +License: BSD-2-Clause diff --git a/.vscode/extensions.json b/.vscode/extensions.json index fa381855..8ff62a2a 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: CC0-1.0 + */ { "recommendations": [ "EditorConfig.EditorConfig", diff --git a/.vscode/settings.json b/.vscode/settings.json index 66e5806b..52d43dba 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: CC0-1.0 + */ { "search.exclude": { "**/.yarn": true, diff --git a/.yarn/sdks/integrations.yml.license b/.yarn/sdks/integrations.yml.license new file mode 100644 index 00000000..08673e9c --- /dev/null +++ b/.yarn/sdks/integrations.yml.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + +SPDX-License-Identifier: CC0-1.0 diff --git a/.yarnrc.yml b/.yarnrc.yml index 37765fad..5b46a42b 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -1,6 +1,10 @@ +# SPDX-FileCopyrightText: 2021-2023 The Refinery Authors +# +# SPDX-License-Identifier: EPL-2.0 + enableGlobalCache: false -enableTelemetry: 0 +enableTelemetry: false nodeLinker: pnp diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md new file mode 100644 index 00000000..a408945b --- /dev/null +++ b/CONTRIBUTORS.md @@ -0,0 +1,28 @@ + + +# Contributors + +## The Refinery Authors + +**Project leader:** [Prof. Dániel Varró](https://liu.se/en/employee/danva91) <daniel.varro@liu.se> + +Other contributors (in alphabetical order): + +* Ficsor, Attila <ficsorattila96@gmail.com> +* Garami, Bence <85867500+garamibence@users.noreply.github.com> +* Golej, Márton Marcell <golejmarci@gmail.com> +* Marussy, Kristóf <marussy@mit.bme.hu> +* Semeráth, Oszkár <semerath@mit.bme.hu> + +## Support + +Refinery was also supported by + +* [Budapest University of Technology and Economics (BME)](https://www.bme.hu/?language=en), [Department of Measurement and Information Systems (MIT)](https://mit.bme.hu/eng/), [Critical Systems Research Group (FTSRG)](https://ftsrg.mit.bme.hu/en/) +* [Department of Electrical and Computer Engineering](https://www.mcgill.ca/ece/), [McGill University](https://www.mcgill.ca/) +* [2022 Amazon Research Awards](https://www.amazon.science/research-awards/recipients/daniel-varro-fall-2021) +* [Linköping University](https://liu.se/en), [Department of Computer and Information Science (IDA)](https://liu.se/en/organisation/liu/ida), [Software and Systems (SAS)](https://liu.se/en/organisation/liu/ida/sas) diff --git a/LICENSE b/LICENSE index c43ced49..78756b5e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,278 +1,80 @@ Eclipse Public License - v 2.0 - - THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE - PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION - OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (“AGREEMENT”). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 1. DEFINITIONS +“Contribution” means: -"Contribution" means: - - a) in the case of the initial Contributor, the initial content - Distributed under this Agreement, and - - b) in the case of each subsequent Contributor: - i) changes to the Program, and - ii) additions to the Program; - where such changes and/or additions to the Program originate from - and are Distributed by that particular Contributor. A Contribution - "originates" from a Contributor if it was added to the Program by - such Contributor itself or anyone acting on such Contributor's behalf. - Contributions do not include changes or additions to the Program that - are not Modified Works. +a) in the case of the initial Contributor, the initial content Distributed under this Agreement, and +b) in the case of each subsequent Contributor: +i) changes to the Program, and +ii) additions to the Program; +where such changes and/or additions to the Program originate from and are Distributed by that particular Contributor. A Contribution “originates” from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include changes or additions to the Program that are not Modified Works. +“Contributor” means any person or entity that Distributes the Program. -"Contributor" means any person or entity that Distributes the Program. +“Licensed Patents” mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. -"Licensed Patents" mean patent claims licensable by a Contributor which -are necessarily infringed by the use or sale of its Contribution alone -or when combined with the Program. +“Program” means the Contributions Distributed in accordance with this Agreement. -"Program" means the Contributions Distributed in accordance with this -Agreement. +“Recipient” means anyone who receives the Program under this Agreement or any Secondary License (as applicable), including Contributors. -"Recipient" means anyone who receives the Program under this Agreement -or any Secondary License (as applicable), including Contributors. +“Derivative Works” shall mean any work, whether in Source Code or other form, that is based on (or derived from) the Program and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. -"Derivative Works" shall mean any work, whether in Source Code or other -form, that is based on (or derived from) the Program and for which the -editorial revisions, annotations, elaborations, or other modifications -represent, as a whole, an original work of authorship. +“Modified Works” shall mean any work in Source Code or other form that results from an addition to, deletion from, or modification of the contents of the Program, including, for purposes of clarity any new file in Source Code form that contains any contents of the Program. Modified Works shall not include works that contain only declarations, interfaces, types, classes, structures, or files of the Program solely in each case in order to link to, bind by name, or subclass the Program or Modified Works thereof. -"Modified Works" shall mean any work in Source Code or other form that -results from an addition to, deletion from, or modification of the -contents of the Program, including, for purposes of clarity any new file -in Source Code form that contains any contents of the Program. Modified -Works shall not include works that contain only declarations, -interfaces, types, classes, structures, or files of the Program solely -in each case in order to link to, bind by name, or subclass the Program -or Modified Works thereof. +“Distribute” means the acts of a) distributing or b) making available in any manner that enables the transfer of a copy. -"Distribute" means the acts of a) distributing or b) making available -in any manner that enables the transfer of a copy. +“Source Code” means the form of a Program preferred for making modifications, including but not limited to software source code, documentation source, and configuration files. -"Source Code" means the form of a Program preferred for making -modifications, including but not limited to software source code, -documentation source, and configuration files. - -"Secondary License" means either the GNU General Public License, -Version 2.0, or any later versions of that license, including any -exceptions or additional permissions as identified by the initial -Contributor. +“Secondary License” means either the GNU General Public License, Version 2.0, or any later versions of that license, including any exceptions or additional permissions as identified by the initial Contributor. 2. GRANT OF RIGHTS - - a) Subject to the terms of this Agreement, each Contributor hereby - grants Recipient a non-exclusive, worldwide, royalty-free copyright - license to reproduce, prepare Derivative Works of, publicly display, - publicly perform, Distribute and sublicense the Contribution of such - Contributor, if any, and such Derivative Works. - - b) Subject to the terms of this Agreement, each Contributor hereby - grants Recipient a non-exclusive, worldwide, royalty-free patent - license under Licensed Patents to make, use, sell, offer to sell, - import and otherwise transfer the Contribution of such Contributor, - if any, in Source Code or other form. This patent license shall - apply to the combination of the Contribution and the Program if, at - the time the Contribution is added by the Contributor, such addition - of the Contribution causes such combination to be covered by the - Licensed Patents. The patent license shall not apply to any other - combinations which include the Contribution. No hardware per se is - licensed hereunder. - - c) Recipient understands that although each Contributor grants the - licenses to its Contributions set forth herein, no assurances are - provided by any Contributor that the Program does not infringe the - patent or other intellectual property rights of any other entity. - Each Contributor disclaims any liability to Recipient for claims - brought by any other entity based on infringement of intellectual - property rights or otherwise. As a condition to exercising the - rights and licenses granted hereunder, each Recipient hereby - assumes sole responsibility to secure any other intellectual - property rights needed, if any. For example, if a third party - patent license is required to allow Recipient to Distribute the - Program, it is Recipient's responsibility to acquire that license - before distributing the Program. - - d) Each Contributor represents that to its knowledge it has - sufficient copyright rights in its Contribution, if any, to grant - the copyright license set forth in this Agreement. - - e) Notwithstanding the terms of any Secondary License, no - Contributor makes additional grants to any Recipient (other than - those set forth in this Agreement) as a result of such Recipient's - receipt of the Program under the terms of a Secondary License - (if permitted under the terms of Section 3). - +a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, Distribute and sublicense the Contribution of such Contributor, if any, and such Derivative Works. +b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in Source Code or other form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. +c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to Distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. +d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. +e) Notwithstanding the terms of any Secondary License, no Contributor makes additional grants to any Recipient (other than those set forth in this Agreement) as a result of such Recipient's receipt of the Program under the terms of a Secondary License (if permitted under the terms of Section 3). 3. REQUIREMENTS - 3.1 If a Contributor Distributes the Program in any form, then: - a) the Program must also be made available as Source Code, in - accordance with section 3.2, and the Contributor must accompany - the Program with a statement that the Source Code for the Program - is available under this Agreement, and informs Recipients how to - obtain it in a reasonable manner on or through a medium customarily - used for software exchange; and - - b) the Contributor may Distribute the Program under a license - different than this Agreement, provided that such license: - i) effectively disclaims on behalf of all other Contributors all - warranties and conditions, express and implied, including - warranties or conditions of title and non-infringement, and - implied warranties or conditions of merchantability and fitness - for a particular purpose; - - ii) effectively excludes on behalf of all other Contributors all - liability for damages, including direct, indirect, special, - incidental and consequential damages, such as lost profits; - - iii) does not attempt to limit or alter the recipients' rights - in the Source Code under section 3.2; and - - iv) requires any subsequent distribution of the Program by any - party to be under a license that satisfies the requirements - of this section 3. - +a) the Program must also be made available as Source Code, in accordance with section 3.2, and the Contributor must accompany the Program with a statement that the Source Code for the Program is available under this Agreement, and informs Recipients how to obtain it in a reasonable manner on or through a medium customarily used for software exchange; and +b) the Contributor may Distribute the Program under a license different than this Agreement, provided that such license: +i) effectively disclaims on behalf of all other Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; +ii) effectively excludes on behalf of all other Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; +iii) does not attempt to limit or alter the recipients' rights in the Source Code under section 3.2; and +iv) requires any subsequent distribution of the Program by any party to be under a license that satisfies the requirements of this section 3. 3.2 When the Program is Distributed as Source Code: - a) it must be made available under this Agreement, or if the - Program (i) is combined with other material in a separate file or - files made available under a Secondary License, and (ii) the initial - Contributor attached to the Source Code the notice described in - Exhibit A of this Agreement, then the Program may be made available - under the terms of such Secondary Licenses, and - - b) a copy of this Agreement must be included with each copy of - the Program. - -3.3 Contributors may not remove or alter any copyright, patent, -trademark, attribution notices, disclaimers of warranty, or limitations -of liability ("notices") contained within the Program from any copy of -the Program which they Distribute, provided that Contributors may add -their own appropriate notices. +a) it must be made available under this Agreement, or if the Program (i) is combined with other material in a separate file or files made available under a Secondary License, and (ii) the initial Contributor attached to the Source Code the notice described in Exhibit A of this Agreement, then the Program may be made available under the terms of such Secondary Licenses, and +b) a copy of this Agreement must be included with each copy of the Program. +3.3 Contributors may not remove or alter any copyright, patent, trademark, attribution notices, disclaimers of warranty, or limitations of liability (‘notices’) contained within the Program from any copy of the Program which they Distribute, provided that Contributors may add their own appropriate notices. 4. COMMERCIAL DISTRIBUTION +Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor (“Commercial Contributor”) hereby agrees to defend and indemnify every other Contributor (“Indemnified Contributor”) against any losses, damages and costs (collectively “Losses”) arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. -Commercial distributors of software may accept certain responsibilities -with respect to end users, business partners and the like. While this -license is intended to facilitate the commercial use of the Program, -the Contributor who includes the Program in a commercial product -offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes -the Program in a commercial product offering, such Contributor -("Commercial Contributor") hereby agrees to defend and indemnify every -other Contributor ("Indemnified Contributor") against any losses, -damages and costs (collectively "Losses") arising from claims, lawsuits -and other legal actions brought by a third party against the Indemnified -Contributor to the extent caused by the acts or omissions of such -Commercial Contributor in connection with its distribution of the Program -in a commercial product offering. The obligations in this section do not -apply to any claims or Losses relating to any actual or alleged -intellectual property infringement. In order to qualify, an Indemnified -Contributor must: a) promptly notify the Commercial Contributor in -writing of such claim, and b) allow the Commercial Contributor to control, -and cooperate with the Commercial Contributor in, the defense and any -related settlement negotiations. The Indemnified Contributor may -participate in any such claim at its own expense. - -For example, a Contributor might include the Program in a commercial -product offering, Product X. That Contributor is then a Commercial -Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance -claims and warranties are such Commercial Contributor's responsibility -alone. Under this section, the Commercial Contributor would have to -defend claims against the other Contributors related to those performance -claims and warranties, and if a court requires any other Contributor to -pay any damages as a result, the Commercial Contributor must pay -those damages. +For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. 5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT -PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS" -BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR -IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF -TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR -PURPOSE. Each Recipient is solely responsible for determining the -appropriateness of using and distributing the Program and assumes all -risks associated with its exercise of rights under this Agreement, -including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs -or equipment, and unavailability or interruption of operations. +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. 6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT -PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS -SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST -PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE -EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 7. GENERAL +If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. -If any provision of this Agreement is invalid or unenforceable under -applicable law, it shall not affect the validity or enforceability of -the remainder of the terms of this Agreement, and without further -action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity -(including a cross-claim or counterclaim in a lawsuit) alleging that the -Program itself (excluding combinations of the Program with other software -or hardware) infringes such Recipient's patent(s), then such Recipient's -rights granted under Section 2(b) shall terminate as of the date such -litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it -fails to comply with any of the material terms or conditions of this -Agreement and does not cure such failure in a reasonable period of -time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use -and distribution of the Program as soon as reasonably practicable. -However, Recipient's obligations under this Agreement and any licenses -granted by Recipient relating to the Program shall continue and survive. - -Everyone is permitted to copy and distribute copies of this Agreement, -but in order to avoid inconsistency the Agreement is copyrighted and -may only be modified in the following manner. The Agreement Steward -reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement -Steward has the right to modify this Agreement. The Eclipse Foundation -is the initial Agreement Steward. The Eclipse Foundation may assign the -responsibility to serve as the Agreement Steward to a suitable separate -entity. Each new version of the Agreement will be given a distinguishing -version number. The Program (including Contributions) may always be -Distributed subject to the version of the Agreement under which it was -received. In addition, after a new version of the Agreement is published, -Contributor may elect to Distribute the Program (including its -Contributions) under the new version. +If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. -Except as expressly stated in Sections 2(a) and 2(b) above, Recipient -receives no rights or licenses to the intellectual property of any -Contributor under this Agreement, whether expressly, by implication, -estoppel or otherwise. All rights in the Program not expressly granted -under this Agreement are reserved. Nothing in this Agreement is intended -to be enforceable by any entity that is not a Contributor or Recipient. -No third-party beneficiary rights are created under this Agreement. +All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. -Exhibit A - Form of Secondary Licenses Notice +Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be Distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to Distribute the Program (including its Contributions) under the new version. -"This Source Code may also be made available under the following -Secondary Licenses when the conditions for such availability set forth -in the Eclipse Public License, v. 2.0 are satisfied: {name license(s), -version(s), and exceptions or additional permissions here}." +Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. Nothing in this Agreement is intended to be enforceable by any entity that is not a Contributor or Recipient. No third-party beneficiary rights are created under this Agreement. - Simply including a copy of this Agreement, including this Exhibit A - is not sufficient to license the Source Code under Secondary Licenses. +Exhibit A – Form of Secondary Licenses Notice +“This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: {name license(s), version(s), and exceptions or additional permissions here}.” - If it is not possible or desirable to put the notice in a particular - file, then You may include the notice in a location (such as a LICENSE - file in a relevant directory) where a recipient would be likely to - look for such a notice. +Simply including a copy of this Agreement, including this Exhibit A is not sufficient to license the Source Code under Secondary Licenses. - You may add additional accurate notices of copyright ownership. +If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice. +You may add additional accurate notices of copyright ownership. diff --git a/LICENSES/Apache-2.0.txt b/LICENSES/Apache-2.0.txt new file mode 100644 index 00000000..137069b8 --- /dev/null +++ b/LICENSES/Apache-2.0.txt @@ -0,0 +1,73 @@ +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + + (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + + You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + +To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/LICENSES/BSD-2-Clause.txt b/LICENSES/BSD-2-Clause.txt new file mode 100644 index 00000000..5f662b35 --- /dev/null +++ b/LICENSES/BSD-2-Clause.txt @@ -0,0 +1,9 @@ +Copyright (c) + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/LICENSES/CC0-1.0.txt b/LICENSES/CC0-1.0.txt new file mode 100644 index 00000000..0e259d42 --- /dev/null +++ b/LICENSES/CC0-1.0.txt @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. diff --git a/LICENSES/EPL-2.0.txt b/LICENSES/EPL-2.0.txt new file mode 100644 index 00000000..78756b5e --- /dev/null +++ b/LICENSES/EPL-2.0.txt @@ -0,0 +1,80 @@ +Eclipse Public License - v 2.0 +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (“AGREEMENT”). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS +“Contribution” means: + +a) in the case of the initial Contributor, the initial content Distributed under this Agreement, and +b) in the case of each subsequent Contributor: +i) changes to the Program, and +ii) additions to the Program; +where such changes and/or additions to the Program originate from and are Distributed by that particular Contributor. A Contribution “originates” from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include changes or additions to the Program that are not Modified Works. +“Contributor” means any person or entity that Distributes the Program. + +“Licensed Patents” mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. + +“Program” means the Contributions Distributed in accordance with this Agreement. + +“Recipient” means anyone who receives the Program under this Agreement or any Secondary License (as applicable), including Contributors. + +“Derivative Works” shall mean any work, whether in Source Code or other form, that is based on (or derived from) the Program and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. + +“Modified Works” shall mean any work in Source Code or other form that results from an addition to, deletion from, or modification of the contents of the Program, including, for purposes of clarity any new file in Source Code form that contains any contents of the Program. Modified Works shall not include works that contain only declarations, interfaces, types, classes, structures, or files of the Program solely in each case in order to link to, bind by name, or subclass the Program or Modified Works thereof. + +“Distribute” means the acts of a) distributing or b) making available in any manner that enables the transfer of a copy. + +“Source Code” means the form of a Program preferred for making modifications, including but not limited to software source code, documentation source, and configuration files. + +“Secondary License” means either the GNU General Public License, Version 2.0, or any later versions of that license, including any exceptions or additional permissions as identified by the initial Contributor. + +2. GRANT OF RIGHTS +a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, Distribute and sublicense the Contribution of such Contributor, if any, and such Derivative Works. +b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in Source Code or other form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. +c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to Distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. +d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. +e) Notwithstanding the terms of any Secondary License, no Contributor makes additional grants to any Recipient (other than those set forth in this Agreement) as a result of such Recipient's receipt of the Program under the terms of a Secondary License (if permitted under the terms of Section 3). +3. REQUIREMENTS +3.1 If a Contributor Distributes the Program in any form, then: + +a) the Program must also be made available as Source Code, in accordance with section 3.2, and the Contributor must accompany the Program with a statement that the Source Code for the Program is available under this Agreement, and informs Recipients how to obtain it in a reasonable manner on or through a medium customarily used for software exchange; and +b) the Contributor may Distribute the Program under a license different than this Agreement, provided that such license: +i) effectively disclaims on behalf of all other Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; +ii) effectively excludes on behalf of all other Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; +iii) does not attempt to limit or alter the recipients' rights in the Source Code under section 3.2; and +iv) requires any subsequent distribution of the Program by any party to be under a license that satisfies the requirements of this section 3. +3.2 When the Program is Distributed as Source Code: + +a) it must be made available under this Agreement, or if the Program (i) is combined with other material in a separate file or files made available under a Secondary License, and (ii) the initial Contributor attached to the Source Code the notice described in Exhibit A of this Agreement, then the Program may be made available under the terms of such Secondary Licenses, and +b) a copy of this Agreement must be included with each copy of the Program. +3.3 Contributors may not remove or alter any copyright, patent, trademark, attribution notices, disclaimers of warranty, or limitations of liability (‘notices’) contained within the Program from any copy of the Program which they Distribute, provided that Contributors may add their own appropriate notices. + +4. COMMERCIAL DISTRIBUTION +Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor (“Commercial Contributor”) hereby agrees to defend and indemnify every other Contributor (“Indemnified Contributor”) against any losses, damages and costs (collectively “Losses”) arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. + +5. NO WARRANTY +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL +If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be Distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to Distribute the Program (including its Contributions) under the new version. + +Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. Nothing in this Agreement is intended to be enforceable by any entity that is not a Contributor or Recipient. No third-party beneficiary rights are created under this Agreement. + +Exhibit A – Form of Secondary Licenses Notice +“This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: {name license(s), version(s), and exceptions or additional permissions here}.” + +Simply including a copy of this Agreement, including this Exhibit A is not sufficient to license the Source Code under Secondary Licenses. + +If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice. + +You may add additional accurate notices of copyright ownership. diff --git a/LICENSES/MIT.txt b/LICENSES/MIT.txt new file mode 100644 index 00000000..2071b23b --- /dev/null +++ b/LICENSES/MIT.txt @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index 33d89786..4dbc3bf5 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ + + # Refinery [![Build](https://github.com/graphs4value/refinery/actions/workflows/build.yml/badge.svg)](https://github.com/graphs4value/refinery/actions/workflows/build.yml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=graphs4value_refinery&metric=alert_status)](https://sonarcloud.io/dashboard?id=graphs4value_refinery) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=graphs4value_refinery&metric=coverage)](https://sonarcloud.io/dashboard?id=graphs4value_refinery) @@ -45,4 +51,9 @@ It is possible to import the project into IntelliJ IDEA, but it gives no editing ## License -All code in this repository is available under the [Eclipse Public License - v 2.0](https://www.eclipse.org/legal/epl-2.0/). +Copyright (c) 2021-2023 [The Refinery Authors](CONTRIBUTORS.md) + +Refinery is available under the [Eclipse Public License - v 2.0](https://www.eclipse.org/legal/epl-2.0/). + +Refinery complies with the [REUSE Specification – Version 3.0](https://reuse.software/) to provide copyright and licensing information to each file, including files available under other licenses. +For more information, see the comments headers in each file and the license texts in the [LICENSES](LICENSES/) directory. diff --git a/build.gradle.kts b/build.gradle.kts index 5a673f33..ed1c8aa6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + plugins { // Workaround for https://github.com/gradle/gradle/issues/22797 @Suppress("DSL_SCOPE_VIOLATION") diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 7a5ee5c4..90864a8f 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + plugins { `kotlin-dsl` // Workaround for https://github.com/gradle/gradle/issues/22797 diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts index 8e6efa3d..1daa9bbd 100644 --- a/buildSrc/settings.gradle.kts +++ b/buildSrc/settings.gradle.kts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + dependencyResolutionManagement { versionCatalogs { create("libs") { diff --git a/buildSrc/src/main/java/tools/refinery/gradle/utils/EclipseUtils.java b/buildSrc/src/main/java/tools/refinery/gradle/utils/EclipseUtils.java index 1e33a95d..ac7ba3f4 100644 --- a/buildSrc/src/main/java/tools/refinery/gradle/utils/EclipseUtils.java +++ b/buildSrc/src/main/java/tools/refinery/gradle/utils/EclipseUtils.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.gradle.utils; import groovy.lang.Closure; diff --git a/buildSrc/src/main/java/tools/refinery/gradle/utils/SonarPropertiesUtils.java b/buildSrc/src/main/java/tools/refinery/gradle/utils/SonarPropertiesUtils.java index 3810fccf..183cd56a 100644 --- a/buildSrc/src/main/java/tools/refinery/gradle/utils/SonarPropertiesUtils.java +++ b/buildSrc/src/main/java/tools/refinery/gradle/utils/SonarPropertiesUtils.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.gradle.utils; import java.util.ArrayList; diff --git a/buildSrc/src/main/kotlin/tools/refinery/gradle/eclipse.gradle.kts b/buildSrc/src/main/kotlin/tools/refinery/gradle/eclipse.gradle.kts index 25e7e573..8bab1d2b 100644 --- a/buildSrc/src/main/kotlin/tools/refinery/gradle/eclipse.gradle.kts +++ b/buildSrc/src/main/kotlin/tools/refinery/gradle/eclipse.gradle.kts @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.gradle import java.util.Properties diff --git a/buildSrc/src/main/kotlin/tools/refinery/gradle/frontend-workspace.gradle.kts b/buildSrc/src/main/kotlin/tools/refinery/gradle/frontend-workspace.gradle.kts index 174a2d65..f1f6d952 100644 --- a/buildSrc/src/main/kotlin/tools/refinery/gradle/frontend-workspace.gradle.kts +++ b/buildSrc/src/main/kotlin/tools/refinery/gradle/frontend-workspace.gradle.kts @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.gradle plugins { diff --git a/buildSrc/src/main/kotlin/tools/refinery/gradle/frontend-worktree.gradle.kts b/buildSrc/src/main/kotlin/tools/refinery/gradle/frontend-worktree.gradle.kts index 3225a1b1..218f5207 100644 --- a/buildSrc/src/main/kotlin/tools/refinery/gradle/frontend-worktree.gradle.kts +++ b/buildSrc/src/main/kotlin/tools/refinery/gradle/frontend-worktree.gradle.kts @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.gradle import java.io.FileInputStream diff --git a/buildSrc/src/main/kotlin/tools/refinery/gradle/internal/frontend-conventions.gradle.kts b/buildSrc/src/main/kotlin/tools/refinery/gradle/internal/frontend-conventions.gradle.kts index b15de515..bd5d0197 100644 --- a/buildSrc/src/main/kotlin/tools/refinery/gradle/internal/frontend-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/tools/refinery/gradle/internal/frontend-conventions.gradle.kts @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.gradle.internal plugins { diff --git a/buildSrc/src/main/kotlin/tools/refinery/gradle/internal/java-conventions.gradle.kts b/buildSrc/src/main/kotlin/tools/refinery/gradle/internal/java-conventions.gradle.kts index 67bb5d88..d8deffae 100644 --- a/buildSrc/src/main/kotlin/tools/refinery/gradle/internal/java-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/tools/refinery/gradle/internal/java-conventions.gradle.kts @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.gradle.internal import org.gradle.accessors.dm.LibrariesForLibs diff --git a/buildSrc/src/main/kotlin/tools/refinery/gradle/java-application.gradle.kts b/buildSrc/src/main/kotlin/tools/refinery/gradle/java-application.gradle.kts index 269af11c..0924311b 100644 --- a/buildSrc/src/main/kotlin/tools/refinery/gradle/java-application.gradle.kts +++ b/buildSrc/src/main/kotlin/tools/refinery/gradle/java-application.gradle.kts @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.gradle import org.gradle.accessors.dm.LibrariesForLibs diff --git a/buildSrc/src/main/kotlin/tools/refinery/gradle/java-library.gradle.kts b/buildSrc/src/main/kotlin/tools/refinery/gradle/java-library.gradle.kts index 084f65ae..3aff3833 100644 --- a/buildSrc/src/main/kotlin/tools/refinery/gradle/java-library.gradle.kts +++ b/buildSrc/src/main/kotlin/tools/refinery/gradle/java-library.gradle.kts @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.gradle plugins { diff --git a/buildSrc/src/main/kotlin/tools/refinery/gradle/java-test-fixtures.gradle.kts b/buildSrc/src/main/kotlin/tools/refinery/gradle/java-test-fixtures.gradle.kts index 7e599c3f..a28484d4 100644 --- a/buildSrc/src/main/kotlin/tools/refinery/gradle/java-test-fixtures.gradle.kts +++ b/buildSrc/src/main/kotlin/tools/refinery/gradle/java-test-fixtures.gradle.kts @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.gradle import org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry diff --git a/buildSrc/src/main/kotlin/tools/refinery/gradle/jmh.gradle.kts b/buildSrc/src/main/kotlin/tools/refinery/gradle/jmh.gradle.kts index eda7d5c6..6fb8fbac 100644 --- a/buildSrc/src/main/kotlin/tools/refinery/gradle/jmh.gradle.kts +++ b/buildSrc/src/main/kotlin/tools/refinery/gradle/jmh.gradle.kts @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.gradle import org.gradle.accessors.dm.LibrariesForLibs diff --git a/buildSrc/src/main/kotlin/tools/refinery/gradle/mwe2.gradle.kts b/buildSrc/src/main/kotlin/tools/refinery/gradle/mwe2.gradle.kts index 8eeabf47..f4381434 100644 --- a/buildSrc/src/main/kotlin/tools/refinery/gradle/mwe2.gradle.kts +++ b/buildSrc/src/main/kotlin/tools/refinery/gradle/mwe2.gradle.kts @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.gradle import org.gradle.accessors.dm.LibrariesForLibs diff --git a/buildSrc/src/main/kotlin/tools/refinery/gradle/sonarqube.gradle.kts b/buildSrc/src/main/kotlin/tools/refinery/gradle/sonarqube.gradle.kts index ebd9170a..93406492 100644 --- a/buildSrc/src/main/kotlin/tools/refinery/gradle/sonarqube.gradle.kts +++ b/buildSrc/src/main/kotlin/tools/refinery/gradle/sonarqube.gradle.kts @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.gradle plugins { diff --git a/buildSrc/src/main/kotlin/tools/refinery/gradle/xtext-generated.gradle.kts b/buildSrc/src/main/kotlin/tools/refinery/gradle/xtext-generated.gradle.kts index 25aeb826..59fe921b 100644 --- a/buildSrc/src/main/kotlin/tools/refinery/gradle/xtext-generated.gradle.kts +++ b/buildSrc/src/main/kotlin/tools/refinery/gradle/xtext-generated.gradle.kts @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.gradle import tools.refinery.gradle.utils.SonarPropertiesUtils diff --git a/gradle.properties b/gradle.properties index 8faaa0eb..d6faa150 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2021-2023 The Refinery Authors +# +# SPDX-License-Identifier: EPL-2.0 + file.encoding=UTF-8 frontend.nodeVersion=18.15.0 frontend.yarnVersion=4.0.0-rc.42 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index fe5966af..113bf3a5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2021-2023 The Refinery Authors +# +# SPDX-License-Identifier: EPL-2.0 + [versions] eclipseCollections = "12.0.0.M1" jetty = "12.0.0.beta0" diff --git a/gradle/wrapper/gradle-wrapper.jar.license b/gradle/wrapper/gradle-wrapper.jar.license new file mode 100644 index 00000000..13cd9906 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.jar.license @@ -0,0 +1,3 @@ +Copyright © 2015-2021 the original authors. + +SPDX-License-Identifier: Apache-2.0 diff --git a/gradle/wrapper/gradle-wrapper.properties.license b/gradle/wrapper/gradle-wrapper.properties.license new file mode 100644 index 00000000..13cd9906 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties.license @@ -0,0 +1,3 @@ +Copyright © 2015-2021 the original authors. + +SPDX-License-Identifier: Apache-2.0 diff --git a/gradlew.bat.license b/gradlew.bat.license new file mode 100644 index 00000000..0bcf26f6 --- /dev/null +++ b/gradlew.bat.license @@ -0,0 +1,3 @@ +Copyright 2015 the original author or authors. + +SPDX-License-Identifier: Apache-2.0 diff --git a/gradlew.license b/gradlew.license new file mode 100644 index 00000000..13cd9906 --- /dev/null +++ b/gradlew.license @@ -0,0 +1,3 @@ +Copyright © 2015-2021 the original authors. + +SPDX-License-Identifier: Apache-2.0 diff --git a/package.json b/package.json index 2da37157..c714ecd0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,22 @@ { + "//": [ + "SPDX-FileCopyrightText: 2021-2023 The Refinery Authors ", + "", + "SPDX-License-Identifier: EPL-2.0" + ], "name": "@refinery/root", "version": "0.0.0", "private": true, + "repository": { + "type": "git", + "url": "git+https://github.com/graphs4value/refinery.git" + }, + "author": "The Refinery Authors ", + "license": "EPL-2.0", + "bugs": { + "url": "https://github.com/graphs4value/refinery/issues" + }, + "homepage": "https://refinery.tools", "workspaces": [ "subprojects/frontend" ], diff --git a/settings.gradle.kts b/settings.gradle.kts index cca283dc..2b1c179d 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + rootProject.name = "refinery" include( diff --git a/subprojects/frontend/.eslintrc.cjs b/subprojects/frontend/.eslintrc.cjs index dc03d721..466e5668 100644 --- a/subprojects/frontend/.eslintrc.cjs +++ b/subprojects/frontend/.eslintrc.cjs @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + const path = require('node:path'); // Allow the Codium ESLint plugin to find `tsconfig.json` from the repository root. diff --git a/subprojects/frontend/assets-src/favicon.svg.license b/subprojects/frontend/assets-src/favicon.svg.license new file mode 100644 index 00000000..e5db6ccd --- /dev/null +++ b/subprojects/frontend/assets-src/favicon.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + +SPDX-License-Identifier: EPL-2.0 diff --git a/subprojects/frontend/assets-src/icon.svg.license b/subprojects/frontend/assets-src/icon.svg.license new file mode 100644 index 00000000..e5db6ccd --- /dev/null +++ b/subprojects/frontend/assets-src/icon.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + +SPDX-License-Identifier: EPL-2.0 diff --git a/subprojects/frontend/assets-src/mask-icon.svg.license b/subprojects/frontend/assets-src/mask-icon.svg.license new file mode 100644 index 00000000..e5db6ccd --- /dev/null +++ b/subprojects/frontend/assets-src/mask-icon.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + +SPDX-License-Identifier: EPL-2.0 diff --git a/subprojects/frontend/build.gradle.kts b/subprojects/frontend/build.gradle.kts index 80f10f7e..9fd99742 100644 --- a/subprojects/frontend/build.gradle.kts +++ b/subprojects/frontend/build.gradle.kts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import org.siouan.frontendgradleplugin.infrastructure.gradle.RunYarn import tools.refinery.gradle.utils.SonarPropertiesUtils diff --git a/subprojects/frontend/config/backendConfigVitePlugin.ts b/subprojects/frontend/config/backendConfigVitePlugin.ts index 7a6bc3db..3bffce3a 100644 --- a/subprojects/frontend/config/backendConfigVitePlugin.ts +++ b/subprojects/frontend/config/backendConfigVitePlugin.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import type { PluginOption } from 'vite'; import type BackendConfig from '../src/xtext/BackendConfig'; diff --git a/subprojects/frontend/config/detectDevModeOptions.ts b/subprojects/frontend/config/detectDevModeOptions.ts index b3696241..665204dc 100644 --- a/subprojects/frontend/config/detectDevModeOptions.ts +++ b/subprojects/frontend/config/detectDevModeOptions.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import type { PluginOption, ServerOptions } from 'vite'; import backendConfigVitePlugin, { diff --git a/subprojects/frontend/config/eslintReport.cjs b/subprojects/frontend/config/eslintReport.cjs index 5bf6a041..7c4b7bd6 100644 --- a/subprojects/frontend/config/eslintReport.cjs +++ b/subprojects/frontend/config/eslintReport.cjs @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + const { writeFile } = require('node:fs/promises'); const path = require('node:path'); const { Readable } = require('node:stream'); diff --git a/subprojects/frontend/config/fetchPackageMetadata.ts b/subprojects/frontend/config/fetchPackageMetadata.ts index 50807b03..02e16d57 100644 --- a/subprojects/frontend/config/fetchPackageMetadata.ts +++ b/subprojects/frontend/config/fetchPackageMetadata.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import { readFile } from 'node:fs/promises'; import path from 'node:path'; diff --git a/subprojects/frontend/config/manifest.ts b/subprojects/frontend/config/manifest.ts index 3cec777c..1822dc7c 100644 --- a/subprojects/frontend/config/manifest.ts +++ b/subprojects/frontend/config/manifest.ts @@ -1,10 +1,16 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import type { ManifestOptions } from 'vite-plugin-pwa'; const manifest: Partial = { lang: 'en-US', name: 'Refinery', short_name: 'Refinery', - description: 'An efficient graph sovler for generating well-formed models', + description: 'An efficient graph solver for generating well-formed models', theme_color: '#f5f5f5', display_override: ['window-controls-overlay'], display: 'standalone', diff --git a/subprojects/frontend/config/minifyHTMLVitePlugin.ts b/subprojects/frontend/config/minifyHTMLVitePlugin.ts index 18336d4d..7c08c488 100644 --- a/subprojects/frontend/config/minifyHTMLVitePlugin.ts +++ b/subprojects/frontend/config/minifyHTMLVitePlugin.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import { minify, type Options as TerserOptions } from 'html-minifier-terser'; import type { PluginOption } from 'vite'; diff --git a/subprojects/frontend/config/preloadFontsVitePlugin.ts b/subprojects/frontend/config/preloadFontsVitePlugin.ts index bc6f8eaf..5c04477a 100644 --- a/subprojects/frontend/config/preloadFontsVitePlugin.ts +++ b/subprojects/frontend/config/preloadFontsVitePlugin.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import micromatch from 'micromatch'; import type { PluginOption } from 'vite'; diff --git a/subprojects/frontend/index.html b/subprojects/frontend/index.html index 8b6814eb..e1d2bf14 100644 --- a/subprojects/frontend/index.html +++ b/subprojects/frontend/index.html @@ -1,4 +1,9 @@ + diff --git a/subprojects/frontend/package.json b/subprojects/frontend/package.json index e6bcc89e..cd96a574 100644 --- a/subprojects/frontend/package.json +++ b/subprojects/frontend/package.json @@ -1,4 +1,9 @@ { + "//": [ + "SPDX-FileCopyrightText: 2021-2023 The Refinery Authors ", + "", + "SPDX-License-Identifier: EPL-2.0" + ], "name": "@refinery/frontend", "version": "0.0.0", "description": "Web frontend for Refinery", @@ -16,10 +21,10 @@ "type": "git", "url": "git+https://github.com/graphs4value/refinery.git" }, - "author": "Refinery authors", + "author": "The Refinery Authors ", "license": "EPL-2.0", "bugs": { - "url": "https://github.com/graphs4value/issues" + "url": "https://github.com/graphs4value/refinery/issues" }, "homepage": "https://refinery.tools", "dependencies": { diff --git a/subprojects/frontend/prettier.config.cjs b/subprojects/frontend/prettier.config.cjs index 75f5c54d..6f9ff7ad 100644 --- a/subprojects/frontend/prettier.config.cjs +++ b/subprojects/frontend/prettier.config.cjs @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + /** @type {import('prettier').Config} */ module.exports = { singleQuote: true, diff --git a/subprojects/frontend/public/apple-touch-icon.png.license b/subprojects/frontend/public/apple-touch-icon.png.license new file mode 100644 index 00000000..e5db6ccd --- /dev/null +++ b/subprojects/frontend/public/apple-touch-icon.png.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + +SPDX-License-Identifier: EPL-2.0 diff --git a/subprojects/frontend/public/favicon-96x96.png.license b/subprojects/frontend/public/favicon-96x96.png.license new file mode 100644 index 00000000..e5db6ccd --- /dev/null +++ b/subprojects/frontend/public/favicon-96x96.png.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + +SPDX-License-Identifier: EPL-2.0 diff --git a/subprojects/frontend/public/favicon.png.license b/subprojects/frontend/public/favicon.png.license new file mode 100644 index 00000000..e5db6ccd --- /dev/null +++ b/subprojects/frontend/public/favicon.png.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + +SPDX-License-Identifier: EPL-2.0 diff --git a/subprojects/frontend/public/favicon.svg.license b/subprojects/frontend/public/favicon.svg.license new file mode 100644 index 00000000..e5db6ccd --- /dev/null +++ b/subprojects/frontend/public/favicon.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + +SPDX-License-Identifier: EPL-2.0 diff --git a/subprojects/frontend/public/icon-192x192.png.license b/subprojects/frontend/public/icon-192x192.png.license new file mode 100644 index 00000000..e5db6ccd --- /dev/null +++ b/subprojects/frontend/public/icon-192x192.png.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + +SPDX-License-Identifier: EPL-2.0 diff --git a/subprojects/frontend/public/icon-512x512.png.license b/subprojects/frontend/public/icon-512x512.png.license new file mode 100644 index 00000000..e5db6ccd --- /dev/null +++ b/subprojects/frontend/public/icon-512x512.png.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + +SPDX-License-Identifier: EPL-2.0 diff --git a/subprojects/frontend/public/icon-any.svg.license b/subprojects/frontend/public/icon-any.svg.license new file mode 100644 index 00000000..e5db6ccd --- /dev/null +++ b/subprojects/frontend/public/icon-any.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + +SPDX-License-Identifier: EPL-2.0 diff --git a/subprojects/frontend/public/mask-icon.svg.license b/subprojects/frontend/public/mask-icon.svg.license new file mode 100644 index 00000000..e5db6ccd --- /dev/null +++ b/subprojects/frontend/public/mask-icon.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + +SPDX-License-Identifier: EPL-2.0 diff --git a/subprojects/frontend/public/robots.txt b/subprojects/frontend/public/robots.txt index c2a49f4f..e7c73099 100644 --- a/subprojects/frontend/public/robots.txt +++ b/subprojects/frontend/public/robots.txt @@ -1,2 +1,6 @@ +# SPDX-FileCopyrightText: 2021-2023 The Refinery Authors +# +# SPDX-License-Identifier: CC0-1.0 + User-agent: * Allow: / diff --git a/subprojects/frontend/src/App.tsx b/subprojects/frontend/src/App.tsx index cd394345..7f242529 100644 --- a/subprojects/frontend/src/App.tsx +++ b/subprojects/frontend/src/App.tsx @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import Box from '@mui/material/Box'; import CssBaseline from '@mui/material/CssBaseline'; import { throttle } from 'lodash-es'; diff --git a/subprojects/frontend/src/Loading.tsx b/subprojects/frontend/src/Loading.tsx index 489563e0..adee4f0e 100644 --- a/subprojects/frontend/src/Loading.tsx +++ b/subprojects/frontend/src/Loading.tsx @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import CircularProgress from '@mui/material/CircularProgress'; import { styled } from '@mui/material/styles'; diff --git a/subprojects/frontend/src/PWAStore.ts b/subprojects/frontend/src/PWAStore.ts index e9f99e2a..a1b3ffd9 100644 --- a/subprojects/frontend/src/PWAStore.ts +++ b/subprojects/frontend/src/PWAStore.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import { makeAutoObservable, observable } from 'mobx'; import ms from 'ms'; // eslint-disable-next-line import/no-unresolved -- Importing virtual module. diff --git a/subprojects/frontend/src/Refinery.tsx b/subprojects/frontend/src/Refinery.tsx index f0162349..b5ff94e1 100644 --- a/subprojects/frontend/src/Refinery.tsx +++ b/subprojects/frontend/src/Refinery.tsx @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import Grow from '@mui/material/Grow'; import Stack from '@mui/material/Stack'; import { SnackbarProvider } from 'notistack'; diff --git a/subprojects/frontend/src/RootStore.ts b/subprojects/frontend/src/RootStore.ts index 2e76d66d..b84c0ce0 100644 --- a/subprojects/frontend/src/RootStore.ts +++ b/subprojects/frontend/src/RootStore.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import { getLogger } from 'loglevel'; import { makeAutoObservable, runInAction } from 'mobx'; diff --git a/subprojects/frontend/src/RootStoreProvider.tsx b/subprojects/frontend/src/RootStoreProvider.tsx index 2c11a0f9..7cb89af1 100644 --- a/subprojects/frontend/src/RootStoreProvider.tsx +++ b/subprojects/frontend/src/RootStoreProvider.tsx @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import { type ReactNode, createContext, useContext } from 'react'; import type RootStore from './RootStore'; diff --git a/subprojects/frontend/src/ToggleDarkModeButton.tsx b/subprojects/frontend/src/ToggleDarkModeButton.tsx index 59714f20..7a835e61 100644 --- a/subprojects/frontend/src/ToggleDarkModeButton.tsx +++ b/subprojects/frontend/src/ToggleDarkModeButton.tsx @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import DarkModeIcon from '@mui/icons-material/DarkMode'; import LightModeIcon from '@mui/icons-material/LightMode'; import IconButton from '@mui/material/IconButton'; diff --git a/subprojects/frontend/src/TopBar.tsx b/subprojects/frontend/src/TopBar.tsx index 5a825512..f2542b14 100644 --- a/subprojects/frontend/src/TopBar.tsx +++ b/subprojects/frontend/src/TopBar.tsx @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import GitHubIcon from '@mui/icons-material/GitHub'; import AppBar from '@mui/material/AppBar'; import Button from '@mui/material/Button'; diff --git a/subprojects/frontend/src/UpdateNotification.tsx b/subprojects/frontend/src/UpdateNotification.tsx index 5c8c2d01..d86c0703 100644 --- a/subprojects/frontend/src/UpdateNotification.tsx +++ b/subprojects/frontend/src/UpdateNotification.tsx @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import Button from '@mui/material/Button'; import { observer } from 'mobx-react-lite'; import { useEffect } from 'react'; diff --git a/subprojects/frontend/src/WindowControlsOverlayColor.tsx b/subprojects/frontend/src/WindowControlsOverlayColor.tsx index 14eda566..cfa468ea 100644 --- a/subprojects/frontend/src/WindowControlsOverlayColor.tsx +++ b/subprojects/frontend/src/WindowControlsOverlayColor.tsx @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import { useTheme } from '@mui/material/styles'; import { useEffect } from 'react'; diff --git a/subprojects/frontend/src/editor/AnimatedButton.tsx b/subprojects/frontend/src/editor/AnimatedButton.tsx index f75d4617..dbbda618 100644 --- a/subprojects/frontend/src/editor/AnimatedButton.tsx +++ b/subprojects/frontend/src/editor/AnimatedButton.tsx @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; import { styled, type SxProps, type Theme } from '@mui/material/styles'; diff --git a/subprojects/frontend/src/editor/ConnectButton.tsx b/subprojects/frontend/src/editor/ConnectButton.tsx index e2d251f3..eed6fbc7 100644 --- a/subprojects/frontend/src/editor/ConnectButton.tsx +++ b/subprojects/frontend/src/editor/ConnectButton.tsx @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import CloudIcon from '@mui/icons-material/Cloud'; import CloudOffIcon from '@mui/icons-material/CloudOff'; import SyncIcon from '@mui/icons-material/Sync'; diff --git a/subprojects/frontend/src/editor/ConnectionStatusNotification.tsx b/subprojects/frontend/src/editor/ConnectionStatusNotification.tsx index 9b27f45c..b7b962ab 100644 --- a/subprojects/frontend/src/editor/ConnectionStatusNotification.tsx +++ b/subprojects/frontend/src/editor/ConnectionStatusNotification.tsx @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import Button from '@mui/material/Button'; import { observer } from 'mobx-react-lite'; import { useEffect } from 'react'; diff --git a/subprojects/frontend/src/editor/DiagnosticValue.ts b/subprojects/frontend/src/editor/DiagnosticValue.ts index b4e0b165..20478262 100644 --- a/subprojects/frontend/src/editor/DiagnosticValue.ts +++ b/subprojects/frontend/src/editor/DiagnosticValue.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import type { Diagnostic } from '@codemirror/lint'; import { RangeValue } from '@codemirror/state'; diff --git a/subprojects/frontend/src/editor/EditorArea.tsx b/subprojects/frontend/src/editor/EditorArea.tsx index cfb988b2..905fa2ec 100644 --- a/subprojects/frontend/src/editor/EditorArea.tsx +++ b/subprojects/frontend/src/editor/EditorArea.tsx @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import Box from '@mui/material/Box'; import { useTheme } from '@mui/material/styles'; import { observer } from 'mobx-react-lite'; diff --git a/subprojects/frontend/src/editor/EditorButtons.tsx b/subprojects/frontend/src/editor/EditorButtons.tsx index 53b06e23..9b187e5c 100644 --- a/subprojects/frontend/src/editor/EditorButtons.tsx +++ b/subprojects/frontend/src/editor/EditorButtons.tsx @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import type { Diagnostic } from '@codemirror/lint'; import CheckIcon from '@mui/icons-material/Check'; import ErrorIcon from '@mui/icons-material/Error'; diff --git a/subprojects/frontend/src/editor/EditorPane.tsx b/subprojects/frontend/src/editor/EditorPane.tsx index f7f8241a..87f408fe 100644 --- a/subprojects/frontend/src/editor/EditorPane.tsx +++ b/subprojects/frontend/src/editor/EditorPane.tsx @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import Box from '@mui/material/Box'; import Skeleton from '@mui/material/Skeleton'; import Stack from '@mui/material/Stack'; diff --git a/subprojects/frontend/src/editor/EditorStore.ts b/subprojects/frontend/src/editor/EditorStore.ts index 0a0d885d..b98f085e 100644 --- a/subprojects/frontend/src/editor/EditorStore.ts +++ b/subprojects/frontend/src/editor/EditorStore.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import type { CompletionContext, CompletionResult, diff --git a/subprojects/frontend/src/editor/EditorTheme.ts b/subprojects/frontend/src/editor/EditorTheme.ts index 01b65a7e..023a8f73 100644 --- a/subprojects/frontend/src/editor/EditorTheme.ts +++ b/subprojects/frontend/src/editor/EditorTheme.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import errorSVG from '@material-icons/svg/svg/error/baseline.svg?raw'; import expandMoreSVG from '@material-icons/svg/svg/expand_more/baseline.svg?raw'; import infoSVG from '@material-icons/svg/svg/info/baseline.svg?raw'; diff --git a/subprojects/frontend/src/editor/GenerateButton.tsx b/subprojects/frontend/src/editor/GenerateButton.tsx index 2036fc28..3837ef8e 100644 --- a/subprojects/frontend/src/editor/GenerateButton.tsx +++ b/subprojects/frontend/src/editor/GenerateButton.tsx @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import DangerousOutlinedIcon from '@mui/icons-material/DangerousOutlined'; import PlayArrowIcon from '@mui/icons-material/PlayArrow'; import Button from '@mui/material/Button'; diff --git a/subprojects/frontend/src/editor/LintPanelStore.ts b/subprojects/frontend/src/editor/LintPanelStore.ts index 502f9c59..f81587fa 100644 --- a/subprojects/frontend/src/editor/LintPanelStore.ts +++ b/subprojects/frontend/src/editor/LintPanelStore.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import { closeLintPanel, openLintPanel } from '@codemirror/lint'; import type EditorStore from './EditorStore'; diff --git a/subprojects/frontend/src/editor/PanelStore.ts b/subprojects/frontend/src/editor/PanelStore.ts index 4f827280..25ef8b6c 100644 --- a/subprojects/frontend/src/editor/PanelStore.ts +++ b/subprojects/frontend/src/editor/PanelStore.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import type { Command } from '@codemirror/view'; import { action, makeObservable, observable } from 'mobx'; diff --git a/subprojects/frontend/src/editor/SearchPanel.ts b/subprojects/frontend/src/editor/SearchPanel.ts index c9df41b7..b63d5eed 100644 --- a/subprojects/frontend/src/editor/SearchPanel.ts +++ b/subprojects/frontend/src/editor/SearchPanel.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import { type EditorView, type Panel, diff --git a/subprojects/frontend/src/editor/SearchPanelPortal.tsx b/subprojects/frontend/src/editor/SearchPanelPortal.tsx index 5cf1c90e..b4b07c74 100644 --- a/subprojects/frontend/src/editor/SearchPanelPortal.tsx +++ b/subprojects/frontend/src/editor/SearchPanelPortal.tsx @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import Portal from '@mui/material/Portal'; import { observer } from 'mobx-react-lite'; diff --git a/subprojects/frontend/src/editor/SearchPanelStore.ts b/subprojects/frontend/src/editor/SearchPanelStore.ts index 65d595a8..6a97baf1 100644 --- a/subprojects/frontend/src/editor/SearchPanelStore.ts +++ b/subprojects/frontend/src/editor/SearchPanelStore.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import { closeSearchPanel, findNext, diff --git a/subprojects/frontend/src/editor/SearchToolbar.tsx b/subprojects/frontend/src/editor/SearchToolbar.tsx index 54f3dba7..4ae7e893 100644 --- a/subprojects/frontend/src/editor/SearchToolbar.tsx +++ b/subprojects/frontend/src/editor/SearchToolbar.tsx @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import CloseIcon from '@mui/icons-material/Close'; import FindReplaceIcon from '@mui/icons-material/FindReplace'; import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'; diff --git a/subprojects/frontend/src/editor/createEditorState.ts b/subprojects/frontend/src/editor/createEditorState.ts index ce1efa4f..4a8e9832 100644 --- a/subprojects/frontend/src/editor/createEditorState.ts +++ b/subprojects/frontend/src/editor/createEditorState.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import { closeBrackets, closeBracketsKeymap, diff --git a/subprojects/frontend/src/editor/defineDecorationSetExtension.ts b/subprojects/frontend/src/editor/defineDecorationSetExtension.ts index d9c7bc7d..0887c92e 100644 --- a/subprojects/frontend/src/editor/defineDecorationSetExtension.ts +++ b/subprojects/frontend/src/editor/defineDecorationSetExtension.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import { StateEffect, StateField, TransactionSpec } from '@codemirror/state'; import { EditorView, Decoration, DecorationSet } from '@codemirror/view'; diff --git a/subprojects/frontend/src/editor/exposeDiagnostics.ts b/subprojects/frontend/src/editor/exposeDiagnostics.ts index 82f24c93..c4dcbb87 100644 --- a/subprojects/frontend/src/editor/exposeDiagnostics.ts +++ b/subprojects/frontend/src/editor/exposeDiagnostics.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import { setDiagnosticsEffect } from '@codemirror/lint'; import { StateField, diff --git a/subprojects/frontend/src/editor/findOccurrences.ts b/subprojects/frontend/src/editor/findOccurrences.ts index 08c078c2..00dffc96 100644 --- a/subprojects/frontend/src/editor/findOccurrences.ts +++ b/subprojects/frontend/src/editor/findOccurrences.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import { type Range, RangeSet, diff --git a/subprojects/frontend/src/editor/indentationMarkerViewPlugin.ts b/subprojects/frontend/src/editor/indentationMarkerViewPlugin.ts index 730fa6e3..57a946d5 100644 --- a/subprojects/frontend/src/editor/indentationMarkerViewPlugin.ts +++ b/subprojects/frontend/src/editor/indentationMarkerViewPlugin.ts @@ -1,10 +1,16 @@ +/* + * Copyright (c) 2022 Replit + * Copyright (c) 2022-2023 The Refinery Authors + * + * SPDX-License-Identifier: MIT OR EPL-2.0 + */ + /** * @file CodeMirror plugin to highlight indentation * * This file is based on the * [@replit/codemirror-indentation-markers](https://github.com/replit/codemirror-indentation-markers) - * package, which is available under the - * [MIT License](https://github.com/replit/codemirror-indentation-markers/blob/543cc508ca5cef5d8350af23973eb1425e31525c/LICENSE). + * package. * * The highlighting heuristics were adjusted to make them more suitable * for logic programming. diff --git a/subprojects/frontend/src/editor/scrollbarViewPlugin.ts b/subprojects/frontend/src/editor/scrollbarViewPlugin.ts index f44034fd..878d369d 100644 --- a/subprojects/frontend/src/editor/scrollbarViewPlugin.ts +++ b/subprojects/frontend/src/editor/scrollbarViewPlugin.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import { EditorSelection } from '@codemirror/state'; import { type EditorView, diff --git a/subprojects/frontend/src/editor/semanticHighlighting.ts b/subprojects/frontend/src/editor/semanticHighlighting.ts index 2c1bd67d..1f2e564c 100644 --- a/subprojects/frontend/src/editor/semanticHighlighting.ts +++ b/subprojects/frontend/src/editor/semanticHighlighting.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import { RangeSet, type TransactionSpec } from '@codemirror/state'; import { Decoration } from '@codemirror/view'; diff --git a/subprojects/frontend/src/index.tsx b/subprojects/frontend/src/index.tsx index 29b2b196..cb11e6c3 100644 --- a/subprojects/frontend/src/index.tsx +++ b/subprojects/frontend/src/index.tsx @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import { configure } from 'mobx'; import { type Root, createRoot } from 'react-dom/client'; diff --git a/subprojects/frontend/src/language/folding.ts b/subprojects/frontend/src/language/folding.ts index 4dabfa27..b4d4ca22 100644 --- a/subprojects/frontend/src/language/folding.ts +++ b/subprojects/frontend/src/language/folding.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import type { EditorState } from '@codemirror/state'; import type { SyntaxNode } from '@lezer/common'; diff --git a/subprojects/frontend/src/language/indentation.ts b/subprojects/frontend/src/language/indentation.ts index a0f7032d..8446d7fa 100644 --- a/subprojects/frontend/src/language/indentation.ts +++ b/subprojects/frontend/src/language/indentation.ts @@ -1,3 +1,10 @@ +/* + * Copyright (C) 2018-2021 by Marijn Haverbeke and others + * Copyright (C) 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: MIT OR EPL-2.0 + */ + import type { TreeIndentContext } from '@codemirror/language'; /** diff --git a/subprojects/frontend/src/language/problem.grammar b/subprojects/frontend/src/language/problem.grammar index 704badab..a7b1fb0a 100644 --- a/subprojects/frontend/src/language/problem.grammar +++ b/subprojects/frontend/src/language/problem.grammar @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + @detectDelim @external prop implicitCompletion from './props' diff --git a/subprojects/frontend/src/language/problemLanguageSupport.ts b/subprojects/frontend/src/language/problemLanguageSupport.ts index c3ae7ed9..2121e05f 100644 --- a/subprojects/frontend/src/language/problemLanguageSupport.ts +++ b/subprojects/frontend/src/language/problemLanguageSupport.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import { foldInside, foldNodeProp, diff --git a/subprojects/frontend/src/language/props.ts b/subprojects/frontend/src/language/props.ts index 65392e75..aa67145a 100644 --- a/subprojects/frontend/src/language/props.ts +++ b/subprojects/frontend/src/language/props.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + /* eslint-disable import/prefer-default-export -- Lezer needs non-default exports */ import { NodeProp } from '@lezer/common'; diff --git a/subprojects/frontend/src/theme/ThemeProvider.tsx b/subprojects/frontend/src/theme/ThemeProvider.tsx index ff97d524..740e9562 100644 --- a/subprojects/frontend/src/theme/ThemeProvider.tsx +++ b/subprojects/frontend/src/theme/ThemeProvider.tsx @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import { alpha, createTheme, diff --git a/subprojects/frontend/src/theme/ThemeStore.ts b/subprojects/frontend/src/theme/ThemeStore.ts index e09d8d99..7c657449 100644 --- a/subprojects/frontend/src/theme/ThemeStore.ts +++ b/subprojects/frontend/src/theme/ThemeStore.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import { makeAutoObservable } from 'mobx'; export enum ThemePreference { diff --git a/subprojects/frontend/src/utils/CancelledError.ts b/subprojects/frontend/src/utils/CancelledError.ts index ee23676f..96b67af7 100644 --- a/subprojects/frontend/src/utils/CancelledError.ts +++ b/subprojects/frontend/src/utils/CancelledError.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + export default class CancelledError extends Error { constructor(message = 'Operation cancelled') { super(message); diff --git a/subprojects/frontend/src/utils/PendingTask.ts b/subprojects/frontend/src/utils/PendingTask.ts index d0b24c1f..80d1a346 100644 --- a/subprojects/frontend/src/utils/PendingTask.ts +++ b/subprojects/frontend/src/utils/PendingTask.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import TimeoutError from './TimeoutError'; import getLogger from './getLogger'; diff --git a/subprojects/frontend/src/utils/PriorityMutex.ts b/subprojects/frontend/src/utils/PriorityMutex.ts index 78736141..c1215c76 100644 --- a/subprojects/frontend/src/utils/PriorityMutex.ts +++ b/subprojects/frontend/src/utils/PriorityMutex.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import CancelledError from './CancelledError'; import PendingTask from './PendingTask'; import getLogger from './getLogger'; diff --git a/subprojects/frontend/src/utils/TimeoutError.ts b/subprojects/frontend/src/utils/TimeoutError.ts index eb800f40..21365502 100644 --- a/subprojects/frontend/src/utils/TimeoutError.ts +++ b/subprojects/frontend/src/utils/TimeoutError.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + export default class TimeoutError extends Error { constructor() { super('Operation timed out'); diff --git a/subprojects/frontend/src/utils/getLogger.ts b/subprojects/frontend/src/utils/getLogger.ts index 301fd76d..09b0b17f 100644 --- a/subprojects/frontend/src/utils/getLogger.ts +++ b/subprojects/frontend/src/utils/getLogger.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import styles, { type CSPair } from 'ansi-styles'; import log from 'loglevel'; import prefix from 'loglevel-plugin-prefix'; diff --git a/subprojects/frontend/src/utils/useDelayedSnackbar.ts b/subprojects/frontend/src/utils/useDelayedSnackbar.ts index 03ad6caa..3d6df3e3 100644 --- a/subprojects/frontend/src/utils/useDelayedSnackbar.ts +++ b/subprojects/frontend/src/utils/useDelayedSnackbar.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import { useSnackbar, type SnackbarKey, diff --git a/subprojects/frontend/src/xtext/BackendConfig.ts b/subprojects/frontend/src/xtext/BackendConfig.ts index 41737c0b..4c7eac5f 100644 --- a/subprojects/frontend/src/xtext/BackendConfig.ts +++ b/subprojects/frontend/src/xtext/BackendConfig.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + /* eslint-disable @typescript-eslint/no-redeclare -- Declare types with their companion objects */ import { z } from 'zod'; diff --git a/subprojects/frontend/src/xtext/ContentAssistService.ts b/subprojects/frontend/src/xtext/ContentAssistService.ts index 78f61c06..fd30c4f9 100644 --- a/subprojects/frontend/src/xtext/ContentAssistService.ts +++ b/subprojects/frontend/src/xtext/ContentAssistService.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import type { Completion, CompletionContext, diff --git a/subprojects/frontend/src/xtext/HighlightingService.ts b/subprojects/frontend/src/xtext/HighlightingService.ts index a126ee40..447f1401 100644 --- a/subprojects/frontend/src/xtext/HighlightingService.ts +++ b/subprojects/frontend/src/xtext/HighlightingService.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import type EditorStore from '../editor/EditorStore'; import type { IHighlightRange } from '../editor/semanticHighlighting'; diff --git a/subprojects/frontend/src/xtext/OccurrencesService.ts b/subprojects/frontend/src/xtext/OccurrencesService.ts index fc72ead2..c9c6c699 100644 --- a/subprojects/frontend/src/xtext/OccurrencesService.ts +++ b/subprojects/frontend/src/xtext/OccurrencesService.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import type { Transaction } from '@codemirror/state'; import { debounce } from 'lodash-es'; import ms from 'ms'; diff --git a/subprojects/frontend/src/xtext/UpdateService.ts b/subprojects/frontend/src/xtext/UpdateService.ts index 63e28652..ee5ebde2 100644 --- a/subprojects/frontend/src/xtext/UpdateService.ts +++ b/subprojects/frontend/src/xtext/UpdateService.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import type { ChangeDesc, Transaction } from '@codemirror/state'; import { debounce } from 'lodash-es'; import { nanoid } from 'nanoid'; diff --git a/subprojects/frontend/src/xtext/UpdateStateTracker.ts b/subprojects/frontend/src/xtext/UpdateStateTracker.ts index 5d4ce49e..4ce93ed6 100644 --- a/subprojects/frontend/src/xtext/UpdateStateTracker.ts +++ b/subprojects/frontend/src/xtext/UpdateStateTracker.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import { type ChangeDesc, ChangeSet, diff --git a/subprojects/frontend/src/xtext/ValidationService.ts b/subprojects/frontend/src/xtext/ValidationService.ts index 72414590..64fb63eb 100644 --- a/subprojects/frontend/src/xtext/ValidationService.ts +++ b/subprojects/frontend/src/xtext/ValidationService.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import type { Diagnostic } from '@codemirror/lint'; import type EditorStore from '../editor/EditorStore'; diff --git a/subprojects/frontend/src/xtext/XtextClient.ts b/subprojects/frontend/src/xtext/XtextClient.ts index 14fb2430..e8181af0 100644 --- a/subprojects/frontend/src/xtext/XtextClient.ts +++ b/subprojects/frontend/src/xtext/XtextClient.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import type { CompletionContext, CompletionResult, diff --git a/subprojects/frontend/src/xtext/XtextWebSocketClient.ts b/subprojects/frontend/src/xtext/XtextWebSocketClient.ts index 6b734546..6bb7eec8 100644 --- a/subprojects/frontend/src/xtext/XtextWebSocketClient.ts +++ b/subprojects/frontend/src/xtext/XtextWebSocketClient.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import { createAtom, makeAutoObservable, observable } from 'mobx'; import ms from 'ms'; import { nanoid } from 'nanoid'; diff --git a/subprojects/frontend/src/xtext/fetchBackendConfig.ts b/subprojects/frontend/src/xtext/fetchBackendConfig.ts index 15e976d8..71ff2e63 100644 --- a/subprojects/frontend/src/xtext/fetchBackendConfig.ts +++ b/subprojects/frontend/src/xtext/fetchBackendConfig.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import BackendConfig, { ENDPOINT } from './BackendConfig'; export default async function fetchBackendConfig(): Promise { diff --git a/subprojects/frontend/src/xtext/webSocketMachine.ts b/subprojects/frontend/src/xtext/webSocketMachine.ts index fc53fef3..2fb1f52f 100644 --- a/subprojects/frontend/src/xtext/webSocketMachine.ts +++ b/subprojects/frontend/src/xtext/webSocketMachine.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import ms from 'ms'; import { actions, assign, createMachine } from 'xstate'; diff --git a/subprojects/frontend/src/xtext/xtextMessages.ts b/subprojects/frontend/src/xtext/xtextMessages.ts index ec7a2a31..bbbff064 100644 --- a/subprojects/frontend/src/xtext/xtextMessages.ts +++ b/subprojects/frontend/src/xtext/xtextMessages.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + /* eslint-disable @typescript-eslint/no-redeclare -- Declare types with their companion objects */ import { z } from 'zod'; diff --git a/subprojects/frontend/src/xtext/xtextServiceResults.ts b/subprojects/frontend/src/xtext/xtextServiceResults.ts index e93c6714..d3b467ad 100644 --- a/subprojects/frontend/src/xtext/xtextServiceResults.ts +++ b/subprojects/frontend/src/xtext/xtextServiceResults.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + /* eslint-disable @typescript-eslint/no-redeclare -- Declare types with their companion objects */ import { z } from 'zod'; diff --git a/subprojects/frontend/tsconfig.base.json b/subprojects/frontend/tsconfig.base.json index 30e707ae..58a2a6f2 100644 --- a/subprojects/frontend/tsconfig.base.json +++ b/subprojects/frontend/tsconfig.base.json @@ -1,3 +1,13 @@ +/* + * Copyright (c) Microsoft Corporation. + * Copyright (c) 2023 The Refinery Authors + * + * SPDX-License-Identifier: MIT OR EPL-2.0 + * + * This file is based on + * https://github.com/tsconfig/bases/blob/7db25a41bc5a9c0f66d91f6f3aa28438afcb2f18/bases/strictest.json + * but we moved it inside the project for better tooling support. + */ { "compilerOptions": { "strict": true, @@ -11,6 +21,8 @@ "noUncheckedIndexedAccess": true, "noUnusedLocals": true, "noUnusedParameters": true, + // "verbatimModuleSyntax" is incompatible with `import` syntax in modules + // with CommonJS import resolution, so we use "isolatedModules" only. "verbatimModuleSyntax": false, "isolatedModules": true, "checkJs": true, @@ -18,6 +30,7 @@ "skipLibCheck": true, "forceConsistentCasingInFileNames": true, "useDefineForClassFields": true, + // Project-specific configuration below. "module": "es2022", "moduleResolution": "node", "incremental": true, diff --git a/subprojects/frontend/tsconfig.json b/subprojects/frontend/tsconfig.json index 35d0d164..06f6d8fe 100644 --- a/subprojects/frontend/tsconfig.json +++ b/subprojects/frontend/tsconfig.json @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ { "extends": "./tsconfig.base.json", "compilerOptions": { diff --git a/subprojects/frontend/tsconfig.node.json b/subprojects/frontend/tsconfig.node.json index cfa2da13..47feaf97 100644 --- a/subprojects/frontend/tsconfig.node.json +++ b/subprojects/frontend/tsconfig.node.json @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ { "extends": "./tsconfig.base.json", "compilerOptions": { diff --git a/subprojects/frontend/tsconfig.shared.json b/subprojects/frontend/tsconfig.shared.json index f7b56a1d..154fe122 100644 --- a/subprojects/frontend/tsconfig.shared.json +++ b/subprojects/frontend/tsconfig.shared.json @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ { "extends": "./tsconfig.base.json", "compilerOptions": { @@ -6,6 +11,6 @@ "types": [], }, "include": [ - "src/xtext/BackendConfig.ts", + "src/xtext/BackendConfig.ts" ] } diff --git a/subprojects/frontend/types/ImportMeta.d.ts b/subprojects/frontend/types/ImportMeta.d.ts index c32b48f5..f5a32ef1 100644 --- a/subprojects/frontend/types/ImportMeta.d.ts +++ b/subprojects/frontend/types/ImportMeta.d.ts @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors + * Copyright (c) 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: MIT OR EPL-2.0 + */ + interface ImportMeta { env: { BASE_URL: string; diff --git a/subprojects/frontend/types/grammar.d.ts b/subprojects/frontend/types/grammar.d.ts index 1480085b..e7a7eebf 100644 --- a/subprojects/frontend/types/grammar.d.ts +++ b/subprojects/frontend/types/grammar.d.ts @@ -1,3 +1,10 @@ +/* + * Copyright (C) 2018 by Marijn Haverbeke and others + * Copyright (C) 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: MIT OR EPL-2.0 + */ + declare module '*.grammar' { import type { LRParser } from '@lezer/lr'; diff --git a/subprojects/frontend/types/node/@lezer-generator-rollup.d.ts b/subprojects/frontend/types/node/@lezer-generator-rollup.d.ts index 9c1ff03e..4ef9f4e3 100644 --- a/subprojects/frontend/types/node/@lezer-generator-rollup.d.ts +++ b/subprojects/frontend/types/node/@lezer-generator-rollup.d.ts @@ -1,3 +1,10 @@ +/* + * Copyright (C) 2018 by Marijn Haverbeke and others + * Copyright (C) 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: MIT OR EPL-2.0 + */ + // We have to explicitly redeclare the type of the `./rollup` ESM export of `@lezer/generator`, // because TypeScript can't find it on its own even with `"moduleResolution": "Node16"`. declare module '@lezer/generator/rollup' { diff --git a/subprojects/frontend/types/windowControlsOverlay.d.ts b/subprojects/frontend/types/windowControlsOverlay.d.ts index d8f3182f..2513d620 100644 --- a/subprojects/frontend/types/windowControlsOverlay.d.ts +++ b/subprojects/frontend/types/windowControlsOverlay.d.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + interface WindowControlsOverlayGeometryChangeEvent extends Event { titlebarAreaRect: DOMRect; diff --git a/subprojects/frontend/vite.config.ts b/subprojects/frontend/vite.config.ts index cd9993cc..9e08ccc4 100644 --- a/subprojects/frontend/vite.config.ts +++ b/subprojects/frontend/vite.config.ts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import path from 'node:path'; import { fileURLToPath } from 'node:url'; diff --git a/subprojects/language-ide/build.gradle.kts b/subprojects/language-ide/build.gradle.kts index f996c00d..ff8630f9 100644 --- a/subprojects/language-ide/build.gradle.kts +++ b/subprojects/language-ide/build.gradle.kts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + plugins { id("tools.refinery.gradle.java-library") id("tools.refinery.gradle.xtext-generated") diff --git a/subprojects/language-ide/src/main/java/tools/refinery/language/ide/ProblemIdeModule.java b/subprojects/language-ide/src/main/java/tools/refinery/language/ide/ProblemIdeModule.java index fb620065..122fe874 100644 --- a/subprojects/language-ide/src/main/java/tools/refinery/language/ide/ProblemIdeModule.java +++ b/subprojects/language-ide/src/main/java/tools/refinery/language/ide/ProblemIdeModule.java @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + /* * generated by Xtext 2.25.0 */ diff --git a/subprojects/language-ide/src/main/java/tools/refinery/language/ide/ProblemIdeSetup.java b/subprojects/language-ide/src/main/java/tools/refinery/language/ide/ProblemIdeSetup.java index 5b88d41f..9d77e022 100644 --- a/subprojects/language-ide/src/main/java/tools/refinery/language/ide/ProblemIdeSetup.java +++ b/subprojects/language-ide/src/main/java/tools/refinery/language/ide/ProblemIdeSetup.java @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + /* * generated by Xtext 2.25.0 */ diff --git a/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/FuzzyMatcher.java b/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/FuzzyMatcher.java index fe722ca1..4511223b 100644 --- a/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/FuzzyMatcher.java +++ b/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/FuzzyMatcher.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.ide.contentassist; import org.eclipse.xtext.ide.editor.contentassist.IPrefixMatcher; diff --git a/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/ProblemCrossrefProposalProvider.java b/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/ProblemCrossrefProposalProvider.java index 8f04ed00..e194ee31 100644 --- a/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/ProblemCrossrefProposalProvider.java +++ b/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/ProblemCrossrefProposalProvider.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.ide.contentassist; import java.util.Objects; diff --git a/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/TokenSourceInjectingPartialProblemContentAssistParser.java b/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/TokenSourceInjectingPartialProblemContentAssistParser.java index 3ece6f67..146bd8da 100644 --- a/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/TokenSourceInjectingPartialProblemContentAssistParser.java +++ b/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/TokenSourceInjectingPartialProblemContentAssistParser.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.ide.contentassist; import com.google.inject.Inject; diff --git a/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/TokenSourceInjectingProblemParser.java b/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/TokenSourceInjectingProblemParser.java index 80dfee5c..f906d881 100644 --- a/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/TokenSourceInjectingProblemParser.java +++ b/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/TokenSourceInjectingProblemParser.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.ide.contentassist; import com.google.inject.Inject; diff --git a/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/antlr/ProblemTokenSource.java b/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/antlr/ProblemTokenSource.java index c6c7f41f..fdc17c4f 100644 --- a/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/antlr/ProblemTokenSource.java +++ b/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/antlr/ProblemTokenSource.java @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + /* * generated by Xtext 2.29.0.M2 */ diff --git a/subprojects/language-ide/src/main/java/tools/refinery/language/ide/syntaxcoloring/ProblemSemanticHighlightingCalculator.java b/subprojects/language-ide/src/main/java/tools/refinery/language/ide/syntaxcoloring/ProblemSemanticHighlightingCalculator.java index 7703e4e3..e8f97d51 100644 --- a/subprojects/language-ide/src/main/java/tools/refinery/language/ide/syntaxcoloring/ProblemSemanticHighlightingCalculator.java +++ b/subprojects/language-ide/src/main/java/tools/refinery/language/ide/syntaxcoloring/ProblemSemanticHighlightingCalculator.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.ide.syntaxcoloring; import com.google.common.collect.ImmutableList; diff --git a/subprojects/language-model/META-INF/MANIFEST.MF.license b/subprojects/language-model/META-INF/MANIFEST.MF.license new file mode 100644 index 00000000..e5db6ccd --- /dev/null +++ b/subprojects/language-model/META-INF/MANIFEST.MF.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + +SPDX-License-Identifier: EPL-2.0 diff --git a/subprojects/language-model/build.gradle.kts b/subprojects/language-model/build.gradle.kts index 12b6bc13..4f15e5e6 100644 --- a/subprojects/language-model/build.gradle.kts +++ b/subprojects/language-model/build.gradle.kts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import tools.refinery.gradle.utils.SonarPropertiesUtils plugins { diff --git a/subprojects/language-model/build.properties b/subprojects/language-model/build.properties index 65dfc7c4..9b9859ff 100644 --- a/subprojects/language-model/build.properties +++ b/subprojects/language-model/build.properties @@ -1,4 +1,6 @@ +# SPDX-FileCopyrightText: 2021-2023 The Refinery Authors # +# SPDX-License-Identifier: EPL-2.0 bin.includes = .,\ src/main/resources/model/,\ diff --git a/subprojects/language-model/plugin.properties b/subprojects/language-model/plugin.properties index c4fb7e23..c410feb7 100644 --- a/subprojects/language-model/plugin.properties +++ b/subprojects/language-model/plugin.properties @@ -1,4 +1,6 @@ +# SPDX-FileCopyrightText: 2021-2023 The Refinery Authors # +# SPDX-License-Identifier: EPL-2.0 pluginName = tools.refinery.language.model providerName = refinery.tools diff --git a/subprojects/language-model/plugin.xml b/subprojects/language-model/plugin.xml index 4ca005a8..ef1e21f4 100644 --- a/subprojects/language-model/plugin.xml +++ b/subprojects/language-model/plugin.xml @@ -2,6 +2,9 @@ diff --git a/subprojects/language-model/problem.aird.license b/subprojects/language-model/problem.aird.license new file mode 100644 index 00000000..e5db6ccd --- /dev/null +++ b/subprojects/language-model/problem.aird.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + +SPDX-License-Identifier: EPL-2.0 diff --git a/subprojects/language-model/src/main/java/tools/refinery/language/model/GenerateProblemModel.mwe2 b/subprojects/language-model/src/main/java/tools/refinery/language/model/GenerateProblemModel.mwe2 index 15198d69..074b6b71 100644 --- a/subprojects/language-model/src/main/java/tools/refinery/language/model/GenerateProblemModel.mwe2 +++ b/subprojects/language-model/src/main/java/tools/refinery/language/model/GenerateProblemModel.mwe2 @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ module tools.refinery.language.model.GenerateProblemModel Workflow { diff --git a/subprojects/language-model/src/main/resources/model/problem.ecore.license b/subprojects/language-model/src/main/resources/model/problem.ecore.license new file mode 100644 index 00000000..e5db6ccd --- /dev/null +++ b/subprojects/language-model/src/main/resources/model/problem.ecore.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + +SPDX-License-Identifier: EPL-2.0 diff --git a/subprojects/language-model/src/main/resources/model/problem.genmodel.license b/subprojects/language-model/src/main/resources/model/problem.genmodel.license new file mode 100644 index 00000000..e5db6ccd --- /dev/null +++ b/subprojects/language-model/src/main/resources/model/problem.genmodel.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + +SPDX-License-Identifier: EPL-2.0 diff --git a/subprojects/language-semantics/build.gradle.kts b/subprojects/language-semantics/build.gradle.kts index bf016dc9..38cd9e0d 100644 --- a/subprojects/language-semantics/build.gradle.kts +++ b/subprojects/language-semantics/build.gradle.kts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + plugins { id("tools.refinery.gradle.java-library") } diff --git a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/ModelInitializer.java b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/ModelInitializer.java index a6712a89..41b4fcb0 100644 --- a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/ModelInitializer.java +++ b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/ModelInitializer.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.semantics.model; import com.google.inject.Inject; diff --git a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/internal/DecisionTree.java b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/internal/DecisionTree.java index 55edee6d..c1afecf9 100644 --- a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/internal/DecisionTree.java +++ b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/internal/DecisionTree.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.semantics.model.internal; import org.eclipse.collections.api.factory.primitive.IntObjectMaps; diff --git a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/internal/DecisionTreeCursor.java b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/internal/DecisionTreeCursor.java index fdf8e452..9a1e15a3 100644 --- a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/internal/DecisionTreeCursor.java +++ b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/internal/DecisionTreeCursor.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.semantics.model.internal; import tools.refinery.store.map.Cursor; diff --git a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/internal/DecisionTreeNode.java b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/internal/DecisionTreeNode.java index b81ea3fe..3c54e3c5 100644 --- a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/internal/DecisionTreeNode.java +++ b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/internal/DecisionTreeNode.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.semantics.model.internal; import org.eclipse.collections.api.LazyIntIterable; diff --git a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/internal/DecisionTreeValue.java b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/internal/DecisionTreeValue.java index 495a53dd..915ae2bf 100644 --- a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/internal/DecisionTreeValue.java +++ b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/internal/DecisionTreeValue.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.semantics.model.internal; import tools.refinery.store.representation.TruthValue; diff --git a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/internal/IntermediateNode.java b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/internal/IntermediateNode.java index c4200509..e6f01d48 100644 --- a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/internal/IntermediateNode.java +++ b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/internal/IntermediateNode.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.semantics.model.internal; import org.eclipse.collections.api.LazyIntIterable; diff --git a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/internal/TerminalNode.java b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/internal/TerminalNode.java index 4af836ff..ce49aa62 100644 --- a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/internal/TerminalNode.java +++ b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/internal/TerminalNode.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.semantics.model.internal; import org.eclipse.collections.api.LazyIntIterable; diff --git a/subprojects/language-semantics/src/test/java/tools/refinery/language/semantics/model/tests/DecisionTreeTests.java b/subprojects/language-semantics/src/test/java/tools/refinery/language/semantics/model/tests/DecisionTreeTests.java index 4630bf53..b3fcbabb 100644 --- a/subprojects/language-semantics/src/test/java/tools/refinery/language/semantics/model/tests/DecisionTreeTests.java +++ b/subprojects/language-semantics/src/test/java/tools/refinery/language/semantics/model/tests/DecisionTreeTests.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.semantics.model.tests; import org.junit.jupiter.api.Test; diff --git a/subprojects/language-web/build.gradle.kts b/subprojects/language-web/build.gradle.kts index d2a39d56..e1d250ec 100644 --- a/subprojects/language-web/build.gradle.kts +++ b/subprojects/language-web/build.gradle.kts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + plugins { id("tools.refinery.gradle.java-application") id("tools.refinery.gradle.xtext-generated") diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/CacheControlFilter.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/CacheControlFilter.java index fd2af1b2..53f78c3c 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/CacheControlFilter.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/CacheControlFilter.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web; import jakarta.servlet.*; diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/ProblemWebModule.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/ProblemWebModule.java index 706413a9..12e39e55 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/ProblemWebModule.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/ProblemWebModule.java @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + /* * generated by Xtext 2.25.0 */ diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/ProblemWebSetup.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/ProblemWebSetup.java index 4738bc80..53a394d8 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/ProblemWebSetup.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/ProblemWebSetup.java @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + /* * generated by Xtext 2.25.0 */ diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/ProblemWebSocketServlet.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/ProblemWebSocketServlet.java index df67b521..7b48cde8 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/ProblemWebSocketServlet.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/ProblemWebSocketServlet.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web; import org.eclipse.xtext.util.DisposableRegistry; diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/SecurityHeadersFilter.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/SecurityHeadersFilter.java index c41db799..7b094fde 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/SecurityHeadersFilter.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/SecurityHeadersFilter.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web; import jakarta.servlet.*; diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/ServerLauncher.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/ServerLauncher.java index d40e50af..1924f661 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/ServerLauncher.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/ServerLauncher.java @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + /* * generated by Xtext 2.25.0 */ diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/VirtualThreadUtils.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/VirtualThreadUtils.java index a055e755..27802e0c 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/VirtualThreadUtils.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/VirtualThreadUtils.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web; import org.eclipse.jetty.server.Server; diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/config/BackendConfig.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/config/BackendConfig.java index 2e864998..807b789c 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/config/BackendConfig.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/config/BackendConfig.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.config; import com.google.gson.annotations.SerializedName; diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/config/BackendConfigServlet.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/config/BackendConfigServlet.java index 47e8de7c..a2f04e34 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/config/BackendConfigServlet.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/config/BackendConfigServlet.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.config; import com.google.gson.Gson; diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/occurrences/ProblemOccurrencesService.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/occurrences/ProblemOccurrencesService.java index d32bbb54..34117384 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/occurrences/ProblemOccurrencesService.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/occurrences/ProblemOccurrencesService.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.occurrences; import org.eclipse.emf.ecore.EObject; diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/VirtualThreadExecutorServiceProvider.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/VirtualThreadExecutorServiceProvider.java index abbcbd53..699a09ab 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/VirtualThreadExecutorServiceProvider.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/VirtualThreadExecutorServiceProvider.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.xtext; import org.eclipse.xtext.ide.ExecutorServiceProvider; diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/PongResult.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/PongResult.java index fe510f51..27b2e04e 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/PongResult.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/PongResult.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.xtext.server; import java.util.Objects; diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/ResponseHandler.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/ResponseHandler.java index 2a85afe3..3069c2dd 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/ResponseHandler.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/ResponseHandler.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.xtext.server; import tools.refinery.language.web.xtext.server.message.XtextWebResponse; diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/ResponseHandlerException.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/ResponseHandlerException.java index b686d33a..366ef0a7 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/ResponseHandlerException.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/ResponseHandlerException.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.xtext.server; import java.io.Serial; diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/SubscribingServiceContext.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/SubscribingServiceContext.java index 78e00a9e..04212b84 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/SubscribingServiceContext.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/SubscribingServiceContext.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.xtext.server; import java.util.Set; diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/TransactionExecutor.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/TransactionExecutor.java index 7bb11d2e..0135d8f5 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/TransactionExecutor.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/TransactionExecutor.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.xtext.server; import com.google.common.base.Strings; diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebErrorKind.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebErrorKind.java index f74bae74..6f4f265c 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebErrorKind.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebErrorKind.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.xtext.server.message; import com.google.gson.annotations.SerializedName; diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebErrorResponse.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebErrorResponse.java index 01d78c31..af38ad70 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebErrorResponse.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebErrorResponse.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.xtext.server.message; import java.util.Objects; diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebOkResponse.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebOkResponse.java index 8af27247..73527ee5 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebOkResponse.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebOkResponse.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.xtext.server.message; import java.util.Objects; diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebPushMessage.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebPushMessage.java index c9432e1c..e9ff87c4 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebPushMessage.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebPushMessage.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.xtext.server.message; import java.util.Objects; diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebRequest.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebRequest.java index 959749f8..ff788e94 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebRequest.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebRequest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.xtext.server.message; import java.util.Map; diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebResponse.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebResponse.java index 3bd13047..61444c99 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebResponse.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebResponse.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.xtext.server.message; public sealed interface XtextWebResponse permits XtextWebOkResponse,XtextWebErrorResponse,XtextWebPushMessage { diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PrecomputationListener.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PrecomputationListener.java index 79a284db..110c8f52 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PrecomputationListener.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PrecomputationListener.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.xtext.server.push; import org.eclipse.xtext.web.server.IServiceResult; diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushServiceDispatcher.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushServiceDispatcher.java index c7b8108d..4c9135c8 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushServiceDispatcher.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushServiceDispatcher.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.xtext.server.push; import org.eclipse.xtext.web.server.IServiceContext; diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushWebDocument.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushWebDocument.java index 906b9e30..56fd12c9 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushWebDocument.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushWebDocument.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.xtext.server.push; import java.util.ArrayList; diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushWebDocumentAccess.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushWebDocumentAccess.java index b3666a86..d9e548cd 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushWebDocumentAccess.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushWebDocumentAccess.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.xtext.server.push; import org.eclipse.xtext.service.OperationCanceledManager; diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushWebDocumentProvider.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushWebDocumentProvider.java index b6f04748..b6f4fb43 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushWebDocumentProvider.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushWebDocumentProvider.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.xtext.server.push; import org.eclipse.xtext.web.server.IServiceContext; diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/SimpleServiceContext.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/SimpleServiceContext.java index 43e37160..fee1141d 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/SimpleServiceContext.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/SimpleServiceContext.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.xtext.servlet; import java.util.Map; diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/SimpleSession.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/SimpleSession.java index 09c055a2..bc60c282 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/SimpleSession.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/SimpleSession.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.xtext.servlet; import java.util.HashMap; diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/XtextStatusCode.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/XtextStatusCode.java index 0cd229e8..caa98e84 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/XtextStatusCode.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/XtextStatusCode.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.xtext.servlet; public final class XtextStatusCode { diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/XtextWebSocket.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/XtextWebSocket.java index 1d9e0463..f7d33e9e 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/XtextWebSocket.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/XtextWebSocket.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.xtext.servlet; import com.google.gson.Gson; diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/XtextWebSocketServlet.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/XtextWebSocketServlet.java index 9a32b937..5e4fb0ce 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/XtextWebSocketServlet.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/XtextWebSocketServlet.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.xtext.servlet; import jakarta.servlet.ServletConfig; diff --git a/subprojects/language-web/src/test/java/tools/refinery/language/web/ProblemWebSocketServletIntegrationTest.java b/subprojects/language-web/src/test/java/tools/refinery/language/web/ProblemWebSocketServletIntegrationTest.java index ecbefc4f..53a757eb 100644 --- a/subprojects/language-web/src/test/java/tools/refinery/language/web/ProblemWebSocketServletIntegrationTest.java +++ b/subprojects/language-web/src/test/java/tools/refinery/language/web/ProblemWebSocketServletIntegrationTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web; import org.eclipse.jetty.ee10.servlet.ServletContextHandler; diff --git a/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/AwaitTerminationExecutorServiceProvider.java b/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/AwaitTerminationExecutorServiceProvider.java index c634e8fc..630549d4 100644 --- a/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/AwaitTerminationExecutorServiceProvider.java +++ b/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/AwaitTerminationExecutorServiceProvider.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.tests; import com.google.inject.Singleton; diff --git a/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/ProblemWebInjectorProvider.java b/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/ProblemWebInjectorProvider.java index 43c12faa..4a5eed95 100644 --- a/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/ProblemWebInjectorProvider.java +++ b/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/ProblemWebInjectorProvider.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.tests; import org.eclipse.xtext.ide.ExecutorServiceProvider; diff --git a/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/RestartableCachedThreadPool.java b/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/RestartableCachedThreadPool.java index cf805eda..09079aa8 100644 --- a/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/RestartableCachedThreadPool.java +++ b/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/RestartableCachedThreadPool.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.tests; import com.google.inject.Provider; diff --git a/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/WebSocketIntegrationTestClient.java b/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/WebSocketIntegrationTestClient.java index f19c10ca..2ac53ea6 100644 --- a/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/WebSocketIntegrationTestClient.java +++ b/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/WebSocketIntegrationTestClient.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.tests; import org.eclipse.jetty.ee10.websocket.api.Session; diff --git a/subprojects/language-web/src/test/java/tools/refinery/language/web/xtext/servlet/TransactionExecutorTest.java b/subprojects/language-web/src/test/java/tools/refinery/language/web/xtext/servlet/TransactionExecutorTest.java index 17f1ff5c..841bacd3 100644 --- a/subprojects/language-web/src/test/java/tools/refinery/language/web/xtext/servlet/TransactionExecutorTest.java +++ b/subprojects/language-web/src/test/java/tools/refinery/language/web/xtext/servlet/TransactionExecutorTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.web.xtext.servlet; import com.google.inject.Inject; diff --git a/subprojects/language/build.gradle.kts b/subprojects/language/build.gradle.kts index 4cfe6895..aa799c3b 100644 --- a/subprojects/language/build.gradle.kts +++ b/subprojects/language/build.gradle.kts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + import tools.refinery.gradle.utils.SonarPropertiesUtils plugins { diff --git a/subprojects/language/src/main/java/tools/refinery/language/GenerateProblem.mwe2 b/subprojects/language/src/main/java/tools/refinery/language/GenerateProblem.mwe2 index 21ff456e..d8d89173 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/GenerateProblem.mwe2 +++ b/subprojects/language/src/main/java/tools/refinery/language/GenerateProblem.mwe2 @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ module tools.refinery.language.GenerateProblem import org.eclipse.xtext.xtext.generator.* @@ -55,7 +60,7 @@ Workflow { } webSupport = { // We only generate the {@code AbstractProblemWebModule}, - // because we write our own integration code for CodeMirror 6. + // because we write our own integration code for CodeMirror 6. framework = 'codemirror' generateHtmlExample = false generateJettyLauncher = false diff --git a/subprojects/language/src/main/java/tools/refinery/language/Problem.xtext b/subprojects/language/src/main/java/tools/refinery/language/Problem.xtext index 187ebf1f..9e330347 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/Problem.xtext +++ b/subprojects/language/src/main/java/tools/refinery/language/Problem.xtext @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ grammar tools.refinery.language.Problem with org.eclipse.xtext.common.Terminals import "http://www.eclipse.org/emf/2002/Ecore" as ecore diff --git a/subprojects/language/src/main/java/tools/refinery/language/ProblemRuntimeModule.java b/subprojects/language/src/main/java/tools/refinery/language/ProblemRuntimeModule.java index 5efcdc81..2636a8ee 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/ProblemRuntimeModule.java +++ b/subprojects/language/src/main/java/tools/refinery/language/ProblemRuntimeModule.java @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + /* * generated by Xtext 2.25.0 */ diff --git a/subprojects/language/src/main/java/tools/refinery/language/ProblemStandaloneSetup.java b/subprojects/language/src/main/java/tools/refinery/language/ProblemStandaloneSetup.java index 41c96114..639d6778 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/ProblemStandaloneSetup.java +++ b/subprojects/language/src/main/java/tools/refinery/language/ProblemStandaloneSetup.java @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + /* * generated by Xtext 2.25.0 */ diff --git a/subprojects/language/src/main/java/tools/refinery/language/conversion/ProblemValueConverterService.java b/subprojects/language/src/main/java/tools/refinery/language/conversion/ProblemValueConverterService.java index 508688ed..afbc367e 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/conversion/ProblemValueConverterService.java +++ b/subprojects/language/src/main/java/tools/refinery/language/conversion/ProblemValueConverterService.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.conversion; import org.eclipse.xtext.common.services.DefaultTerminalConverters; diff --git a/subprojects/language/src/main/java/tools/refinery/language/conversion/UpperBoundValueConverter.java b/subprojects/language/src/main/java/tools/refinery/language/conversion/UpperBoundValueConverter.java index be0d15ad..4886757d 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/conversion/UpperBoundValueConverter.java +++ b/subprojects/language/src/main/java/tools/refinery/language/conversion/UpperBoundValueConverter.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.conversion; import org.eclipse.xtext.conversion.ValueConverterException; diff --git a/subprojects/language/src/main/java/tools/refinery/language/formatting2/ProblemFormatter.java b/subprojects/language/src/main/java/tools/refinery/language/formatting2/ProblemFormatter.java index 797535ea..55a5ac20 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/formatting2/ProblemFormatter.java +++ b/subprojects/language/src/main/java/tools/refinery/language/formatting2/ProblemFormatter.java @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + /* * generated by Xtext 2.26.0.M2 */ diff --git a/subprojects/language/src/main/java/tools/refinery/language/naming/NamingUtil.java b/subprojects/language/src/main/java/tools/refinery/language/naming/NamingUtil.java index e959be74..1647d4e7 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/naming/NamingUtil.java +++ b/subprojects/language/src/main/java/tools/refinery/language/naming/NamingUtil.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.naming; import java.util.regex.Pattern; diff --git a/subprojects/language/src/main/java/tools/refinery/language/naming/ProblemQualifiedNameConverter.java b/subprojects/language/src/main/java/tools/refinery/language/naming/ProblemQualifiedNameConverter.java index 5453906f..74b4e208 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/naming/ProblemQualifiedNameConverter.java +++ b/subprojects/language/src/main/java/tools/refinery/language/naming/ProblemQualifiedNameConverter.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.naming; import org.eclipse.xtext.naming.IQualifiedNameConverter; diff --git a/subprojects/language/src/main/java/tools/refinery/language/parser/antlr/IdentifierTokenProvider.java b/subprojects/language/src/main/java/tools/refinery/language/parser/antlr/IdentifierTokenProvider.java index ab133a90..306a86fc 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/parser/antlr/IdentifierTokenProvider.java +++ b/subprojects/language/src/main/java/tools/refinery/language/parser/antlr/IdentifierTokenProvider.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.parser.antlr; import com.google.inject.Inject; diff --git a/subprojects/language/src/main/java/tools/refinery/language/parser/antlr/ProblemTokenSource.java b/subprojects/language/src/main/java/tools/refinery/language/parser/antlr/ProblemTokenSource.java index 0b4e7185..5b91a6cc 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/parser/antlr/ProblemTokenSource.java +++ b/subprojects/language/src/main/java/tools/refinery/language/parser/antlr/ProblemTokenSource.java @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + /* * generated by Xtext 2.29.0.M2 */ diff --git a/subprojects/language/src/main/java/tools/refinery/language/parser/antlr/TokenSourceInjectingProblemParser.java b/subprojects/language/src/main/java/tools/refinery/language/parser/antlr/TokenSourceInjectingProblemParser.java index 0cdd38d8..fe4c0bc7 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/parser/antlr/TokenSourceInjectingProblemParser.java +++ b/subprojects/language/src/main/java/tools/refinery/language/parser/antlr/TokenSourceInjectingProblemParser.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.parser.antlr; import com.google.inject.Inject; diff --git a/subprojects/language/src/main/java/tools/refinery/language/resource/DerivedVariableComputer.java b/subprojects/language/src/main/java/tools/refinery/language/resource/DerivedVariableComputer.java index 6176b0c4..07c5da41 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/resource/DerivedVariableComputer.java +++ b/subprojects/language/src/main/java/tools/refinery/language/resource/DerivedVariableComputer.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.resource; import com.google.inject.Inject; diff --git a/subprojects/language/src/main/java/tools/refinery/language/resource/ImplicitVariableScope.java b/subprojects/language/src/main/java/tools/refinery/language/resource/ImplicitVariableScope.java index b0ac2ab6..e97c8287 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/resource/ImplicitVariableScope.java +++ b/subprojects/language/src/main/java/tools/refinery/language/resource/ImplicitVariableScope.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.resource; import org.eclipse.emf.ecore.EObject; diff --git a/subprojects/language/src/main/java/tools/refinery/language/resource/NodeNameCollector.java b/subprojects/language/src/main/java/tools/refinery/language/resource/NodeNameCollector.java index 419be0d3..e5deca4d 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/resource/NodeNameCollector.java +++ b/subprojects/language/src/main/java/tools/refinery/language/resource/NodeNameCollector.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.resource; import com.google.common.collect.ImmutableSet; diff --git a/subprojects/language/src/main/java/tools/refinery/language/resource/ProblemDerivedStateComputer.java b/subprojects/language/src/main/java/tools/refinery/language/resource/ProblemDerivedStateComputer.java index 8d3a552a..b145ef27 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/resource/ProblemDerivedStateComputer.java +++ b/subprojects/language/src/main/java/tools/refinery/language/resource/ProblemDerivedStateComputer.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.resource; import com.google.inject.Inject; diff --git a/subprojects/language/src/main/java/tools/refinery/language/resource/ProblemLocationInFileProvider.java b/subprojects/language/src/main/java/tools/refinery/language/resource/ProblemLocationInFileProvider.java index df822987..1fe2df89 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/resource/ProblemLocationInFileProvider.java +++ b/subprojects/language/src/main/java/tools/refinery/language/resource/ProblemLocationInFileProvider.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.resource; import org.eclipse.emf.ecore.EObject; diff --git a/subprojects/language/src/main/java/tools/refinery/language/resource/ProblemResourceDescriptionStrategy.java b/subprojects/language/src/main/java/tools/refinery/language/resource/ProblemResourceDescriptionStrategy.java index 1a0b73a8..630be379 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/resource/ProblemResourceDescriptionStrategy.java +++ b/subprojects/language/src/main/java/tools/refinery/language/resource/ProblemResourceDescriptionStrategy.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.resource; import org.eclipse.emf.ecore.EObject; diff --git a/subprojects/language/src/main/java/tools/refinery/language/resource/ReferenceCounter.java b/subprojects/language/src/main/java/tools/refinery/language/resource/ReferenceCounter.java index ca20325e..f1be55ee 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/resource/ReferenceCounter.java +++ b/subprojects/language/src/main/java/tools/refinery/language/resource/ReferenceCounter.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.resource; import java.util.HashMap; diff --git a/subprojects/language/src/main/java/tools/refinery/language/scoping/ProblemGlobalScopeProvider.java b/subprojects/language/src/main/java/tools/refinery/language/scoping/ProblemGlobalScopeProvider.java index b749154c..4d2dd772 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/scoping/ProblemGlobalScopeProvider.java +++ b/subprojects/language/src/main/java/tools/refinery/language/scoping/ProblemGlobalScopeProvider.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.scoping; import java.util.LinkedHashSet; diff --git a/subprojects/language/src/main/java/tools/refinery/language/scoping/ProblemLocalScopeProvider.java b/subprojects/language/src/main/java/tools/refinery/language/scoping/ProblemLocalScopeProvider.java index 61883f0e..229960a0 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/scoping/ProblemLocalScopeProvider.java +++ b/subprojects/language/src/main/java/tools/refinery/language/scoping/ProblemLocalScopeProvider.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.scoping; import java.util.List; diff --git a/subprojects/language/src/main/java/tools/refinery/language/scoping/ProblemScopeProvider.java b/subprojects/language/src/main/java/tools/refinery/language/scoping/ProblemScopeProvider.java index 3ab07496..cf099aba 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/scoping/ProblemScopeProvider.java +++ b/subprojects/language/src/main/java/tools/refinery/language/scoping/ProblemScopeProvider.java @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + /* * generated by Xtext 2.25.0 */ diff --git a/subprojects/language/src/main/java/tools/refinery/language/serializer/PreferShortAssertionsProblemSemanticSequencer.java b/subprojects/language/src/main/java/tools/refinery/language/serializer/PreferShortAssertionsProblemSemanticSequencer.java index 27ce1521..b9cafbc2 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/serializer/PreferShortAssertionsProblemSemanticSequencer.java +++ b/subprojects/language/src/main/java/tools/refinery/language/serializer/PreferShortAssertionsProblemSemanticSequencer.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.serializer; import com.google.inject.Inject; diff --git a/subprojects/language/src/main/java/tools/refinery/language/utils/BuiltinSymbols.java b/subprojects/language/src/main/java/tools/refinery/language/utils/BuiltinSymbols.java index d3777cd3..c8c7fd4a 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/utils/BuiltinSymbols.java +++ b/subprojects/language/src/main/java/tools/refinery/language/utils/BuiltinSymbols.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.utils; import tools.refinery.language.model.problem.*; diff --git a/subprojects/language/src/main/java/tools/refinery/language/utils/CollectedSymbols.java b/subprojects/language/src/main/java/tools/refinery/language/utils/CollectedSymbols.java index b5682f32..e4e4d07a 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/utils/CollectedSymbols.java +++ b/subprojects/language/src/main/java/tools/refinery/language/utils/CollectedSymbols.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.utils; import java.util.Map; diff --git a/subprojects/language/src/main/java/tools/refinery/language/utils/ContainmentRole.java b/subprojects/language/src/main/java/tools/refinery/language/utils/ContainmentRole.java index 708e10a9..a43c7dfe 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/utils/ContainmentRole.java +++ b/subprojects/language/src/main/java/tools/refinery/language/utils/ContainmentRole.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.utils; import tools.refinery.language.model.problem.PredicateKind; diff --git a/subprojects/language/src/main/java/tools/refinery/language/utils/NodeInfo.java b/subprojects/language/src/main/java/tools/refinery/language/utils/NodeInfo.java index c8f47653..0fa7a454 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/utils/NodeInfo.java +++ b/subprojects/language/src/main/java/tools/refinery/language/utils/NodeInfo.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.utils; public record NodeInfo(String name, boolean individual) { diff --git a/subprojects/language/src/main/java/tools/refinery/language/utils/ProblemDesugarer.java b/subprojects/language/src/main/java/tools/refinery/language/utils/ProblemDesugarer.java index b8200919..738a0896 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/utils/ProblemDesugarer.java +++ b/subprojects/language/src/main/java/tools/refinery/language/utils/ProblemDesugarer.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.utils; import com.google.inject.Inject; diff --git a/subprojects/language/src/main/java/tools/refinery/language/utils/ProblemUtil.java b/subprojects/language/src/main/java/tools/refinery/language/utils/ProblemUtil.java index 1e5164d3..9486dc2a 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/utils/ProblemUtil.java +++ b/subprojects/language/src/main/java/tools/refinery/language/utils/ProblemUtil.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.utils; import org.eclipse.emf.common.util.URI; diff --git a/subprojects/language/src/main/java/tools/refinery/language/utils/RelationInfo.java b/subprojects/language/src/main/java/tools/refinery/language/utils/RelationInfo.java index 2253d257..1c46fe72 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/utils/RelationInfo.java +++ b/subprojects/language/src/main/java/tools/refinery/language/utils/RelationInfo.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.utils; import tools.refinery.language.model.problem.*; diff --git a/subprojects/language/src/main/java/tools/refinery/language/utils/SymbolCollector.java b/subprojects/language/src/main/java/tools/refinery/language/utils/SymbolCollector.java index 65167ed6..a4ea1113 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/utils/SymbolCollector.java +++ b/subprojects/language/src/main/java/tools/refinery/language/utils/SymbolCollector.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.utils; import com.google.inject.Inject; diff --git a/subprojects/language/src/main/java/tools/refinery/language/validation/ProblemValidator.java b/subprojects/language/src/main/java/tools/refinery/language/validation/ProblemValidator.java index 659d882c..88d50c5b 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/validation/ProblemValidator.java +++ b/subprojects/language/src/main/java/tools/refinery/language/validation/ProblemValidator.java @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + /* * generated by Xtext 2.25.0 */ diff --git a/subprojects/language/src/main/resources/tools/refinery/language/builtin.problem b/subprojects/language/src/main/resources/tools/refinery/language/builtin.problem index 06b6da1d..9c1d7669 100644 --- a/subprojects/language/src/main/resources/tools/refinery/language/builtin.problem +++ b/subprojects/language/src/main/resources/tools/refinery/language/builtin.problem @@ -1,3 +1,6 @@ +% SPDX-FileCopyrightText: 2021-2023 The Refinery Authors +% +% SPDX-License-Identifier: EPL-2.0 problem builtin. abstract class node { diff --git a/subprojects/language/src/test/java/tools/refinery/language/tests/ProblemParsingTest.java b/subprojects/language/src/test/java/tools/refinery/language/tests/ProblemParsingTest.java index 58daa365..c7952369 100644 --- a/subprojects/language/src/test/java/tools/refinery/language/tests/ProblemParsingTest.java +++ b/subprojects/language/src/test/java/tools/refinery/language/tests/ProblemParsingTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.tests; import com.google.inject.Inject; diff --git a/subprojects/language/src/test/java/tools/refinery/language/tests/formatting2/ProblemFormatterTest.java b/subprojects/language/src/test/java/tools/refinery/language/tests/formatting2/ProblemFormatterTest.java index 6e0802ca..f688d970 100644 --- a/subprojects/language/src/test/java/tools/refinery/language/tests/formatting2/ProblemFormatterTest.java +++ b/subprojects/language/src/test/java/tools/refinery/language/tests/formatting2/ProblemFormatterTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.tests.formatting2; import com.google.inject.Inject; diff --git a/subprojects/language/src/test/java/tools/refinery/language/tests/parser/antlr/IdentifierTokenProviderTest.java b/subprojects/language/src/test/java/tools/refinery/language/tests/parser/antlr/IdentifierTokenProviderTest.java index abff8d9c..37d38dd9 100644 --- a/subprojects/language/src/test/java/tools/refinery/language/tests/parser/antlr/IdentifierTokenProviderTest.java +++ b/subprojects/language/src/test/java/tools/refinery/language/tests/parser/antlr/IdentifierTokenProviderTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.tests.parser.antlr; import com.google.inject.Inject; diff --git a/subprojects/language/src/test/java/tools/refinery/language/tests/parser/antlr/ProblemTokenSourceTest.java b/subprojects/language/src/test/java/tools/refinery/language/tests/parser/antlr/ProblemTokenSourceTest.java index cb42d5d0..644744a0 100644 --- a/subprojects/language/src/test/java/tools/refinery/language/tests/parser/antlr/ProblemTokenSourceTest.java +++ b/subprojects/language/src/test/java/tools/refinery/language/tests/parser/antlr/ProblemTokenSourceTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.tests.parser.antlr; import com.google.inject.Inject; diff --git a/subprojects/language/src/test/java/tools/refinery/language/tests/parser/antlr/TransitiveClosureParserTest.java b/subprojects/language/src/test/java/tools/refinery/language/tests/parser/antlr/TransitiveClosureParserTest.java index 65ceb45f..1180d131 100644 --- a/subprojects/language/src/test/java/tools/refinery/language/tests/parser/antlr/TransitiveClosureParserTest.java +++ b/subprojects/language/src/test/java/tools/refinery/language/tests/parser/antlr/TransitiveClosureParserTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.tests.parser.antlr; import com.google.inject.Inject; diff --git a/subprojects/language/src/test/java/tools/refinery/language/tests/rules/RuleParsingTest.java b/subprojects/language/src/test/java/tools/refinery/language/tests/rules/RuleParsingTest.java index 72e5e18a..68514bfa 100644 --- a/subprojects/language/src/test/java/tools/refinery/language/tests/rules/RuleParsingTest.java +++ b/subprojects/language/src/test/java/tools/refinery/language/tests/rules/RuleParsingTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.tests.rules; import com.google.inject.Inject; diff --git a/subprojects/language/src/test/java/tools/refinery/language/tests/scoping/NodeScopingTest.java b/subprojects/language/src/test/java/tools/refinery/language/tests/scoping/NodeScopingTest.java index fa462691..734bfcd1 100644 --- a/subprojects/language/src/test/java/tools/refinery/language/tests/scoping/NodeScopingTest.java +++ b/subprojects/language/src/test/java/tools/refinery/language/tests/scoping/NodeScopingTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.tests.scoping; import com.google.inject.Inject; diff --git a/subprojects/language/src/test/java/tools/refinery/language/tests/serializer/ProblemSerializerTest.java b/subprojects/language/src/test/java/tools/refinery/language/tests/serializer/ProblemSerializerTest.java index 4a18704a..3f3a081f 100644 --- a/subprojects/language/src/test/java/tools/refinery/language/tests/serializer/ProblemSerializerTest.java +++ b/subprojects/language/src/test/java/tools/refinery/language/tests/serializer/ProblemSerializerTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.tests.serializer; import com.google.inject.Inject; diff --git a/subprojects/language/src/test/java/tools/refinery/language/tests/utils/SymbolCollectorTest.java b/subprojects/language/src/test/java/tools/refinery/language/tests/utils/SymbolCollectorTest.java index af6de37f..d200eeff 100644 --- a/subprojects/language/src/test/java/tools/refinery/language/tests/utils/SymbolCollectorTest.java +++ b/subprojects/language/src/test/java/tools/refinery/language/tests/utils/SymbolCollectorTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.tests.utils; import com.google.inject.Inject; diff --git a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/ProblemNavigationUtil.java b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/ProblemNavigationUtil.java index 5761935b..d92011a9 100644 --- a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/ProblemNavigationUtil.java +++ b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/ProblemNavigationUtil.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.model.tests.utils; import java.util.List; diff --git a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/ProblemParseHelper.java b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/ProblemParseHelper.java index 5e044a94..6f6a87f7 100644 --- a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/ProblemParseHelper.java +++ b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/ProblemParseHelper.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.model.tests.utils; import org.eclipse.xtext.testing.util.ParseHelper; diff --git a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedAction.java b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedAction.java index d176727b..3a49a0b9 100644 --- a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedAction.java +++ b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedAction.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.model.tests.utils; import tools.refinery.language.model.problem.Action; diff --git a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedArgument.java b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedArgument.java index 9e4c59f5..ed749fed 100644 --- a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedArgument.java +++ b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedArgument.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.model.tests.utils; import tools.refinery.language.model.problem.*; diff --git a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedAssertion.java b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedAssertion.java index 2c38639d..b2ef6e48 100644 --- a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedAssertion.java +++ b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedAssertion.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.model.tests.utils; import tools.refinery.language.model.problem.Assertion; diff --git a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedAssertionArgument.java b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedAssertionArgument.java index 840c1f74..b36f2506 100644 --- a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedAssertionArgument.java +++ b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedAssertionArgument.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.model.tests.utils; import tools.refinery.language.model.problem.AssertionArgument; diff --git a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedAtom.java b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedAtom.java index 498991f8..c02f447b 100644 --- a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedAtom.java +++ b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedAtom.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.model.tests.utils; import tools.refinery.language.model.problem.Atom; diff --git a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedClassDeclaration.java b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedClassDeclaration.java index 41b2ea62..a228137c 100644 --- a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedClassDeclaration.java +++ b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedClassDeclaration.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.model.tests.utils; import tools.refinery.language.model.problem.ClassDeclaration; diff --git a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedConjunction.java b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedConjunction.java index 88ff71ab..b126b1ce 100644 --- a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedConjunction.java +++ b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedConjunction.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.model.tests.utils; import tools.refinery.language.model.problem.Conjunction; diff --git a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedConsequent.java b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedConsequent.java index 46faa7da..8d6a92f8 100644 --- a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedConsequent.java +++ b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedConsequent.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.model.tests.utils; import tools.refinery.language.model.problem.Consequent; diff --git a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedEnumDeclaration.java b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedEnumDeclaration.java index 74dcf01b..229a8c0a 100644 --- a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedEnumDeclaration.java +++ b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedEnumDeclaration.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.model.tests.utils; import tools.refinery.language.model.problem.EnumDeclaration; diff --git a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedLiteral.java b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedLiteral.java index 4aa71b99..160e5dd8 100644 --- a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedLiteral.java +++ b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedLiteral.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.model.tests.utils; import tools.refinery.language.model.problem.Atom; diff --git a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedParametricDefinition.java b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedParametricDefinition.java index c2f18a60..d44b79ed 100644 --- a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedParametricDefinition.java +++ b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedParametricDefinition.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.model.tests.utils; import tools.refinery.language.model.problem.Parameter; diff --git a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedPredicateDefinition.java b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedPredicateDefinition.java index 7b95ecc1..2cf5fd89 100644 --- a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedPredicateDefinition.java +++ b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedPredicateDefinition.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.model.tests.utils; import tools.refinery.language.model.problem.PredicateDefinition; diff --git a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedProblem.java b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedProblem.java index 78ca95c7..e5aa0043 100644 --- a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedProblem.java +++ b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedProblem.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.model.tests.utils; import org.eclipse.emf.ecore.resource.Resource.Diagnostic; diff --git a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedRuleDefinition.java b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedRuleDefinition.java index a4cf2eaf..326d8ec3 100644 --- a/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedRuleDefinition.java +++ b/subprojects/language/src/testFixtures/java/tools/refinery/language/model/tests/utils/WrappedRuleDefinition.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.language.model.tests.utils; import tools.refinery.language.model.problem.RuleDefinition; diff --git a/subprojects/store-query-viatra/NOTICE.md b/subprojects/store-query-viatra/NOTICE.md new file mode 100644 index 00000000..7c21726a --- /dev/null +++ b/subprojects/store-query-viatra/NOTICE.md @@ -0,0 +1,87 @@ + + +This module contains source code from the [Eclipse VIATRA project](https://projects.eclipse.org/projects/modeling.viatra), which is available under the terms of the [Eclipse Public License v 2.0](http://www.eclipse.org/legal/epl-v20.html). + +We reproduce the [accompanying notices](https://github.com/viatra/org.eclipse.viatra/blob/d422bcc626a99c4640c0d13931f393ccea0d2326/NOTICE.md) in full below: + +# Notices for Eclipse VIATRA + +This content is produced and maintained by the Eclipse VIATRA project. + +* Project home: https://projects.eclipse.org/projects/modeling.viatra + +## Trademarks + +Eclipse VIATRA, and VIATRA are trademarks of the Eclipse Foundation. + +## Copyright + +All content is the property of the respective authors or their employers. For +more information regarding authorship of content, please consult the listed +source code repository logs. + +## Declared Project Licenses + +This program and the accompanying materials are made available under the terms +of the Eclipse Public License v. 2.0 which is available at +http://www.eclipse.org/legal/epl-v20.html. + +SPDX-License-Identifier: EPL-2.0 + +## Source Code + +The project maintains the following source code repositories: + +* http://git.eclipse.org/c/viatra/org.eclipse.viatra.git +* http://git.eclipse.org/c/viatra/org.eclipse.viatra.modelobfuscator.git +* http://git.eclipse.org/c/viatra/org.eclipse.viatra.examples.git +* http://git.eclipse.org/c/viatra/org.eclipse.viatra2.vpm.git + +## Third-party Content + +This project leverages the following third party content. + +ANTLR Runtime only: (3.2) + +* License: New BSD license + +Apache Commons Language Library (2.1) + +* License: Apache License, 2.0 + +Google Guice / Inject Core API (3.0.0) + +* License: Apache License, 2.0 + +Google Guice / Inject Core API (3.0.0) + +* License: Apache License 2.0 + +Guava (10.0.1) + +* License: Apache License, 2.0 + +Guice (2.0) + +* License: Apache License, 2.0 + +guice-multibindings (3.0.0) + +* License: Apache License, 2.0 + +log4j (1.2.15) + +* License: Apache License 2.0 + +LPG Java Runtime (lpgjavaruntime.jar) (1.1) + +* License: Eclipse Public License + +mockito (1.9.5) + +* License: Apache License, 2.0, New BSD license, MIT license diff --git a/subprojects/store-query-viatra/build.gradle.kts b/subprojects/store-query-viatra/build.gradle.kts index 4a894f52..e3a22145 100644 --- a/subprojects/store-query-viatra/build.gradle.kts +++ b/subprojects/store-query-viatra/build.gradle.kts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + plugins { id("tools.refinery.gradle.java-library") } diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQuery.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQuery.java index 677e3c7d..3fff6f2e 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQuery.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQuery.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra; import tools.refinery.store.adapter.ModelAdapterBuilderFactory; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQueryAdapter.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQueryAdapter.java index 7e21476b..411e251e 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQueryAdapter.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQueryAdapter.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra; import tools.refinery.store.query.ModelQueryAdapter; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQueryBuilder.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQueryBuilder.java index 7ae86f9f..310171e8 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQueryBuilder.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQueryBuilder.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra; import org.eclipse.viatra.query.runtime.api.ViatraQueryEngineOptions; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQueryStoreAdapter.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQueryStoreAdapter.java index 1ee02f12..da6d7bd5 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQueryStoreAdapter.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQueryStoreAdapter.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra; import org.eclipse.viatra.query.runtime.api.ViatraQueryEngineOptions; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/RelationalScope.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/RelationalScope.java index 8328e759..d1a65a89 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/RelationalScope.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/RelationalScope.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal; import org.apache.log4j.Logger; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryAdapterImpl.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryAdapterImpl.java index 8be30fee..7103a561 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryAdapterImpl.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryAdapterImpl.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal; import org.eclipse.viatra.query.runtime.api.AdvancedViatraQueryEngine; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryBuilderImpl.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryBuilderImpl.java index bfabf26e..999d349a 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryBuilderImpl.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryBuilderImpl.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal; import org.eclipse.viatra.query.runtime.api.IQuerySpecification; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryStoreAdapterImpl.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryStoreAdapterImpl.java index 04c48c43..aa102a35 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryStoreAdapterImpl.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryStoreAdapterImpl.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal; import org.eclipse.viatra.query.runtime.api.IQuerySpecification; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/cardinality/UpperCardinalitySumAggregationOperator.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/cardinality/UpperCardinalitySumAggregationOperator.java index e0bca9e0..bfd4c049 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/cardinality/UpperCardinalitySumAggregationOperator.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/cardinality/UpperCardinalitySumAggregationOperator.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.cardinality; import org.eclipse.viatra.query.runtime.matchers.psystem.aggregations.BoundAggregator; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/DummyBaseIndexer.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/DummyBaseIndexer.java index 2a24b67c..8cb199d2 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/DummyBaseIndexer.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/DummyBaseIndexer.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.context; import org.eclipse.viatra.query.runtime.api.scope.IBaseIndex; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalEngineContext.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalEngineContext.java index 28bc69d0..7220f8ca 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalEngineContext.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalEngineContext.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.context; import org.eclipse.viatra.query.runtime.api.scope.IBaseIndex; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalQueryMetaContext.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalQueryMetaContext.java index d2c6beb4..07a5a6ea 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalQueryMetaContext.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalQueryMetaContext.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.context; import org.eclipse.viatra.query.runtime.matchers.context.AbstractQueryMetaContext; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalRuntimeContext.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalRuntimeContext.java index 854817b1..71943737 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalRuntimeContext.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalRuntimeContext.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.context; import org.eclipse.viatra.query.runtime.matchers.context.*; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/ExtendOperationExecutor.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/ExtendOperationExecutor.java index 2d3dd5a7..37177cbf 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/ExtendOperationExecutor.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/ExtendOperationExecutor.java @@ -1,5 +1,6 @@ /******************************************************************************* * Copyright (c) 2010-2013, Zoltan Ujhelyi, Akos Horvath, Istvan Rath and Daniel Varro + * Copyright (c) 2023 The Refinery Authors * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at * http://www.eclipse.org/legal/epl-v20.html. diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/ExtendPositivePatternCall.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/ExtendPositivePatternCall.java index aaaece80..9d48c785 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/ExtendPositivePatternCall.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/ExtendPositivePatternCall.java @@ -1,5 +1,6 @@ /******************************************************************************* * Copyright (c) 2010-2016, Grill Balázs, IncQueryLabs + * Copyright (c) 2023 The Refinery Authors * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at * http://www.eclipse.org/legal/epl-v20.html. diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/FlatCostFunction.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/FlatCostFunction.java index 84cab142..cc906f22 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/FlatCostFunction.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/FlatCostFunction.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.localsearch; import org.eclipse.viatra.query.runtime.localsearch.planner.cost.IConstraintEvaluationContext; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/GenericTypeExtend.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/GenericTypeExtend.java index 64653658..96ac4a72 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/GenericTypeExtend.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/GenericTypeExtend.java @@ -1,5 +1,6 @@ /******************************************************************************* * Copyright (c) 2010-2017, Zoltan Ujhelyi, IncQuery Labs Ltd. + * Copyright (c) 2023 The Refinery Authors * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at * http://www.eclipse.org/legal/epl-v20.html. diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/RelationalLocalSearchBackendFactory.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/RelationalLocalSearchBackendFactory.java index 156eb313..0c77f587 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/RelationalLocalSearchBackendFactory.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/RelationalLocalSearchBackendFactory.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.localsearch; import org.eclipse.viatra.query.runtime.localsearch.matcher.integration.AbstractLocalSearchResultProvider; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/RelationalLocalSearchResultProvider.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/RelationalLocalSearchResultProvider.java index be2a38ca..da37be14 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/RelationalLocalSearchResultProvider.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/RelationalLocalSearchResultProvider.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.localsearch; import org.eclipse.viatra.query.runtime.localsearch.matcher.integration.AbstractLocalSearchResultProvider; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/RelationalOperationCompiler.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/RelationalOperationCompiler.java index b6832b39..f76ef486 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/RelationalOperationCompiler.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/RelationalOperationCompiler.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.localsearch; import org.eclipse.viatra.query.runtime.localsearch.operations.generic.GenericTypeExtendSingleValue; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/FunctionalCursor.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/FunctionalCursor.java index 52a83f69..47efb2aa 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/FunctionalCursor.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/FunctionalCursor.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.matcher; import org.eclipse.viatra.query.runtime.rete.index.IterableIndexer; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/FunctionalViatraMatcher.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/FunctionalViatraMatcher.java index adb34b8b..f018288b 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/FunctionalViatraMatcher.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/FunctionalViatraMatcher.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.matcher; import org.eclipse.viatra.query.runtime.matchers.backend.IQueryResultProvider; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/IndexerUtils.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/IndexerUtils.java index 55eb8c44..15f00b2d 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/IndexerUtils.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/IndexerUtils.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.matcher; import org.eclipse.viatra.query.runtime.matchers.tuple.TupleMask; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/MatcherUtils.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/MatcherUtils.java index d327c537..1c784492 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/MatcherUtils.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/MatcherUtils.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.matcher; import org.eclipse.viatra.query.runtime.matchers.tuple.ITuple; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/RawPatternMatcher.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/RawPatternMatcher.java index b3d05967..5b82c4b7 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/RawPatternMatcher.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/RawPatternMatcher.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.matcher; import org.eclipse.viatra.query.runtime.api.GenericPatternMatcher; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/RelationalCursor.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/RelationalCursor.java index e3df0441..1dc8f5db 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/RelationalCursor.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/RelationalCursor.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.matcher; import org.eclipse.viatra.query.runtime.matchers.tuple.ITuple; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/RelationalViatraMatcher.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/RelationalViatraMatcher.java index 9373709d..d1476920 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/RelationalViatraMatcher.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/RelationalViatraMatcher.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.matcher; import org.eclipse.viatra.query.runtime.matchers.backend.IQueryResultProvider; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/UnsafeFunctionalCursor.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/UnsafeFunctionalCursor.java index e9540d1d..4a41d724 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/UnsafeFunctionalCursor.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/UnsafeFunctionalCursor.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.matcher; import org.eclipse.viatra.query.runtime.matchers.tuple.ITuple; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/AssumptionEvaluator.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/AssumptionEvaluator.java index a80b0f90..cf127291 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/AssumptionEvaluator.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/AssumptionEvaluator.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.pquery; import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/Dnf2PQuery.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/Dnf2PQuery.java index 7afeb977..714d41c0 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/Dnf2PQuery.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/Dnf2PQuery.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.pquery; import org.eclipse.viatra.query.runtime.matchers.backend.IQueryBackendFactory; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/QueryWrapperFactory.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/QueryWrapperFactory.java index 24ae5196..30f848a6 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/QueryWrapperFactory.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/QueryWrapperFactory.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.pquery; import org.eclipse.viatra.query.runtime.matchers.context.IInputKey; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/RawPQuery.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/RawPQuery.java index aad4ba3c..255738c5 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/RawPQuery.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/RawPQuery.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.pquery; import org.eclipse.viatra.query.runtime.api.GenericQuerySpecification; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/RelationViewWrapper.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/RelationViewWrapper.java index 48bf558d..02da932b 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/RelationViewWrapper.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/RelationViewWrapper.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.pquery; import org.eclipse.viatra.query.runtime.matchers.context.common.BaseInputKeyWrapper; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/StatefulMultisetAggregator.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/StatefulMultisetAggregator.java index 2798a252..461416f7 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/StatefulMultisetAggregator.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/StatefulMultisetAggregator.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.pquery; import org.eclipse.viatra.query.runtime.matchers.psystem.aggregations.IMultisetAggregationOperator; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/StatelessMultisetAggregator.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/StatelessMultisetAggregator.java index 7cc71ee9..49175d75 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/StatelessMultisetAggregator.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/StatelessMultisetAggregator.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.pquery; import org.eclipse.viatra.query.runtime.matchers.psystem.aggregations.IMultisetAggregationOperator; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/TermEvaluator.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/TermEvaluator.java index ab123c50..1187f57a 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/TermEvaluator.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/TermEvaluator.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.pquery; import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/ValueProviderBasedValuation.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/ValueProviderBasedValuation.java index 30c2fce7..62cb8b3a 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/ValueProviderBasedValuation.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/ValueProviderBasedValuation.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.pquery; import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/ModelUpdateListener.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/ModelUpdateListener.java index fc935aa6..c612574f 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/ModelUpdateListener.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/ModelUpdateListener.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.update; import org.eclipse.viatra.query.runtime.matchers.context.IInputKey; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/RelationViewFilter.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/RelationViewFilter.java index 221f1b4a..efdbfcbe 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/RelationViewFilter.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/RelationViewFilter.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.update; import org.eclipse.viatra.query.runtime.matchers.context.IInputKey; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/RelationViewUpdateListener.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/RelationViewUpdateListener.java index 5e5f60e3..185e4ebc 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/RelationViewUpdateListener.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/RelationViewUpdateListener.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.update; import org.eclipse.viatra.query.runtime.matchers.context.IInputKey; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/TupleChangingRelationViewUpdateListener.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/TupleChangingRelationViewUpdateListener.java index 0f6ed3b3..be4951af 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/TupleChangingRelationViewUpdateListener.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/TupleChangingRelationViewUpdateListener.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.update; import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/TuplePreservingRelationViewUpdateListener.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/TuplePreservingRelationViewUpdateListener.java index 91e9371b..9638266b 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/TuplePreservingRelationViewUpdateListener.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/TuplePreservingRelationViewUpdateListener.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.update; import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/DiagonalQueryTest.java b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/DiagonalQueryTest.java index 90229b73..da4aba7f 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/DiagonalQueryTest.java +++ b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/DiagonalQueryTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra; import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/FunctionalQueryTest.java b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/FunctionalQueryTest.java index fa2a008f..3af67a50 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/FunctionalQueryTest.java +++ b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/FunctionalQueryTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra; import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTest.java b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTest.java index 8a3f9d88..e82f0a15 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTest.java +++ b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra; import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTransactionTest.java b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTransactionTest.java index abd49341..07b799ac 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTransactionTest.java +++ b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTransactionTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra; import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/internal/cardinality/UpperCardinalitySumAggregationOperatorStreamTest.java b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/internal/cardinality/UpperCardinalitySumAggregationOperatorStreamTest.java index c529117e..53d03cbd 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/internal/cardinality/UpperCardinalitySumAggregationOperatorStreamTest.java +++ b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/internal/cardinality/UpperCardinalitySumAggregationOperatorStreamTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.cardinality; import org.junit.jupiter.params.ParameterizedTest; diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/internal/cardinality/UpperCardinalitySumAggregationOperatorTest.java b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/internal/cardinality/UpperCardinalitySumAggregationOperatorTest.java index 20dad543..677eeeac 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/internal/cardinality/UpperCardinalitySumAggregationOperatorTest.java +++ b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/internal/cardinality/UpperCardinalitySumAggregationOperatorTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.cardinality; import org.junit.jupiter.api.BeforeEach; diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/internal/matcher/MatcherUtilsTest.java b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/internal/matcher/MatcherUtilsTest.java index ea0b15ec..968c6c5e 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/internal/matcher/MatcherUtilsTest.java +++ b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/internal/matcher/MatcherUtilsTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.internal.matcher; import org.eclipse.viatra.query.runtime.matchers.tuple.*; diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryAssertions.java b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryAssertions.java index 2769621d..7a25cfdc 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryAssertions.java +++ b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryAssertions.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.tests; import org.junit.jupiter.api.function.Executable; diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryBackendHint.java b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryBackendHint.java index b1818a17..dc0e92c8 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryBackendHint.java +++ b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryBackendHint.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.tests; import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryEngineTest.java b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryEngineTest.java index f129520c..d4f16da7 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryEngineTest.java +++ b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryEngineTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.tests; import org.junit.jupiter.params.ParameterizedTest; diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryEvaluationHintSource.java b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryEvaluationHintSource.java index a55762e2..9e75d5f3 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryEvaluationHintSource.java +++ b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryEvaluationHintSource.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.viatra.tests; import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; diff --git a/subprojects/store-query/build.gradle.kts b/subprojects/store-query/build.gradle.kts index 889a0479..4d8e2605 100644 --- a/subprojects/store-query/build.gradle.kts +++ b/subprojects/store-query/build.gradle.kts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + plugins { id("tools.refinery.gradle.java-library") id("tools.refinery.gradle.java-test-fixtures") diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/AnyResultSet.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/AnyResultSet.java index 6d411212..f29bb278 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/AnyResultSet.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/AnyResultSet.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query; import tools.refinery.store.query.dnf.AnyQuery; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/Constraint.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/Constraint.java index cec4c19f..10d8a579 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/Constraint.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/Constraint.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query; import tools.refinery.store.query.equality.LiteralEqualityHelper; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/EmptyResultSet.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/EmptyResultSet.java index 4c8eeab0..5361f645 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/EmptyResultSet.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/EmptyResultSet.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query; import tools.refinery.store.map.Cursor; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQuery.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQuery.java index 6a1aeabb..60698498 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQuery.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQuery.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query; import tools.refinery.store.adapter.ModelAdapterType; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQueryAdapter.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQueryAdapter.java index 2e30fec4..ae3bbcbb 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQueryAdapter.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQueryAdapter.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query; import tools.refinery.store.adapter.ModelAdapter; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQueryBuilder.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQueryBuilder.java index 4fdc9210..76d6c3ba 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQueryBuilder.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQueryBuilder.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query; import tools.refinery.store.adapter.ModelAdapterBuilder; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQueryStoreAdapter.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQueryStoreAdapter.java index 514e582b..33318abc 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQueryStoreAdapter.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/ModelQueryStoreAdapter.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query; import tools.refinery.store.adapter.ModelStoreAdapter; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/ResultSet.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/ResultSet.java index 2758c74f..9ab83172 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/ResultSet.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/ResultSet.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query; import tools.refinery.store.map.Cursor; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/AnyQuery.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/AnyQuery.java index d0a2367f..5e28af68 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/AnyQuery.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/AnyQuery.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.dnf; public sealed interface AnyQuery permits Query { diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/Dnf.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/Dnf.java index 1b7759c7..3321a10f 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/Dnf.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/Dnf.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.dnf; import tools.refinery.store.query.equality.DnfEqualityChecker; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/DnfBuilder.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/DnfBuilder.java index aad5a85f..4f920f8f 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/DnfBuilder.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/DnfBuilder.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.dnf; import tools.refinery.store.query.literal.Literal; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/DnfClause.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/DnfClause.java index 01830af1..a01d7d55 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/DnfClause.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/DnfClause.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.dnf; import tools.refinery.store.query.equality.LiteralEqualityHelper; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/DnfUtils.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/DnfUtils.java index 9bcf944c..65ab3634 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/DnfUtils.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/DnfUtils.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.dnf; import java.util.UUID; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/FunctionalDependency.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/FunctionalDependency.java index f4cd109f..b00b2cb7 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/FunctionalDependency.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/FunctionalDependency.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.dnf; import java.util.HashSet; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/FunctionalQuery.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/FunctionalQuery.java index 5bf6f8c5..680fa631 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/FunctionalQuery.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/FunctionalQuery.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.dnf; import tools.refinery.store.query.literal.CallPolarity; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/FunctionalQueryBuilder.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/FunctionalQueryBuilder.java index ca2bc006..63580676 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/FunctionalQueryBuilder.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/FunctionalQueryBuilder.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.dnf; import tools.refinery.store.query.literal.Literal; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/Query.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/Query.java index 32e33052..d3de475f 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/Query.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/Query.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.dnf; public sealed interface Query extends AnyQuery permits RelationalQuery, FunctionalQuery { diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/QueryBuilder.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/QueryBuilder.java index ed253cc9..f925c9ac 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/QueryBuilder.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/QueryBuilder.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.dnf; import tools.refinery.store.query.literal.Literal; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/RelationalQuery.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/RelationalQuery.java index 5307e509..0741d8d9 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/RelationalQuery.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/RelationalQuery.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.dnf; import tools.refinery.store.query.literal.CallLiteral; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/equality/DeepDnfEqualityChecker.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/equality/DeepDnfEqualityChecker.java index c3bc3ea3..bb60ccc9 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/equality/DeepDnfEqualityChecker.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/equality/DeepDnfEqualityChecker.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.equality; import tools.refinery.store.query.dnf.Dnf; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/equality/DnfEqualityChecker.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/equality/DnfEqualityChecker.java index 6b1f2076..4a8bee3b 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/equality/DnfEqualityChecker.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/equality/DnfEqualityChecker.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.equality; import tools.refinery.store.query.dnf.Dnf; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/equality/LiteralEqualityHelper.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/equality/LiteralEqualityHelper.java index 07d261ea..0f6ee6c2 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/equality/LiteralEqualityHelper.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/equality/LiteralEqualityHelper.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.equality; import tools.refinery.store.query.dnf.Dnf; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/AbstractCallLiteral.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/AbstractCallLiteral.java index 657ca26b..b08c1037 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/AbstractCallLiteral.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/AbstractCallLiteral.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.literal; import tools.refinery.store.query.Constraint; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/AggregationLiteral.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/AggregationLiteral.java index df64839c..93e59291 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/AggregationLiteral.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/AggregationLiteral.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.literal; import tools.refinery.store.query.Constraint; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/AssignLiteral.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/AssignLiteral.java index 52ac42d7..8cc3fae6 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/AssignLiteral.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/AssignLiteral.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.literal; import tools.refinery.store.query.equality.LiteralEqualityHelper; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/AssumeLiteral.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/AssumeLiteral.java index 0b4267b4..58d563da 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/AssumeLiteral.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/AssumeLiteral.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.literal; import tools.refinery.store.query.equality.LiteralEqualityHelper; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/BooleanLiteral.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/BooleanLiteral.java index 38be61a4..a32cfd80 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/BooleanLiteral.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/BooleanLiteral.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.literal; import tools.refinery.store.query.term.Variable; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/CallLiteral.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/CallLiteral.java index 78fae7f5..82088c8b 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/CallLiteral.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/CallLiteral.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.literal; import tools.refinery.store.query.Constraint; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/CallPolarity.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/CallPolarity.java index 84b4b771..ca70b0fd 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/CallPolarity.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/CallPolarity.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.literal; public enum CallPolarity { diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/CanNegate.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/CanNegate.java index 3e159c43..35dcb3fb 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/CanNegate.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/CanNegate.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.literal; public interface CanNegate> extends Literal { diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/ConstantLiteral.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/ConstantLiteral.java index 93fa3df0..fa7979d1 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/ConstantLiteral.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/ConstantLiteral.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.literal; import tools.refinery.store.query.equality.LiteralEqualityHelper; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/CountLiteral.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/CountLiteral.java index 32e7ba3a..11f78fa8 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/CountLiteral.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/CountLiteral.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.literal; import tools.refinery.store.query.Constraint; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/EquivalenceLiteral.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/EquivalenceLiteral.java index 4dc86b98..3876574c 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/EquivalenceLiteral.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/EquivalenceLiteral.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.literal; import tools.refinery.store.query.term.NodeVariable; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/Literal.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/Literal.java index 6347410e..52411ee8 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/Literal.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/Literal.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.literal; import tools.refinery.store.query.term.Variable; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/LiteralReduction.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/LiteralReduction.java index 146089f6..9d8352ea 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/LiteralReduction.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/LiteralReduction.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.literal; public enum LiteralReduction { diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/Literals.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/Literals.java index 89039352..b3a87811 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/Literals.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/literal/Literals.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.literal; import tools.refinery.store.query.term.Term; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/substitution/CompositeSubstitution.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/substitution/CompositeSubstitution.java index f8064ca2..d175130e 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/substitution/CompositeSubstitution.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/substitution/CompositeSubstitution.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.substitution; import tools.refinery.store.query.term.Variable; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/substitution/MapBasedSubstitution.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/substitution/MapBasedSubstitution.java index c7754619..a8201eef 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/substitution/MapBasedSubstitution.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/substitution/MapBasedSubstitution.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.substitution; import tools.refinery.store.query.term.Variable; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/substitution/RenewingSubstitution.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/substitution/RenewingSubstitution.java index 7847e582..9b737ceb 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/substitution/RenewingSubstitution.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/substitution/RenewingSubstitution.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.substitution; import tools.refinery.store.query.term.Variable; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/substitution/StatelessSubstitution.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/substitution/StatelessSubstitution.java index eed414d9..bb3803d3 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/substitution/StatelessSubstitution.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/substitution/StatelessSubstitution.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.substitution; import tools.refinery.store.query.term.Variable; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/substitution/Substitution.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/substitution/Substitution.java index 99f84b9e..5714edf4 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/substitution/Substitution.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/substitution/Substitution.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.substitution; import tools.refinery.store.query.term.AnyDataVariable; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/substitution/Substitutions.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/substitution/Substitutions.java index 5d4654da..c4791bf1 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/substitution/Substitutions.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/substitution/Substitutions.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.substitution; import org.jetbrains.annotations.NotNull; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/Aggregator.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/Aggregator.java index 47421a94..0684a9d9 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/Aggregator.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/Aggregator.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term; import java.util.stream.Stream; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/AnyDataVariable.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/AnyDataVariable.java index ecfefcf9..ccc063af 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/AnyDataVariable.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/AnyDataVariable.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term; import org.jetbrains.annotations.Nullable; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/AnyTerm.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/AnyTerm.java index 8f998d45..c12c0166 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/AnyTerm.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/AnyTerm.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term; import tools.refinery.store.query.equality.LiteralEqualityHelper; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ArithmeticBinaryOperator.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ArithmeticBinaryOperator.java index 8706a046..5ff7c65c 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ArithmeticBinaryOperator.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ArithmeticBinaryOperator.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term; public enum ArithmeticBinaryOperator { diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ArithmeticBinaryTerm.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ArithmeticBinaryTerm.java index 887a1e6e..e405df00 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ArithmeticBinaryTerm.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ArithmeticBinaryTerm.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term; import tools.refinery.store.query.equality.LiteralEqualityHelper; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ArithmeticUnaryOperator.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ArithmeticUnaryOperator.java index 6a7c25db..d98134f3 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ArithmeticUnaryOperator.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ArithmeticUnaryOperator.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term; public enum ArithmeticUnaryOperator { diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ArithmeticUnaryTerm.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ArithmeticUnaryTerm.java index b78239c7..bdc87545 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ArithmeticUnaryTerm.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ArithmeticUnaryTerm.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term; import tools.refinery.store.query.equality.LiteralEqualityHelper; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/AssignedValue.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/AssignedValue.java index 465e690f..0cf30aa6 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/AssignedValue.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/AssignedValue.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term; import tools.refinery.store.query.literal.Literal; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/BinaryTerm.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/BinaryTerm.java index 34f48ccc..b2994d23 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/BinaryTerm.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/BinaryTerm.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term; import tools.refinery.store.query.equality.LiteralEqualityHelper; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ComparisonOperator.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ComparisonOperator.java index 44dcce10..d04ae22c 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ComparisonOperator.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ComparisonOperator.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term; public enum ComparisonOperator { diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ComparisonTerm.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ComparisonTerm.java index 320d42df..2c304aef 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ComparisonTerm.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ComparisonTerm.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term; import tools.refinery.store.query.equality.LiteralEqualityHelper; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ConstantTerm.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ConstantTerm.java index 2185fe37..b03f07fd 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ConstantTerm.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ConstantTerm.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term; import tools.refinery.store.query.equality.LiteralEqualityHelper; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/DataSort.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/DataSort.java index 4fb44492..6b8669ee 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/DataSort.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/DataSort.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term; import org.jetbrains.annotations.Nullable; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/DataVariable.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/DataVariable.java index af070ca7..50ef745c 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/DataVariable.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/DataVariable.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term; import org.jetbrains.annotations.Nullable; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ExtremeValueAggregator.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ExtremeValueAggregator.java index 57ff597c..657cb631 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ExtremeValueAggregator.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/ExtremeValueAggregator.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term; import java.util.Comparator; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/NodeSort.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/NodeSort.java index 1a4b2d4b..b9be03f7 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/NodeSort.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/NodeSort.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term; import org.jetbrains.annotations.Nullable; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/NodeVariable.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/NodeVariable.java index 7419aaad..de2f945a 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/NodeVariable.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/NodeVariable.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term; import org.jetbrains.annotations.Nullable; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/OpaqueTerm.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/OpaqueTerm.java index 8faa9c75..6626365f 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/OpaqueTerm.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/OpaqueTerm.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term; import tools.refinery.store.query.equality.LiteralEqualityHelper; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/Sort.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/Sort.java index 622bcfce..2b3345f9 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/Sort.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/Sort.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term; import org.jetbrains.annotations.Nullable; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/StatefulAggregate.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/StatefulAggregate.java index 7ce91305..ab310556 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/StatefulAggregate.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/StatefulAggregate.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term; public interface StatefulAggregate { diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/StatefulAggregator.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/StatefulAggregator.java index c215a511..df746a90 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/StatefulAggregator.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/StatefulAggregator.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term; import java.util.stream.Stream; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/StatelessAggregator.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/StatelessAggregator.java index 74dbd335..a094919e 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/StatelessAggregator.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/StatelessAggregator.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term; import java.util.stream.Stream; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/Term.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/Term.java index 95434db2..e6818b88 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/Term.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/Term.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term; import tools.refinery.store.query.literal.AssignLiteral; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/UnaryTerm.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/UnaryTerm.java index 4083111a..069e0d95 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/UnaryTerm.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/UnaryTerm.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term; import tools.refinery.store.query.equality.LiteralEqualityHelper; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/Variable.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/Variable.java index 957e10f8..c4ca6f77 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/Variable.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/Variable.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term; import org.jetbrains.annotations.Nullable; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/bool/BoolConstantTerm.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/bool/BoolConstantTerm.java index 5079f1ce..e5690ab6 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/bool/BoolConstantTerm.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/bool/BoolConstantTerm.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term.bool; import tools.refinery.store.query.term.ConstantTerm; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/bool/BoolLogicBinaryTerm.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/bool/BoolLogicBinaryTerm.java index d85f864d..11e764c2 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/bool/BoolLogicBinaryTerm.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/bool/BoolLogicBinaryTerm.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term.bool; import tools.refinery.store.query.equality.LiteralEqualityHelper; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/bool/BoolNotTerm.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/bool/BoolNotTerm.java index 855139b5..bb06cf8b 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/bool/BoolNotTerm.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/bool/BoolNotTerm.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term.bool; import tools.refinery.store.query.substitution.Substitution; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/bool/BoolTerms.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/bool/BoolTerms.java index 3d6c8d9d..55825952 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/bool/BoolTerms.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/bool/BoolTerms.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term.bool; import tools.refinery.store.query.term.ConstantTerm; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/bool/LogicBinaryOperator.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/bool/LogicBinaryOperator.java index ca9ac66e..93a72f88 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/bool/LogicBinaryOperator.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/bool/LogicBinaryOperator.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term.bool; public enum LogicBinaryOperator { diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntArithmeticBinaryTerm.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntArithmeticBinaryTerm.java index 32e41718..8a76ecbd 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntArithmeticBinaryTerm.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntArithmeticBinaryTerm.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term.int_; import tools.refinery.store.query.substitution.Substitution; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntArithmeticUnaryTerm.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntArithmeticUnaryTerm.java index 1e769259..8522f2c1 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntArithmeticUnaryTerm.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntArithmeticUnaryTerm.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term.int_; import tools.refinery.store.query.substitution.Substitution; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntComparisonTerm.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntComparisonTerm.java index 322d2b80..2ce2b2f3 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntComparisonTerm.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntComparisonTerm.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term.int_; import tools.refinery.store.query.substitution.Substitution; import tools.refinery.store.query.term.ComparisonOperator; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntExtremeValueAggregator.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntExtremeValueAggregator.java index d5a6add0..7982f45c 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntExtremeValueAggregator.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntExtremeValueAggregator.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term.int_; import tools.refinery.store.query.term.ExtremeValueAggregator; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntSumAggregator.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntSumAggregator.java index 65024f52..cd718c53 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntSumAggregator.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntSumAggregator.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term.int_; import tools.refinery.store.query.term.StatelessAggregator; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntTerms.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntTerms.java index 86594deb..38f7f449 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntTerms.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntTerms.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term.int_; import tools.refinery.store.query.term.*; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/RealToIntTerm.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/RealToIntTerm.java index 53875ddc..399adf4a 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/RealToIntTerm.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/RealToIntTerm.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term.int_; import tools.refinery.store.query.substitution.Substitution; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/IntToRealTerm.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/IntToRealTerm.java index 55590824..4f7d5687 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/IntToRealTerm.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/IntToRealTerm.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term.real; import tools.refinery.store.query.substitution.Substitution; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/RealArithmeticBinaryTerm.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/RealArithmeticBinaryTerm.java index 57bcbe5e..8d5c9242 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/RealArithmeticBinaryTerm.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/RealArithmeticBinaryTerm.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term.real; import tools.refinery.store.query.substitution.Substitution; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/RealArithmeticUnaryTerm.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/RealArithmeticUnaryTerm.java index 632e68bf..9d233dfc 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/RealArithmeticUnaryTerm.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/RealArithmeticUnaryTerm.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term.real; import tools.refinery.store.query.substitution.Substitution; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/RealComparisonTerm.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/RealComparisonTerm.java index 75d97adb..25c88f89 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/RealComparisonTerm.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/RealComparisonTerm.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term.real; import tools.refinery.store.query.substitution.Substitution; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/RealExtremeValueAggregator.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/RealExtremeValueAggregator.java index 23384530..526e643b 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/RealExtremeValueAggregator.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/RealExtremeValueAggregator.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term.real; import tools.refinery.store.query.term.ExtremeValueAggregator; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/RealSumAggregator.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/RealSumAggregator.java index d5888664..306191a3 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/RealSumAggregator.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/RealSumAggregator.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term.real; import tools.refinery.store.query.term.StatefulAggregate; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/RealTerms.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/RealTerms.java index a8117842..1240d478 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/RealTerms.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/real/RealTerms.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.term.real; import tools.refinery.store.query.term.*; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/valuation/RestrictedValuation.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/valuation/RestrictedValuation.java index fb512d88..fc8406aa 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/valuation/RestrictedValuation.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/valuation/RestrictedValuation.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.valuation; import tools.refinery.store.query.term.AnyDataVariable; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/valuation/SubstitutedValuation.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/valuation/SubstitutedValuation.java index 8e79663c..1c14112c 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/valuation/SubstitutedValuation.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/valuation/SubstitutedValuation.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.valuation; import tools.refinery.store.query.substitution.Substitution; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/valuation/Valuation.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/valuation/Valuation.java index 3ba9a6b8..88fee35b 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/valuation/Valuation.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/valuation/Valuation.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.valuation; import org.jetbrains.annotations.Nullable; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/AnyRelationView.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/AnyRelationView.java index 6ae410f2..9aa923af 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/AnyRelationView.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/AnyRelationView.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.view; import tools.refinery.store.model.Model; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/FilteredRelationView.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/FilteredRelationView.java index 64c601bb..9717b2c1 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/FilteredRelationView.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/FilteredRelationView.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.view; import tools.refinery.store.tuple.Tuple; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/ForbiddenRelationView.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/ForbiddenRelationView.java index 050b9496..c19d9282 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/ForbiddenRelationView.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/ForbiddenRelationView.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.view; import tools.refinery.store.representation.Symbol; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/FunctionView.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/FunctionView.java new file mode 100644 index 00000000..cf946d54 --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/FunctionView.java @@ -0,0 +1,25 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ +package tools.refinery.store.query.view; + +import tools.refinery.store.query.term.DataSort; +import tools.refinery.store.query.term.Sort; +import tools.refinery.store.representation.Symbol; + +public final class FunctionView extends AbstractFunctionView { + public FunctionView(Symbol symbol, String name) { + super(symbol, name); + } + + public FunctionView(Symbol symbol) { + this(symbol, "function"); + } + + @Override + protected Sort getForwardMappedValueSort() { + return new DataSort<>(getSymbol().valueType()); + } +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/FunctionalRelationView.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/FunctionalRelationView.java index 7ec9e7ac..ab48386e 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/FunctionalRelationView.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/FunctionalRelationView.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.view; import tools.refinery.store.model.Model; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/KeyOnlyRelationView.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/KeyOnlyRelationView.java index e1b2e45b..9553a0cc 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/KeyOnlyRelationView.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/KeyOnlyRelationView.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.view; import tools.refinery.store.representation.Symbol; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/MayRelationView.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/MayRelationView.java index a2a84b3c..60325f35 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/MayRelationView.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/MayRelationView.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.view; import tools.refinery.store.representation.Symbol; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/MustRelationView.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/MustRelationView.java index 72ac0ca3..d7e7ae2e 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/MustRelationView.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/MustRelationView.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.view; import tools.refinery.store.representation.Symbol; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/NodeFunctionView.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/NodeFunctionView.java new file mode 100644 index 00000000..73c296e0 --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/NodeFunctionView.java @@ -0,0 +1,26 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ +package tools.refinery.store.query.view; + +import tools.refinery.store.query.term.NodeSort; +import tools.refinery.store.query.term.Sort; +import tools.refinery.store.representation.Symbol; +import tools.refinery.store.tuple.Tuple1; + +public final class NodeFunctionView extends AbstractFunctionView { + public NodeFunctionView(Symbol symbol, String name) { + super(symbol, name); + } + + public NodeFunctionView(Symbol symbol) { + this(symbol, "function"); + } + + @Override + protected Sort getForwardMappedValueSort() { + return NodeSort.INSTANCE; + } +} diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/RelationView.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/RelationView.java index d7164b3b..fd4f47b4 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/RelationView.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/RelationView.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.view; import tools.refinery.store.map.CursorAsIterator; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/RelationViewImplication.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/RelationViewImplication.java index 2ba1fcc4..c54cce2f 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/RelationViewImplication.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/RelationViewImplication.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.view; import java.util.List; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/TuplePreservingRelationView.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/TuplePreservingRelationView.java index 234b3a9a..e6e54aa1 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/TuplePreservingRelationView.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/TuplePreservingRelationView.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.view; import tools.refinery.store.model.Model; diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/ViewImplication.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/ViewImplication.java new file mode 100644 index 00000000..fc2db9f2 --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/ViewImplication.java @@ -0,0 +1,23 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ +package tools.refinery.store.query.view; + +import java.util.List; + +public record ViewImplication(AnySymbolView implyingView, AnySymbolView impliedView, List impliedIndices) { + public ViewImplication { + if (impliedIndices.size() != impliedView.arity()) { + throw new IllegalArgumentException("Expected %d implied indices for %s, but %d are provided" + .formatted(impliedView.arity(), impliedView, impliedIndices.size())); + } + for (var index : impliedIndices) { + if (impliedView.invalidIndex(index)) { + throw new IllegalArgumentException("%d is not a valid index for %s".formatted(index, + implyingView)); + } + } + } +} diff --git a/subprojects/store-query/src/test/java/tools/refinery/store/query/DnfBuilderTest.java b/subprojects/store-query/src/test/java/tools/refinery/store/query/DnfBuilderTest.java index ceb46d6f..70cd386b 100644 --- a/subprojects/store-query/src/test/java/tools/refinery/store/query/DnfBuilderTest.java +++ b/subprojects/store-query/src/test/java/tools/refinery/store/query/DnfBuilderTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query; import org.junit.jupiter.api.Test; diff --git a/subprojects/store-query/src/test/java/tools/refinery/store/query/DnfToDefinitionStringTest.java b/subprojects/store-query/src/test/java/tools/refinery/store/query/DnfToDefinitionStringTest.java index 9b469bb0..7be57745 100644 --- a/subprojects/store-query/src/test/java/tools/refinery/store/query/DnfToDefinitionStringTest.java +++ b/subprojects/store-query/src/test/java/tools/refinery/store/query/DnfToDefinitionStringTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query; import org.junit.jupiter.api.Test; diff --git a/subprojects/store-query/src/test/java/tools/refinery/store/query/tests/StructurallyEqualToTest.java b/subprojects/store-query/src/test/java/tools/refinery/store/query/tests/StructurallyEqualToTest.java index a61e2b65..e292b3ab 100644 --- a/subprojects/store-query/src/test/java/tools/refinery/store/query/tests/StructurallyEqualToTest.java +++ b/subprojects/store-query/src/test/java/tools/refinery/store/query/tests/StructurallyEqualToTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.tests; import org.junit.jupiter.api.Test; diff --git a/subprojects/store-query/src/testFixtures/java/tools/refinery/store/query/tests/MismatchDescribingDnfEqualityChecker.java b/subprojects/store-query/src/testFixtures/java/tools/refinery/store/query/tests/MismatchDescribingDnfEqualityChecker.java index 685957c9..526832c4 100644 --- a/subprojects/store-query/src/testFixtures/java/tools/refinery/store/query/tests/MismatchDescribingDnfEqualityChecker.java +++ b/subprojects/store-query/src/testFixtures/java/tools/refinery/store/query/tests/MismatchDescribingDnfEqualityChecker.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.tests; import org.hamcrest.Description; diff --git a/subprojects/store-query/src/testFixtures/java/tools/refinery/store/query/tests/QueryMatchers.java b/subprojects/store-query/src/testFixtures/java/tools/refinery/store/query/tests/QueryMatchers.java index bf1c1b74..8706ef70 100644 --- a/subprojects/store-query/src/testFixtures/java/tools/refinery/store/query/tests/QueryMatchers.java +++ b/subprojects/store-query/src/testFixtures/java/tools/refinery/store/query/tests/QueryMatchers.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.tests; import org.hamcrest.Matcher; diff --git a/subprojects/store-query/src/testFixtures/java/tools/refinery/store/query/tests/StructurallyEqualTo.java b/subprojects/store-query/src/testFixtures/java/tools/refinery/store/query/tests/StructurallyEqualTo.java index a9a78f88..ba51c084 100644 --- a/subprojects/store-query/src/testFixtures/java/tools/refinery/store/query/tests/StructurallyEqualTo.java +++ b/subprojects/store-query/src/testFixtures/java/tools/refinery/store/query/tests/StructurallyEqualTo.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.query.tests; import org.hamcrest.Description; diff --git a/subprojects/store-reasoning/build.gradle.kts b/subprojects/store-reasoning/build.gradle.kts index bb37d9d3..abad0491 100644 --- a/subprojects/store-reasoning/build.gradle.kts +++ b/subprojects/store-reasoning/build.gradle.kts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + plugins { id("tools.refinery.gradle.java-library") } diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/AnyPartialInterpretation.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/AnyPartialInterpretation.java index ebe82c8b..000171a1 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/AnyPartialInterpretation.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/AnyPartialInterpretation.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning; import tools.refinery.store.reasoning.representation.AnyPartialSymbol; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/MergeResult.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/MergeResult.java index 0d51598b..d3a216d8 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/MergeResult.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/MergeResult.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning; public enum MergeResult { diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/PartialInterpretation.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/PartialInterpretation.java index 4f195e97..4140d640 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/PartialInterpretation.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/PartialInterpretation.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning; import tools.refinery.store.reasoning.representation.PartialSymbol; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/Reasoning.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/Reasoning.java index d7d0a999..3d3df2b2 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/Reasoning.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/Reasoning.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning; import tools.refinery.store.reasoning.internal.ReasoningBuilderImpl; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/ReasoningAdapter.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/ReasoningAdapter.java index de039dd9..8dedddf7 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/ReasoningAdapter.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/ReasoningAdapter.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning; import tools.refinery.store.adapter.ModelAdapter; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/ReasoningBuilder.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/ReasoningBuilder.java index 4030d296..df7b6e4d 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/ReasoningBuilder.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/ReasoningBuilder.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning; import tools.refinery.store.adapter.ModelAdapterBuilder; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/ReasoningStoreAdapter.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/ReasoningStoreAdapter.java index f6a6e414..c9795255 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/ReasoningStoreAdapter.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/ReasoningStoreAdapter.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning; import tools.refinery.store.adapter.ModelStoreAdapter; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/internal/ReasoningAdapterImpl.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/internal/ReasoningAdapterImpl.java index 0acf0d49..96514d36 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/internal/ReasoningAdapterImpl.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/internal/ReasoningAdapterImpl.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.internal; import tools.refinery.store.model.Model; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/internal/ReasoningBuilderImpl.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/internal/ReasoningBuilderImpl.java index e11b14bf..49f7c7d3 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/internal/ReasoningBuilderImpl.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/internal/ReasoningBuilderImpl.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.internal; import tools.refinery.store.adapter.AbstractModelAdapterBuilder; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/internal/ReasoningStoreAdapterImpl.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/internal/ReasoningStoreAdapterImpl.java index ac06e68b..cdddd8d6 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/internal/ReasoningStoreAdapterImpl.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/internal/ReasoningStoreAdapterImpl.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.internal; import tools.refinery.store.reasoning.ReasoningStoreAdapter; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/lifting/DnfLifter.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/lifting/DnfLifter.java index 2b0e0f08..157f06e8 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/lifting/DnfLifter.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/lifting/DnfLifter.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.lifting; import org.jetbrains.annotations.Nullable; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/lifting/ModalDnf.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/lifting/ModalDnf.java index ec381bb8..16fb8fbf 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/lifting/ModalDnf.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/lifting/ModalDnf.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.lifting; import tools.refinery.store.query.dnf.Dnf; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/literal/ModalConstraint.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/literal/ModalConstraint.java index 2fbb4607..7fa98104 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/literal/ModalConstraint.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/literal/ModalConstraint.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.literal; import tools.refinery.store.query.Constraint; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/literal/Modality.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/literal/Modality.java index f0cb59de..96466d5c 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/literal/Modality.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/literal/Modality.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.literal; import tools.refinery.store.query.literal.CallPolarity; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/literal/PartialLiterals.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/literal/PartialLiterals.java index f991f87f..0e46a795 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/literal/PartialLiterals.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/literal/PartialLiterals.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.literal; import tools.refinery.store.query.literal.CallLiteral; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/representation/AnyPartialFunction.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/representation/AnyPartialFunction.java index e74cd58b..8d2cb5cf 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/representation/AnyPartialFunction.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/representation/AnyPartialFunction.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.representation; public sealed interface AnyPartialFunction extends AnyPartialSymbol permits PartialFunction { diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/representation/AnyPartialSymbol.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/representation/AnyPartialSymbol.java index 6ff5031b..788eef73 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/representation/AnyPartialSymbol.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/representation/AnyPartialSymbol.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.representation; import tools.refinery.store.representation.AnyAbstractDomain; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/representation/PartialFunction.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/representation/PartialFunction.java index 59eeeefe..d58d026f 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/representation/PartialFunction.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/representation/PartialFunction.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.representation; import tools.refinery.store.representation.AbstractDomain; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/representation/PartialRelation.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/representation/PartialRelation.java index 9bae53a9..fc3dc074 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/representation/PartialRelation.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/representation/PartialRelation.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.representation; import tools.refinery.store.query.Constraint; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/representation/PartialSymbol.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/representation/PartialSymbol.java index 1af11f2e..3a08bdd8 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/representation/PartialSymbol.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/representation/PartialSymbol.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.representation; import tools.refinery.store.representation.AbstractDomain; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/rule/RelationRefinementAction.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/rule/RelationRefinementAction.java index e8ed05a3..e4c702ea 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/rule/RelationRefinementAction.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/rule/RelationRefinementAction.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.rule; import tools.refinery.store.reasoning.Reasoning; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/rule/Rule.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/rule/Rule.java index c7b16d47..45b0f02e 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/rule/Rule.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/rule/Rule.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.rule; import tools.refinery.store.model.Model; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/rule/RuleAction.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/rule/RuleAction.java index 4753b8bc..97ea7313 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/rule/RuleAction.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/rule/RuleAction.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.rule; import tools.refinery.store.model.Model; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/rule/RuleActionExecutor.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/rule/RuleActionExecutor.java index 7c51e3df..5d743869 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/rule/RuleActionExecutor.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/rule/RuleActionExecutor.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.rule; import tools.refinery.store.reasoning.MergeResult; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/rule/RuleExecutor.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/rule/RuleExecutor.java index c20645fc..32cf13ea 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/rule/RuleExecutor.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/rule/RuleExecutor.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.rule; import tools.refinery.store.model.Model; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/seed/Seed.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/seed/Seed.java index 90633495..08079f12 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/seed/Seed.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/seed/Seed.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.seed; import tools.refinery.store.map.Cursor; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/seed/UniformSeed.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/seed/UniformSeed.java index a030f6ea..451d1513 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/seed/UniformSeed.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/seed/UniformSeed.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.seed; import tools.refinery.store.map.Cursor; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/Advice.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/Advice.java index 5cdfedf7..dd7a018d 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/Advice.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/Advice.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.translator; import tools.refinery.store.reasoning.representation.AnyPartialSymbol; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/AdviceSlot.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/AdviceSlot.java index f3bd9c5e..bab20340 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/AdviceSlot.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/AdviceSlot.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.translator; import tools.refinery.store.representation.TruthValue; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/TranslatedRelation.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/TranslatedRelation.java index 9bab80c9..4a5a8843 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/TranslatedRelation.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/TranslatedRelation.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.translator; import tools.refinery.store.model.Model; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/TranslationUnit.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/TranslationUnit.java index 24b93911..7f01122b 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/TranslationUnit.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/TranslationUnit.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.translator; import tools.refinery.store.model.Model; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/base/BaseDecisionInterpretation.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/base/BaseDecisionInterpretation.java index b703f142..e7b67ae4 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/base/BaseDecisionInterpretation.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/base/BaseDecisionInterpretation.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.translator.base; import tools.refinery.store.map.Cursor; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/base/BaseDecisionTranslationUnit.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/base/BaseDecisionTranslationUnit.java index 36e2782a..d41e11c6 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/base/BaseDecisionTranslationUnit.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/base/BaseDecisionTranslationUnit.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.translator.base; import tools.refinery.store.model.Model; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/base/TranslatedBaseDecision.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/base/TranslatedBaseDecision.java index 2294b4fd..4782eb46 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/base/TranslatedBaseDecision.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/base/TranslatedBaseDecision.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.translator.base; import tools.refinery.store.model.Model; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/EliminatedType.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/EliminatedType.java index 1b8d7cc9..6e4728db 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/EliminatedType.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/EliminatedType.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.translator.typehierarchy; import tools.refinery.store.reasoning.representation.PartialRelation; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/ExtendedTypeInfo.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/ExtendedTypeInfo.java index 43b8e1dd..7a917dcf 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/ExtendedTypeInfo.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/ExtendedTypeInfo.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.translator.typehierarchy; import org.jetbrains.annotations.NotNull; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/InferredMayTypeRelationView.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/InferredMayTypeRelationView.java index 12c37c86..aea0a4b9 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/InferredMayTypeRelationView.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/InferredMayTypeRelationView.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.translator.typehierarchy; import tools.refinery.store.reasoning.representation.PartialRelation; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/InferredMustTypeRelationView.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/InferredMustTypeRelationView.java index 975f627e..6c995e3a 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/InferredMustTypeRelationView.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/InferredMustTypeRelationView.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.translator.typehierarchy; import tools.refinery.store.reasoning.representation.PartialRelation; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/InferredType.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/InferredType.java index a366e262..fd05158b 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/InferredType.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/InferredType.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.translator.typehierarchy; import tools.refinery.store.reasoning.representation.PartialRelation; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/PreservedType.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/PreservedType.java index 63dba964..0696f4c3 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/PreservedType.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/PreservedType.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.translator.typehierarchy; import tools.refinery.store.reasoning.representation.PartialRelation; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeAnalysisResult.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeAnalysisResult.java index 4f915108..fbf8a7c9 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeAnalysisResult.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeAnalysisResult.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.translator.typehierarchy; sealed interface TypeAnalysisResult permits EliminatedType, PreservedType { diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeAnalyzer.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeAnalyzer.java index 62f8e750..e97ce954 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeAnalyzer.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeAnalyzer.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.translator.typehierarchy; import tools.refinery.store.reasoning.representation.PartialRelation; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeHierarchyTranslationUnit.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeHierarchyTranslationUnit.java index 4b0761f2..e1aa2014 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeHierarchyTranslationUnit.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeHierarchyTranslationUnit.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.translator.typehierarchy; import tools.refinery.store.model.Model; diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeInfo.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeInfo.java index 313df4df..9f897e46 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeInfo.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeInfo.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.translator.typehierarchy; import tools.refinery.store.reasoning.representation.PartialRelation; diff --git a/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/typehierarchy/InferredTypeTest.java b/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/typehierarchy/InferredTypeTest.java index a8df2312..1d76855c 100644 --- a/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/typehierarchy/InferredTypeTest.java +++ b/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/typehierarchy/InferredTypeTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.translator.typehierarchy; import org.junit.jupiter.api.Test; diff --git a/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeAnalyzerExampleHierarchyTest.java b/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeAnalyzerExampleHierarchyTest.java index b2c1ef1b..05a476c6 100644 --- a/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeAnalyzerExampleHierarchyTest.java +++ b/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeAnalyzerExampleHierarchyTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.translator.typehierarchy; import org.junit.jupiter.api.BeforeEach; diff --git a/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeAnalyzerTest.java b/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeAnalyzerTest.java index b7b69ed8..d0ef9d57 100644 --- a/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeAnalyzerTest.java +++ b/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeAnalyzerTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.translator.typehierarchy; import org.junit.jupiter.api.Test; diff --git a/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeAnalyzerTester.java b/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeAnalyzerTester.java index 56407730..2924816e 100644 --- a/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeAnalyzerTester.java +++ b/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeAnalyzerTester.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.reasoning.translator.typehierarchy; import tools.refinery.store.reasoning.representation.PartialRelation; diff --git a/subprojects/store/build.gradle.kts b/subprojects/store/build.gradle.kts index d62e5159..2c485020 100644 --- a/subprojects/store/build.gradle.kts +++ b/subprojects/store/build.gradle.kts @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ + plugins { id("tools.refinery.gradle.java-library") id("tools.refinery.gradle.jmh") diff --git a/subprojects/store/src/jmh/java/tools/refinery/store/map/benchmarks/ImmutablePutBenchmark.java b/subprojects/store/src/jmh/java/tools/refinery/store/map/benchmarks/ImmutablePutBenchmark.java index cdf3d3c8..485fda3d 100644 --- a/subprojects/store/src/jmh/java/tools/refinery/store/map/benchmarks/ImmutablePutBenchmark.java +++ b/subprojects/store/src/jmh/java/tools/refinery/store/map/benchmarks/ImmutablePutBenchmark.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map.benchmarks; import java.util.ArrayList; diff --git a/subprojects/store/src/jmh/java/tools/refinery/store/map/benchmarks/ImmutablePutExecutionPlan.java b/subprojects/store/src/jmh/java/tools/refinery/store/map/benchmarks/ImmutablePutExecutionPlan.java index 756d504e..edd4f53e 100644 --- a/subprojects/store/src/jmh/java/tools/refinery/store/map/benchmarks/ImmutablePutExecutionPlan.java +++ b/subprojects/store/src/jmh/java/tools/refinery/store/map/benchmarks/ImmutablePutExecutionPlan.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map.benchmarks; import java.util.Random; diff --git a/subprojects/store/src/main/java/tools/refinery/store/adapter/AbstractModelAdapterBuilder.java b/subprojects/store/src/main/java/tools/refinery/store/adapter/AbstractModelAdapterBuilder.java index 4c142217..70602ef5 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/adapter/AbstractModelAdapterBuilder.java +++ b/subprojects/store/src/main/java/tools/refinery/store/adapter/AbstractModelAdapterBuilder.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.adapter; import tools.refinery.store.model.ModelStore; diff --git a/subprojects/store/src/main/java/tools/refinery/store/adapter/AdapterList.java b/subprojects/store/src/main/java/tools/refinery/store/adapter/AdapterList.java index 74bae6f0..e896d8d9 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/adapter/AdapterList.java +++ b/subprojects/store/src/main/java/tools/refinery/store/adapter/AdapterList.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.adapter; import org.jetbrains.annotations.NotNull; diff --git a/subprojects/store/src/main/java/tools/refinery/store/adapter/AnyModelAdapterType.java b/subprojects/store/src/main/java/tools/refinery/store/adapter/AnyModelAdapterType.java index 37a247fe..f161a60b 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/adapter/AnyModelAdapterType.java +++ b/subprojects/store/src/main/java/tools/refinery/store/adapter/AnyModelAdapterType.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.adapter; import java.util.Collection; diff --git a/subprojects/store/src/main/java/tools/refinery/store/adapter/ModelAdapter.java b/subprojects/store/src/main/java/tools/refinery/store/adapter/ModelAdapter.java index aa079e01..672007aa 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/adapter/ModelAdapter.java +++ b/subprojects/store/src/main/java/tools/refinery/store/adapter/ModelAdapter.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.adapter; import tools.refinery.store.model.Model; diff --git a/subprojects/store/src/main/java/tools/refinery/store/adapter/ModelAdapterBuilder.java b/subprojects/store/src/main/java/tools/refinery/store/adapter/ModelAdapterBuilder.java index 64b3e59f..709cbb3e 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/adapter/ModelAdapterBuilder.java +++ b/subprojects/store/src/main/java/tools/refinery/store/adapter/ModelAdapterBuilder.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.adapter; import tools.refinery.store.model.ModelStore; diff --git a/subprojects/store/src/main/java/tools/refinery/store/adapter/ModelAdapterBuilderFactory.java b/subprojects/store/src/main/java/tools/refinery/store/adapter/ModelAdapterBuilderFactory.java index 7c9b01bc..1d549d5b 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/adapter/ModelAdapterBuilderFactory.java +++ b/subprojects/store/src/main/java/tools/refinery/store/adapter/ModelAdapterBuilderFactory.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.adapter; import tools.refinery.store.model.ModelStoreBuilder; diff --git a/subprojects/store/src/main/java/tools/refinery/store/adapter/ModelAdapterType.java b/subprojects/store/src/main/java/tools/refinery/store/adapter/ModelAdapterType.java index 82ddeb12..6255fe52 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/adapter/ModelAdapterType.java +++ b/subprojects/store/src/main/java/tools/refinery/store/adapter/ModelAdapterType.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.adapter; import tools.refinery.store.model.Model; diff --git a/subprojects/store/src/main/java/tools/refinery/store/adapter/ModelStoreAdapter.java b/subprojects/store/src/main/java/tools/refinery/store/adapter/ModelStoreAdapter.java index 1eb40ada..bc5f7b6b 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/adapter/ModelStoreAdapter.java +++ b/subprojects/store/src/main/java/tools/refinery/store/adapter/ModelStoreAdapter.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.adapter; import tools.refinery.store.model.Model; diff --git a/subprojects/store/src/main/java/tools/refinery/store/map/AnyVersionedMap.java b/subprojects/store/src/main/java/tools/refinery/store/map/AnyVersionedMap.java index f82a8bb1..25fc91e6 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/map/AnyVersionedMap.java +++ b/subprojects/store/src/main/java/tools/refinery/store/map/AnyVersionedMap.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map; public sealed interface AnyVersionedMap extends Versioned permits VersionedMap { diff --git a/subprojects/store/src/main/java/tools/refinery/store/map/ContentHashCode.java b/subprojects/store/src/main/java/tools/refinery/store/map/ContentHashCode.java index 8deeab23..cbea05e1 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/map/ContentHashCode.java +++ b/subprojects/store/src/main/java/tools/refinery/store/map/ContentHashCode.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map; public enum ContentHashCode { diff --git a/subprojects/store/src/main/java/tools/refinery/store/map/ContinousHashProvider.java b/subprojects/store/src/main/java/tools/refinery/store/map/ContinousHashProvider.java index 75f1e2ab..8e451230 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/map/ContinousHashProvider.java +++ b/subprojects/store/src/main/java/tools/refinery/store/map/ContinousHashProvider.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map; import tools.refinery.store.map.internal.Node; diff --git a/subprojects/store/src/main/java/tools/refinery/store/map/Cursor.java b/subprojects/store/src/main/java/tools/refinery/store/map/Cursor.java index b420585c..3bdca104 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/map/Cursor.java +++ b/subprojects/store/src/main/java/tools/refinery/store/map/Cursor.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map; import java.util.Set; diff --git a/subprojects/store/src/main/java/tools/refinery/store/map/CursorAsIterator.java b/subprojects/store/src/main/java/tools/refinery/store/map/CursorAsIterator.java index 65ae6648..c7e4d279 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/map/CursorAsIterator.java +++ b/subprojects/store/src/main/java/tools/refinery/store/map/CursorAsIterator.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map; import java.util.Iterator; diff --git a/subprojects/store/src/main/java/tools/refinery/store/map/Cursors.java b/subprojects/store/src/main/java/tools/refinery/store/map/Cursors.java index fc8e628b..0a94d449 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/map/Cursors.java +++ b/subprojects/store/src/main/java/tools/refinery/store/map/Cursors.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map; public final class Cursors { diff --git a/subprojects/store/src/main/java/tools/refinery/store/map/DiffCursor.java b/subprojects/store/src/main/java/tools/refinery/store/map/DiffCursor.java index 701f3ec8..4322e041 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/map/DiffCursor.java +++ b/subprojects/store/src/main/java/tools/refinery/store/map/DiffCursor.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map; public interface DiffCursor extends Cursor { diff --git a/subprojects/store/src/main/java/tools/refinery/store/map/MapAsIterable.java b/subprojects/store/src/main/java/tools/refinery/store/map/MapAsIterable.java index 6b986732..199b548f 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/map/MapAsIterable.java +++ b/subprojects/store/src/main/java/tools/refinery/store/map/MapAsIterable.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map; import java.util.Iterator; diff --git a/subprojects/store/src/main/java/tools/refinery/store/map/Versioned.java b/subprojects/store/src/main/java/tools/refinery/store/map/Versioned.java index 6a23e9d5..55720db3 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/map/Versioned.java +++ b/subprojects/store/src/main/java/tools/refinery/store/map/Versioned.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map; public interface Versioned { diff --git a/subprojects/store/src/main/java/tools/refinery/store/map/VersionedMap.java b/subprojects/store/src/main/java/tools/refinery/store/map/VersionedMap.java index 31985e94..9bbde24d 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/map/VersionedMap.java +++ b/subprojects/store/src/main/java/tools/refinery/store/map/VersionedMap.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map; public non-sealed interface VersionedMap extends AnyVersionedMap { diff --git a/subprojects/store/src/main/java/tools/refinery/store/map/VersionedMapStore.java b/subprojects/store/src/main/java/tools/refinery/store/map/VersionedMapStore.java index a8d7fb1a..5aafa338 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/map/VersionedMapStore.java +++ b/subprojects/store/src/main/java/tools/refinery/store/map/VersionedMapStore.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map; import java.util.Set; diff --git a/subprojects/store/src/main/java/tools/refinery/store/map/VersionedMapStoreConfiguration.java b/subprojects/store/src/main/java/tools/refinery/store/map/VersionedMapStoreConfiguration.java index 3856460d..b00cd961 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/map/VersionedMapStoreConfiguration.java +++ b/subprojects/store/src/main/java/tools/refinery/store/map/VersionedMapStoreConfiguration.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map; public class VersionedMapStoreConfiguration { diff --git a/subprojects/store/src/main/java/tools/refinery/store/map/VersionedMapStoreImpl.java b/subprojects/store/src/main/java/tools/refinery/store/map/VersionedMapStoreImpl.java index 113874e7..aade4aeb 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/map/VersionedMapStoreImpl.java +++ b/subprojects/store/src/main/java/tools/refinery/store/map/VersionedMapStoreImpl.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map; import tools.refinery.store.map.internal.ImmutableNode; diff --git a/subprojects/store/src/main/java/tools/refinery/store/map/internal/HashClash.java b/subprojects/store/src/main/java/tools/refinery/store/map/internal/HashClash.java index 5402ed4a..61b3d1b8 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/map/internal/HashClash.java +++ b/subprojects/store/src/main/java/tools/refinery/store/map/internal/HashClash.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map.internal; enum HashClash { diff --git a/subprojects/store/src/main/java/tools/refinery/store/map/internal/ImmutableNode.java b/subprojects/store/src/main/java/tools/refinery/store/map/internal/ImmutableNode.java index 9397dede..03dffc15 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/map/internal/ImmutableNode.java +++ b/subprojects/store/src/main/java/tools/refinery/store/map/internal/ImmutableNode.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map.internal; import java.util.Arrays; diff --git a/subprojects/store/src/main/java/tools/refinery/store/map/internal/MapCursor.java b/subprojects/store/src/main/java/tools/refinery/store/map/internal/MapCursor.java index 91a71e3d..f34ec7bb 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/map/internal/MapCursor.java +++ b/subprojects/store/src/main/java/tools/refinery/store/map/internal/MapCursor.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map.internal; import tools.refinery.store.map.AnyVersionedMap; diff --git a/subprojects/store/src/main/java/tools/refinery/store/map/internal/MapDiffCursor.java b/subprojects/store/src/main/java/tools/refinery/store/map/internal/MapDiffCursor.java index 9cd78113..d31f1a05 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/map/internal/MapDiffCursor.java +++ b/subprojects/store/src/main/java/tools/refinery/store/map/internal/MapDiffCursor.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map.internal; import tools.refinery.store.map.AnyVersionedMap; diff --git a/subprojects/store/src/main/java/tools/refinery/store/map/internal/MutableNode.java b/subprojects/store/src/main/java/tools/refinery/store/map/internal/MutableNode.java index 7c3cf7e8..1129ee5a 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/map/internal/MutableNode.java +++ b/subprojects/store/src/main/java/tools/refinery/store/map/internal/MutableNode.java @@ -1,10 +1,15 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map.internal; +import tools.refinery.store.map.ContinousHashProvider; + import java.util.Arrays; import java.util.Map; -import tools.refinery.store.map.ContinousHashProvider; - public class MutableNode extends Node { int cachedHash; protected Object[] content; diff --git a/subprojects/store/src/main/java/tools/refinery/store/map/internal/Node.java b/subprojects/store/src/main/java/tools/refinery/store/map/internal/Node.java index 2260cd5b..958d645f 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/map/internal/Node.java +++ b/subprojects/store/src/main/java/tools/refinery/store/map/internal/Node.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map.internal; import java.util.Map; diff --git a/subprojects/store/src/main/java/tools/refinery/store/map/internal/OldValueBox.java b/subprojects/store/src/main/java/tools/refinery/store/map/internal/OldValueBox.java index 5534c703..354af51d 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/map/internal/OldValueBox.java +++ b/subprojects/store/src/main/java/tools/refinery/store/map/internal/OldValueBox.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map.internal; public class OldValueBox{ diff --git a/subprojects/store/src/main/java/tools/refinery/store/map/internal/VersionedMapImpl.java b/subprojects/store/src/main/java/tools/refinery/store/map/internal/VersionedMapImpl.java index 301bcb95..7abece0d 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/map/internal/VersionedMapImpl.java +++ b/subprojects/store/src/main/java/tools/refinery/store/map/internal/VersionedMapImpl.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map.internal; import tools.refinery.store.map.*; diff --git a/subprojects/store/src/main/java/tools/refinery/store/model/AnyInterpretation.java b/subprojects/store/src/main/java/tools/refinery/store/model/AnyInterpretation.java index d18ba71d..f906b48a 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/model/AnyInterpretation.java +++ b/subprojects/store/src/main/java/tools/refinery/store/model/AnyInterpretation.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.model; import tools.refinery.store.representation.AnySymbol; diff --git a/subprojects/store/src/main/java/tools/refinery/store/model/Interpretation.java b/subprojects/store/src/main/java/tools/refinery/store/model/Interpretation.java index 55949d0c..26ad9a69 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/model/Interpretation.java +++ b/subprojects/store/src/main/java/tools/refinery/store/model/Interpretation.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.model; import tools.refinery.store.map.Cursor; diff --git a/subprojects/store/src/main/java/tools/refinery/store/model/InterpretationListener.java b/subprojects/store/src/main/java/tools/refinery/store/model/InterpretationListener.java index 73950779..6f7b24c1 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/model/InterpretationListener.java +++ b/subprojects/store/src/main/java/tools/refinery/store/model/InterpretationListener.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.model; import tools.refinery.store.tuple.Tuple; diff --git a/subprojects/store/src/main/java/tools/refinery/store/model/Model.java b/subprojects/store/src/main/java/tools/refinery/store/model/Model.java index 6ca1ac7b..f4131756 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/model/Model.java +++ b/subprojects/store/src/main/java/tools/refinery/store/model/Model.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.model; import tools.refinery.store.adapter.ModelAdapter; diff --git a/subprojects/store/src/main/java/tools/refinery/store/model/ModelDiffCursor.java b/subprojects/store/src/main/java/tools/refinery/store/model/ModelDiffCursor.java index 97bf2039..7b236891 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/model/ModelDiffCursor.java +++ b/subprojects/store/src/main/java/tools/refinery/store/model/ModelDiffCursor.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.model; import tools.refinery.store.map.DiffCursor; diff --git a/subprojects/store/src/main/java/tools/refinery/store/model/ModelListener.java b/subprojects/store/src/main/java/tools/refinery/store/model/ModelListener.java index f67540bb..a9ad8cfd 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/model/ModelListener.java +++ b/subprojects/store/src/main/java/tools/refinery/store/model/ModelListener.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.model; public interface ModelListener { diff --git a/subprojects/store/src/main/java/tools/refinery/store/model/ModelStore.java b/subprojects/store/src/main/java/tools/refinery/store/model/ModelStore.java index 2e7e62c3..a72399f7 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/model/ModelStore.java +++ b/subprojects/store/src/main/java/tools/refinery/store/model/ModelStore.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.model; import tools.refinery.store.adapter.ModelAdapterType; diff --git a/subprojects/store/src/main/java/tools/refinery/store/model/ModelStoreBuilder.java b/subprojects/store/src/main/java/tools/refinery/store/model/ModelStoreBuilder.java index 289099da..d9354bdb 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/model/ModelStoreBuilder.java +++ b/subprojects/store/src/main/java/tools/refinery/store/model/ModelStoreBuilder.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.model; import tools.refinery.store.adapter.ModelAdapterBuilder; diff --git a/subprojects/store/src/main/java/tools/refinery/store/model/TupleHashProvider.java b/subprojects/store/src/main/java/tools/refinery/store/model/TupleHashProvider.java index 4bcf9ff4..fe1c2ab5 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/model/TupleHashProvider.java +++ b/subprojects/store/src/main/java/tools/refinery/store/model/TupleHashProvider.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.model; import tools.refinery.store.map.ContinousHashProvider; diff --git a/subprojects/store/src/main/java/tools/refinery/store/model/TupleHashProviderBitMagic.java b/subprojects/store/src/main/java/tools/refinery/store/model/TupleHashProviderBitMagic.java index 33059a1b..14116a90 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/model/TupleHashProviderBitMagic.java +++ b/subprojects/store/src/main/java/tools/refinery/store/model/TupleHashProviderBitMagic.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.model; import tools.refinery.store.map.ContinousHashProvider; diff --git a/subprojects/store/src/main/java/tools/refinery/store/model/internal/ModelAction.java b/subprojects/store/src/main/java/tools/refinery/store/model/internal/ModelAction.java index f68859db..dbd95d80 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/model/internal/ModelAction.java +++ b/subprojects/store/src/main/java/tools/refinery/store/model/internal/ModelAction.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.model.internal; public enum ModelAction { diff --git a/subprojects/store/src/main/java/tools/refinery/store/model/internal/ModelImpl.java b/subprojects/store/src/main/java/tools/refinery/store/model/internal/ModelImpl.java index 9eb438c4..50a408da 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/model/internal/ModelImpl.java +++ b/subprojects/store/src/main/java/tools/refinery/store/model/internal/ModelImpl.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.model.internal; import tools.refinery.store.adapter.AdapterList; diff --git a/subprojects/store/src/main/java/tools/refinery/store/model/internal/ModelStoreBuilderImpl.java b/subprojects/store/src/main/java/tools/refinery/store/model/internal/ModelStoreBuilderImpl.java index 79f7195d..70bccb96 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/model/internal/ModelStoreBuilderImpl.java +++ b/subprojects/store/src/main/java/tools/refinery/store/model/internal/ModelStoreBuilderImpl.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.model.internal; import tools.refinery.store.adapter.AdapterList; diff --git a/subprojects/store/src/main/java/tools/refinery/store/model/internal/ModelStoreImpl.java b/subprojects/store/src/main/java/tools/refinery/store/model/internal/ModelStoreImpl.java index e8c205e4..bfae7181 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/model/internal/ModelStoreImpl.java +++ b/subprojects/store/src/main/java/tools/refinery/store/model/internal/ModelStoreImpl.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.model.internal; import tools.refinery.store.adapter.AdapterList; diff --git a/subprojects/store/src/main/java/tools/refinery/store/model/internal/SymbolEquivalenceClass.java b/subprojects/store/src/main/java/tools/refinery/store/model/internal/SymbolEquivalenceClass.java index 5bf1b90d..136f2976 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/model/internal/SymbolEquivalenceClass.java +++ b/subprojects/store/src/main/java/tools/refinery/store/model/internal/SymbolEquivalenceClass.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.model.internal; import tools.refinery.store.representation.Symbol; diff --git a/subprojects/store/src/main/java/tools/refinery/store/model/internal/VersionedInterpretation.java b/subprojects/store/src/main/java/tools/refinery/store/model/internal/VersionedInterpretation.java index 6d82f5d7..86101ce3 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/model/internal/VersionedInterpretation.java +++ b/subprojects/store/src/main/java/tools/refinery/store/model/internal/VersionedInterpretation.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.model.internal; import tools.refinery.store.map.Cursor; diff --git a/subprojects/store/src/main/java/tools/refinery/store/representation/AbstractDomain.java b/subprojects/store/src/main/java/tools/refinery/store/representation/AbstractDomain.java index 18903ead..52c740e8 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/representation/AbstractDomain.java +++ b/subprojects/store/src/main/java/tools/refinery/store/representation/AbstractDomain.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.representation; import java.util.Optional; diff --git a/subprojects/store/src/main/java/tools/refinery/store/representation/AnyAbstractDomain.java b/subprojects/store/src/main/java/tools/refinery/store/representation/AnyAbstractDomain.java index 4c428a1e..c354fab7 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/representation/AnyAbstractDomain.java +++ b/subprojects/store/src/main/java/tools/refinery/store/representation/AnyAbstractDomain.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.representation; public sealed interface AnyAbstractDomain permits AbstractDomain { diff --git a/subprojects/store/src/main/java/tools/refinery/store/representation/AnySymbol.java b/subprojects/store/src/main/java/tools/refinery/store/representation/AnySymbol.java index 20b9eead..b2377905 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/representation/AnySymbol.java +++ b/subprojects/store/src/main/java/tools/refinery/store/representation/AnySymbol.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.representation; public sealed interface AnySymbol permits Symbol { diff --git a/subprojects/store/src/main/java/tools/refinery/store/representation/Symbol.java b/subprojects/store/src/main/java/tools/refinery/store/representation/Symbol.java index 30b1c03f..aad88921 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/representation/Symbol.java +++ b/subprojects/store/src/main/java/tools/refinery/store/representation/Symbol.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.representation; public record Symbol(String name, int arity, Class valueType, T defaultValue) implements AnySymbol { diff --git a/subprojects/store/src/main/java/tools/refinery/store/representation/TruthValue.java b/subprojects/store/src/main/java/tools/refinery/store/representation/TruthValue.java index b7893fd3..40baf9a5 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/representation/TruthValue.java +++ b/subprojects/store/src/main/java/tools/refinery/store/representation/TruthValue.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.representation; public enum TruthValue { diff --git a/subprojects/store/src/main/java/tools/refinery/store/representation/TruthValueDomain.java b/subprojects/store/src/main/java/tools/refinery/store/representation/TruthValueDomain.java index 29858bce..89f8dd19 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/representation/TruthValueDomain.java +++ b/subprojects/store/src/main/java/tools/refinery/store/representation/TruthValueDomain.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.representation; import java.util.Optional; diff --git a/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/CardinalityInterval.java b/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/CardinalityInterval.java index 273d0de7..704ca2fc 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/CardinalityInterval.java +++ b/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/CardinalityInterval.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.representation.cardinality; public sealed interface CardinalityInterval permits NonEmptyCardinalityInterval, EmptyCardinalityInterval { diff --git a/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/CardinalityIntervals.java b/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/CardinalityIntervals.java index e1a08bf9..ad16a3e8 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/CardinalityIntervals.java +++ b/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/CardinalityIntervals.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.representation.cardinality; public final class CardinalityIntervals { diff --git a/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/EmptyCardinalityInterval.java b/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/EmptyCardinalityInterval.java index ab3ad9d1..49911c29 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/EmptyCardinalityInterval.java +++ b/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/EmptyCardinalityInterval.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.representation.cardinality; public final class EmptyCardinalityInterval implements CardinalityInterval { diff --git a/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/FiniteUpperCardinality.java b/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/FiniteUpperCardinality.java index 381c8a57..82afdbbc 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/FiniteUpperCardinality.java +++ b/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/FiniteUpperCardinality.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.representation.cardinality; import org.jetbrains.annotations.NotNull; diff --git a/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/NonEmptyCardinalityInterval.java b/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/NonEmptyCardinalityInterval.java index 32b3786f..38bd53bf 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/NonEmptyCardinalityInterval.java +++ b/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/NonEmptyCardinalityInterval.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.representation.cardinality; import java.util.function.BinaryOperator; diff --git a/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/UnboundedUpperCardinality.java b/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/UnboundedUpperCardinality.java index 593bc322..a5634020 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/UnboundedUpperCardinality.java +++ b/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/UnboundedUpperCardinality.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.representation.cardinality; import org.jetbrains.annotations.NotNull; diff --git a/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/UpperCardinalities.java b/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/UpperCardinalities.java index d850fdc9..1e18dde0 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/UpperCardinalities.java +++ b/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/UpperCardinalities.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.representation.cardinality; public final class UpperCardinalities { diff --git a/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/UpperCardinality.java b/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/UpperCardinality.java index c6e31cb7..5dbaa922 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/UpperCardinality.java +++ b/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/UpperCardinality.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.representation.cardinality; public sealed interface UpperCardinality extends Comparable permits FiniteUpperCardinality, diff --git a/subprojects/store/src/main/java/tools/refinery/store/tuple/Tuple.java b/subprojects/store/src/main/java/tools/refinery/store/tuple/Tuple.java index 51e2895a..6700417a 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/tuple/Tuple.java +++ b/subprojects/store/src/main/java/tools/refinery/store/tuple/Tuple.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.tuple; public sealed interface Tuple permits Tuple0, Tuple1, Tuple2, Tuple3, Tuple4, TupleN { diff --git a/subprojects/store/src/main/java/tools/refinery/store/tuple/Tuple0.java b/subprojects/store/src/main/java/tools/refinery/store/tuple/Tuple0.java index 266e2cca..1451099c 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/tuple/Tuple0.java +++ b/subprojects/store/src/main/java/tools/refinery/store/tuple/Tuple0.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.tuple; import static tools.refinery.store.tuple.TupleConstants.TUPLE_BEGIN; diff --git a/subprojects/store/src/main/java/tools/refinery/store/tuple/Tuple1.java b/subprojects/store/src/main/java/tools/refinery/store/tuple/Tuple1.java index bdcc47b5..cda145d7 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/tuple/Tuple1.java +++ b/subprojects/store/src/main/java/tools/refinery/store/tuple/Tuple1.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.tuple; import tools.refinery.store.model.TupleHashProvider; diff --git a/subprojects/store/src/main/java/tools/refinery/store/tuple/Tuple2.java b/subprojects/store/src/main/java/tools/refinery/store/tuple/Tuple2.java index fc0fbd8e..b669674b 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/tuple/Tuple2.java +++ b/subprojects/store/src/main/java/tools/refinery/store/tuple/Tuple2.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.tuple; import static tools.refinery.store.tuple.TupleConstants.*; diff --git a/subprojects/store/src/main/java/tools/refinery/store/tuple/Tuple3.java b/subprojects/store/src/main/java/tools/refinery/store/tuple/Tuple3.java index a6ec17b0..542ed328 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/tuple/Tuple3.java +++ b/subprojects/store/src/main/java/tools/refinery/store/tuple/Tuple3.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.tuple; import static tools.refinery.store.tuple.TupleConstants.*; diff --git a/subprojects/store/src/main/java/tools/refinery/store/tuple/Tuple4.java b/subprojects/store/src/main/java/tools/refinery/store/tuple/Tuple4.java index 66cef32b..121a15f6 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/tuple/Tuple4.java +++ b/subprojects/store/src/main/java/tools/refinery/store/tuple/Tuple4.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.tuple; import static tools.refinery.store.tuple.TupleConstants.*; diff --git a/subprojects/store/src/main/java/tools/refinery/store/tuple/TupleConstants.java b/subprojects/store/src/main/java/tools/refinery/store/tuple/TupleConstants.java index 3d95a655..f7d27848 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/tuple/TupleConstants.java +++ b/subprojects/store/src/main/java/tools/refinery/store/tuple/TupleConstants.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.tuple; final class TupleConstants { diff --git a/subprojects/store/src/main/java/tools/refinery/store/tuple/TupleN.java b/subprojects/store/src/main/java/tools/refinery/store/tuple/TupleN.java index 512bab49..b66af491 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/tuple/TupleN.java +++ b/subprojects/store/src/main/java/tools/refinery/store/tuple/TupleN.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.tuple; import java.util.Arrays; diff --git a/subprojects/store/src/main/java/tools/refinery/store/util/CollectionsUtil.java b/subprojects/store/src/main/java/tools/refinery/store/util/CollectionsUtil.java index 841d0dfa..adecd79b 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/util/CollectionsUtil.java +++ b/subprojects/store/src/main/java/tools/refinery/store/util/CollectionsUtil.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.util; import java.util.Iterator; diff --git a/subprojects/store/src/main/java/tools/refinery/store/util/CycleDetectingMapper.java b/subprojects/store/src/main/java/tools/refinery/store/util/CycleDetectingMapper.java index 8a151d01..78ad2ad7 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/util/CycleDetectingMapper.java +++ b/subprojects/store/src/main/java/tools/refinery/store/util/CycleDetectingMapper.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.util; import java.util.*; diff --git a/subprojects/store/src/test/java/tools/refinery/store/map/tests/MapUnitTests.java b/subprojects/store/src/test/java/tools/refinery/store/map/tests/MapUnitTests.java index 77c62305..153f2e78 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/map/tests/MapUnitTests.java +++ b/subprojects/store/src/test/java/tools/refinery/store/map/tests/MapUnitTests.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map.tests; import org.junit.jupiter.api.Test; diff --git a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/CommitFuzzTest.java b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/CommitFuzzTest.java index 1f9d022f..eabe5bd1 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/CommitFuzzTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/CommitFuzzTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map.tests.fuzz; import static org.junit.jupiter.api.Assertions.fail; diff --git a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/ContentEqualsFuzzTest.java b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/ContentEqualsFuzzTest.java index 93ecfec3..b0502a2b 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/ContentEqualsFuzzTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/ContentEqualsFuzzTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map.tests.fuzz; import org.junit.jupiter.api.Tag; diff --git a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/DiffCursorFuzzTest.java b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/DiffCursorFuzzTest.java index e6334224..8274336e 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/DiffCursorFuzzTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/DiffCursorFuzzTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map.tests.fuzz; import static org.junit.jupiter.api.Assertions.fail; diff --git a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MultiThreadFuzzTest.java b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MultiThreadFuzzTest.java index 1ab431a8..ab2b9435 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MultiThreadFuzzTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MultiThreadFuzzTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map.tests.fuzz; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MultiThreadTestRunnable.java b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MultiThreadTestRunnable.java index f77f9ee5..502c8362 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MultiThreadTestRunnable.java +++ b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MultiThreadTestRunnable.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map.tests.fuzz; import java.util.ArrayList; diff --git a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MutableFuzzTest.java b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MutableFuzzTest.java index d40c49c4..32dde0da 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MutableFuzzTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MutableFuzzTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map.tests.fuzz; import static org.junit.jupiter.api.Assertions.fail; diff --git a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MutableImmutableCompareFuzzTest.java b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MutableImmutableCompareFuzzTest.java index 410705a2..347c49be 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MutableImmutableCompareFuzzTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MutableImmutableCompareFuzzTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map.tests.fuzz; import static org.junit.jupiter.api.Assertions.fail; diff --git a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/RestoreFuzzTest.java b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/RestoreFuzzTest.java index 2e29a03f..f7b9d61e 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/RestoreFuzzTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/RestoreFuzzTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map.tests.fuzz; import static org.junit.jupiter.api.Assertions.fail; diff --git a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/SharedStoreFuzzTest.java b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/SharedStoreFuzzTest.java index 914a0f63..4b4172d0 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/SharedStoreFuzzTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/SharedStoreFuzzTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map.tests.fuzz; import java.util.HashMap; diff --git a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/utils/FuzzTestUtils.java b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/utils/FuzzTestUtils.java index e75d7f5a..a819d348 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/utils/FuzzTestUtils.java +++ b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/utils/FuzzTestUtils.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map.tests.fuzz.utils; import java.util.Arrays; diff --git a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/utils/FuzzTestUtilsTest.java b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/utils/FuzzTestUtilsTest.java index 72f2a46c..dc621574 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/utils/FuzzTestUtilsTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/utils/FuzzTestUtilsTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map.tests.fuzz.utils; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/subprojects/store/src/test/java/tools/refinery/store/map/tests/utils/MapTestEnvironment.java b/subprojects/store/src/test/java/tools/refinery/store/map/tests/utils/MapTestEnvironment.java index 2d03ebaf..f861f496 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/map/tests/utils/MapTestEnvironment.java +++ b/subprojects/store/src/test/java/tools/refinery/store/map/tests/utils/MapTestEnvironment.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.map.tests.utils; import tools.refinery.store.map.*; diff --git a/subprojects/store/src/test/java/tools/refinery/store/model/hashtests/HashEfficiencyTest.java b/subprojects/store/src/test/java/tools/refinery/store/model/hashtests/HashEfficiencyTest.java index bb083805..4d4f5e26 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/model/hashtests/HashEfficiencyTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/model/hashtests/HashEfficiencyTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.model.hashtests; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/subprojects/store/src/test/java/tools/refinery/store/model/tests/ModelTest.java b/subprojects/store/src/test/java/tools/refinery/store/model/tests/ModelTest.java index 9536a444..1017ff28 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/model/tests/ModelTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/model/tests/ModelTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.model.tests; import org.junit.jupiter.api.Test; diff --git a/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/CardinalityIntervalTest.java b/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/CardinalityIntervalTest.java index 96fdc49e..6a66fa84 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/CardinalityIntervalTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/CardinalityIntervalTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.representation.cardinality; import org.junit.jupiter.params.ParameterizedTest; diff --git a/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/CardinalityIntervalsTest.java b/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/CardinalityIntervalsTest.java index 4a9ef8da..9fe76159 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/CardinalityIntervalsTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/CardinalityIntervalsTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.representation.cardinality; import org.junit.jupiter.api.Test; diff --git a/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/EmptyCardinalityIntervalTest.java b/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/EmptyCardinalityIntervalTest.java index e8b77b9f..24a788a8 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/EmptyCardinalityIntervalTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/EmptyCardinalityIntervalTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.representation.cardinality; import org.junit.jupiter.api.Test; diff --git a/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/FiniteCardinalityIntervalTest.java b/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/FiniteCardinalityIntervalTest.java index 9a190818..6cf56fae 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/FiniteCardinalityIntervalTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/FiniteCardinalityIntervalTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.representation.cardinality; import org.junit.jupiter.api.Test; diff --git a/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/FiniteUpperCardinalityTest.java b/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/FiniteUpperCardinalityTest.java index 90c21759..7c641c47 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/FiniteUpperCardinalityTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/FiniteUpperCardinalityTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.representation.cardinality; import org.junit.jupiter.api.Test; diff --git a/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/UpperCardinalitiesTest.java b/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/UpperCardinalitiesTest.java index 3c7c0320..e61f7b36 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/UpperCardinalitiesTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/UpperCardinalitiesTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.representation.cardinality; import org.junit.jupiter.api.Test; diff --git a/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/UpperCardinalityTest.java b/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/UpperCardinalityTest.java index e87ce29b..10b4dd20 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/UpperCardinalityTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/representation/cardinality/UpperCardinalityTest.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.representation.cardinality; import org.junit.jupiter.params.ParameterizedTest; diff --git a/subprojects/store/src/test/java/tools/refinery/store/util/CollectionsUtilTests.java b/subprojects/store/src/test/java/tools/refinery/store/util/CollectionsUtilTests.java index 171be0e5..8d50fa8a 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/util/CollectionsUtilTests.java +++ b/subprojects/store/src/test/java/tools/refinery/store/util/CollectionsUtilTests.java @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * + * SPDX-License-Identifier: EPL-2.0 + */ package tools.refinery.store.util; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/yarn.lock.license b/yarn.lock.license new file mode 100644 index 00000000..7a5a2a4b --- /dev/null +++ b/yarn.lock.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + +SPDX-License-Identifier: CC0-1.0 -- cgit v1.2.3-70-g09d2 From 2069579ce57dbaf04bff610f8151409e25bf114a Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Sun, 18 Jun 2023 14:12:20 +0200 Subject: refactor: clean up Symbol constructor Shorthad syntax for the most commonly used symbol types. --- .../language/semantics/model/ModelInitializer.java | 4 +- .../store/query/viatra/DiagonalQueryTest.java | 110 ++++++++------------- .../store/query/viatra/FunctionalQueryTest.java | 63 ++---------- .../refinery/store/query/viatra/QueryTest.java | 75 ++------------ .../store/query/viatra/QueryTransactionTest.java | 43 ++------ .../dnf/DnfBuilderLiteralEliminationTest.java | 2 +- .../dnf/DnfBuilderVariableUnificationTest.java | 4 +- .../store/query/dnf/DnfToDefinitionStringTest.java | 43 ++------ .../store/query/dnf/TopologicalSortTest.java | 2 +- .../store/query/dnf/VariableDirectionTest.java | 6 +- .../query/tests/StructurallyEqualToRawTest.java | 48 ++------- .../store/query/tests/StructurallyEqualToTest.java | 48 ++------- .../base/BaseDecisionTranslationUnit.java | 2 +- .../TypeHierarchyTranslationUnit.java | 4 +- .../refinery/store/representation/Symbol.java | 19 ++-- .../refinery/store/model/tests/ModelTest.java | 24 +---- 16 files changed, 121 insertions(+), 376 deletions(-) (limited to 'subprojects/store/src/test') diff --git a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/ModelInitializer.java b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/ModelInitializer.java index 41b4fcb0..06b8ad77 100644 --- a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/ModelInitializer.java +++ b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/model/ModelInitializer.java @@ -44,8 +44,8 @@ public class ModelInitializer { var isEqualsRelation = relation == builtinSymbols.equals(); var decisionTree = mergeAssertions(relationInfo, isEqualsRelation); var defaultValue = isEqualsRelation ? TruthValue.FALSE : TruthValue.UNKNOWN; - relationTrace.put(relation, new Symbol<>(relationInfo.name(), relationInfo.arity(), TruthValue.class, defaultValue - )); + relationTrace.put(relation, Symbol.of( + relationInfo.name(), relationInfo.arity(), TruthValue.class, defaultValue)); } } diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/DiagonalQueryTest.java b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/DiagonalQueryTest.java index 86a27f5b..b21c254c 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/DiagonalQueryTest.java +++ b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/DiagonalQueryTest.java @@ -11,6 +11,7 @@ import tools.refinery.store.query.ModelQueryAdapter; import tools.refinery.store.query.dnf.Dnf; import tools.refinery.store.query.dnf.Query; import tools.refinery.store.query.viatra.tests.QueryEngineTest; +import tools.refinery.store.query.view.AnySymbolView; import tools.refinery.store.query.view.FunctionView; import tools.refinery.store.query.view.KeyOnlyView; import tools.refinery.store.representation.Symbol; @@ -26,13 +27,17 @@ import static tools.refinery.store.query.viatra.tests.QueryAssertions.assertNull import static tools.refinery.store.query.viatra.tests.QueryAssertions.assertResults; class DiagonalQueryTest { + private static final Symbol person = Symbol.of("Person", 1); + private static final Symbol friend = Symbol.of("friend", 2); + private static final Symbol symbol = Symbol.of("symbol", 4); + private static final Symbol intSymbol = Symbol.of("intSymbol", 4, Integer.class); + private static final AnySymbolView personView = new KeyOnlyView<>(person); + private static final AnySymbolView friendView = new KeyOnlyView<>(friend); + private static final AnySymbolView symbolView = new KeyOnlyView<>(symbol); + private static final AnySymbolView intSymbolView = new FunctionView<>(intSymbol); + @QueryEngineTest void inputKeyNegationTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var symbol = new Symbol<>("symbol", 4, Boolean.class, false); - var personView = new KeyOnlyView<>(person); - var symbolView = new KeyOnlyView<>(symbol); - var query = Query.of("Diagonal", (builder, p1) -> builder.clause(p2 -> List.of( personView.call(p1), not(symbolView.call(p1, p1, p2, p2)) @@ -71,11 +76,6 @@ class DiagonalQueryTest { @QueryEngineTest void subQueryNegationTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var symbol = new Symbol<>("symbol", 4, Boolean.class, false); - var personView = new KeyOnlyView<>(person); - var symbolView = new KeyOnlyView<>(symbol); - var subQuery = Dnf.of("SubQuery", builder -> { var p1 = builder.parameter("p1"); var p2 = builder.parameter("p2"); @@ -128,11 +128,6 @@ class DiagonalQueryTest { @QueryEngineTest void inputKeyCountTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var symbol = new Symbol<>("symbol", 4, Boolean.class, false); - var personView = new KeyOnlyView<>(person); - var symbolView = new KeyOnlyView<>(symbol); - var query = Query.of("Diagonal", Integer.class, (builder, p1, output) -> builder.clause(p2 -> List.of( personView.call(p1), output.assign(symbolView.count(p1, p1, p2, p2)) @@ -172,11 +167,6 @@ class DiagonalQueryTest { @QueryEngineTest void subQueryCountTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var symbol = new Symbol<>("symbol", 4, Boolean.class, false); - var personView = new KeyOnlyView<>(person); - var symbolView = new KeyOnlyView<>(symbol); - var subQuery = Dnf.of("SubQuery", builder -> { var p1 = builder.parameter("p1"); var p2 = builder.parameter("p2"); @@ -230,19 +220,14 @@ class DiagonalQueryTest { @QueryEngineTest void inputKeyAggregationTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var symbol = new Symbol<>("symbol", 4, Integer.class, null); - var personView = new KeyOnlyView<>(person); - var symbolView = new FunctionView<>(symbol); - var query = Query.of("Diagonal", Integer.class, (builder, p1, output) -> builder.clause(Integer.class, (p2, y) -> List.of( personView.call(p1), - output.assign(symbolView.aggregate(y, INT_SUM, p1, p1, p2, p2, y)) + output.assign(intSymbolView.aggregate(y, INT_SUM, p1, p1, p2, p2, y)) ))); var store = ModelStore.builder() - .symbols(person, symbol) + .symbols(person, intSymbol) .with(ViatraModelQueryAdapter.builder() .defaultHint(hint) .queries(query)) @@ -250,7 +235,7 @@ class DiagonalQueryTest { var model = store.createEmptyModel(); var personInterpretation = model.getInterpretation(person); - var symbolInterpretation = model.getInterpretation(symbol); + var intSymbolInterpretation = model.getInterpretation(intSymbol); var queryEngine = model.getAdapter(ModelQueryAdapter.class); var queryResultSet = queryEngine.getResultSet(query); @@ -258,11 +243,11 @@ class DiagonalQueryTest { personInterpretation.put(Tuple.of(1), true); personInterpretation.put(Tuple.of(2), true); - symbolInterpretation.put(Tuple.of(0, 0, 1, 1), 1); - symbolInterpretation.put(Tuple.of(0, 0, 2, 2), 2); - symbolInterpretation.put(Tuple.of(0, 0, 1, 2), 10); - symbolInterpretation.put(Tuple.of(1, 1, 0, 1), 11); - symbolInterpretation.put(Tuple.of(1, 2, 1, 1), 12); + intSymbolInterpretation.put(Tuple.of(0, 0, 1, 1), 1); + intSymbolInterpretation.put(Tuple.of(0, 0, 2, 2), 2); + intSymbolInterpretation.put(Tuple.of(0, 0, 1, 2), 10); + intSymbolInterpretation.put(Tuple.of(1, 1, 0, 1), 11); + intSymbolInterpretation.put(Tuple.of(1, 2, 1, 1), 12); queryEngine.flushChanges(); assertNullableResults(Map.of( @@ -275,11 +260,6 @@ class DiagonalQueryTest { @QueryEngineTest void subQueryAggregationTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var symbol = new Symbol<>("symbol", 4, Integer.class, null); - var personView = new KeyOnlyView<>(person); - var symbolView = new FunctionView<>(symbol); - var subQuery = Dnf.of("SubQuery", builder -> { var p1 = builder.parameter("p1"); var p2 = builder.parameter("p2"); @@ -289,12 +269,12 @@ class DiagonalQueryTest { var y = builder.parameter("y", Integer.class); builder.clause( personView.call(p1), - symbolView.call(p1, p2, p3, p4, x), + intSymbolView.call(p1, p2, p3, p4, x), y.assign(x) ); builder.clause( personView.call(p2), - symbolView.call(p1, p2, p3, p4, x), + intSymbolView.call(p1, p2, p3, p4, x), y.assign(x) ); }); @@ -305,7 +285,7 @@ class DiagonalQueryTest { ))); var store = ModelStore.builder() - .symbols(person, symbol) + .symbols(person, intSymbol) .with(ViatraModelQueryAdapter.builder() .defaultHint(hint) .queries(query)) @@ -313,7 +293,7 @@ class DiagonalQueryTest { var model = store.createEmptyModel(); var personInterpretation = model.getInterpretation(person); - var symbolInterpretation = model.getInterpretation(symbol); + var intSymbolInterpretation = model.getInterpretation(intSymbol); var queryEngine = model.getAdapter(ModelQueryAdapter.class); var queryResultSet = queryEngine.getResultSet(query); @@ -321,11 +301,11 @@ class DiagonalQueryTest { personInterpretation.put(Tuple.of(1), true); personInterpretation.put(Tuple.of(2), true); - symbolInterpretation.put(Tuple.of(0, 0, 1, 1), 1); - symbolInterpretation.put(Tuple.of(0, 0, 2, 2), 2); - symbolInterpretation.put(Tuple.of(0, 0, 1, 2), 10); - symbolInterpretation.put(Tuple.of(1, 1, 0, 1), 11); - symbolInterpretation.put(Tuple.of(1, 2, 1, 1), 12); + intSymbolInterpretation.put(Tuple.of(0, 0, 1, 1), 1); + intSymbolInterpretation.put(Tuple.of(0, 0, 2, 2), 2); + intSymbolInterpretation.put(Tuple.of(0, 0, 1, 2), 10); + intSymbolInterpretation.put(Tuple.of(1, 1, 0, 1), 11); + intSymbolInterpretation.put(Tuple.of(1, 2, 1, 1), 12); queryEngine.flushChanges(); assertNullableResults(Map.of( @@ -338,18 +318,13 @@ class DiagonalQueryTest { @QueryEngineTest void inputKeyTransitiveTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var symbol = new Symbol<>("symbol", 2, Boolean.class, false); - var personView = new KeyOnlyView<>(person); - var symbolView = new KeyOnlyView<>(symbol); - var query = Query.of("Diagonal", (builder, p1) -> builder.clause( personView.call(p1), - symbolView.callTransitive(p1, p1) + friendView.callTransitive(p1, p1) )); var store = ModelStore.builder() - .symbols(person, symbol) + .symbols(person, friend) .with(ViatraModelQueryAdapter.builder() .defaultHint(hint) .queries(query)) @@ -357,7 +332,7 @@ class DiagonalQueryTest { var model = store.createEmptyModel(); var personInterpretation = model.getInterpretation(person); - var symbolInterpretation = model.getInterpretation(symbol); + var friendInterpretation = model.getInterpretation(friend); var queryEngine = model.getAdapter(ModelQueryAdapter.class); var queryResultSet = queryEngine.getResultSet(query); @@ -365,9 +340,9 @@ class DiagonalQueryTest { personInterpretation.put(Tuple.of(1), true); personInterpretation.put(Tuple.of(2), true); - symbolInterpretation.put(Tuple.of(0, 0), true); - symbolInterpretation.put(Tuple.of(0, 1), true); - symbolInterpretation.put(Tuple.of(1, 2), true); + friendInterpretation.put(Tuple.of(0, 0), true); + friendInterpretation.put(Tuple.of(0, 1), true); + friendInterpretation.put(Tuple.of(1, 2), true); queryEngine.flushChanges(); assertResults(Map.of( @@ -380,21 +355,16 @@ class DiagonalQueryTest { @QueryEngineTest void subQueryTransitiveTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var symbol = new Symbol<>("symbol", 2, Boolean.class, false); - var personView = new KeyOnlyView<>(person); - var symbolView = new KeyOnlyView<>(symbol); - var subQuery = Dnf.of("SubQuery", builder -> { var p1 = builder.parameter("p1"); var p2 = builder.parameter("p2"); builder.clause( personView.call(p1), - symbolView.call(p1, p2) + friendView.call(p1, p2) ); builder.clause( personView.call(p2), - symbolView.call(p1, p2) + friendView.call(p1, p2) ); }); var query = Query.of("Diagonal", (builder, p1) -> builder.clause( @@ -403,7 +373,7 @@ class DiagonalQueryTest { )); var store = ModelStore.builder() - .symbols(person, symbol) + .symbols(person, friend) .with(ViatraModelQueryAdapter.builder() .defaultHint(hint) .queries(query)) @@ -411,7 +381,7 @@ class DiagonalQueryTest { var model = store.createEmptyModel(); var personInterpretation = model.getInterpretation(person); - var symbolInterpretation = model.getInterpretation(symbol); + var friendInterpretation = model.getInterpretation(friend); var queryEngine = model.getAdapter(ModelQueryAdapter.class); var queryResultSet = queryEngine.getResultSet(query); @@ -419,9 +389,9 @@ class DiagonalQueryTest { personInterpretation.put(Tuple.of(1), true); personInterpretation.put(Tuple.of(2), true); - symbolInterpretation.put(Tuple.of(0, 0), true); - symbolInterpretation.put(Tuple.of(0, 1), true); - symbolInterpretation.put(Tuple.of(1, 2), true); + friendInterpretation.put(Tuple.of(0, 0), true); + friendInterpretation.put(Tuple.of(0, 1), true); + friendInterpretation.put(Tuple.of(1, 2), true); queryEngine.flushChanges(); assertResults(Map.of( diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/FunctionalQueryTest.java b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/FunctionalQueryTest.java index 98c8cd92..723e9180 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/FunctionalQueryTest.java +++ b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/FunctionalQueryTest.java @@ -13,6 +13,7 @@ import tools.refinery.store.query.dnf.Dnf; import tools.refinery.store.query.dnf.Query; import tools.refinery.store.query.term.Variable; import tools.refinery.store.query.viatra.tests.QueryEngineTest; +import tools.refinery.store.query.view.AnySymbolView; import tools.refinery.store.query.view.FilteredView; import tools.refinery.store.query.view.FunctionView; import tools.refinery.store.query.view.KeyOnlyView; @@ -35,13 +36,15 @@ import static tools.refinery.store.query.viatra.tests.QueryAssertions.assertNull import static tools.refinery.store.query.viatra.tests.QueryAssertions.assertResults; class FunctionalQueryTest { + private static final Symbol person = Symbol.of("Person", 1); + private static final Symbol age = Symbol.of("age", 1, Integer.class); + private static final Symbol friend = Symbol.of("friend", 2, TruthValue.class, TruthValue.FALSE); + private static final AnySymbolView personView = new KeyOnlyView<>(person); + private static final AnySymbolView ageView = new FunctionView<>(age); + private static final AnySymbolView friendMustView = new FilteredView<>(friend, "must", TruthValue::must); + @QueryEngineTest void inputKeyTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var age = new Symbol<>("age", 1, Integer.class, null); - var personView = new KeyOnlyView<>(person); - var ageView = new FunctionView<>(age); - var query = Query.of("InputKey", Integer.class, (builder, p1, output) -> builder.clause( personView.call(p1), ageView.call(p1, output) @@ -77,11 +80,6 @@ class FunctionalQueryTest { @QueryEngineTest void predicateTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var age = new Symbol<>("age", 1, Integer.class, null); - var personView = new KeyOnlyView<>(person); - var ageView = new FunctionView<>(age); - var subQuery = Dnf.of("SubQuery", builder -> { var p1 = builder.parameter("p1"); var x = builder.parameter("x", Integer.class); @@ -125,11 +123,6 @@ class FunctionalQueryTest { @QueryEngineTest void computationTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var age = new Symbol<>("age", 1, Integer.class, null); - var personView = new KeyOnlyView<>(person); - var ageView = new FunctionView<>(age); - var query = Query.of("Computation", Integer.class, (builder, p1, output) -> builder.clause(() -> { var x = Variable.of("x", Integer.class); return List.of( @@ -168,11 +161,6 @@ class FunctionalQueryTest { @QueryEngineTest void inputKeyCountTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); - var personView = new KeyOnlyView<>(person); - var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); - var query = Query.of("Count", Integer.class, (builder, p1, output) -> builder.clause( personView.call(p1), output.assign(friendMustView.count(p1, Variable.of())) @@ -210,11 +198,6 @@ class FunctionalQueryTest { @QueryEngineTest void predicateCountTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); - var personView = new KeyOnlyView<>(person); - var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); - var subQuery = Dnf.of("SubQuery", builder -> { var p1 = builder.parameter("p1"); var p2 = builder.parameter("p2"); @@ -261,9 +244,6 @@ class FunctionalQueryTest { @QueryEngineTest void inputKeyAggregationTest(QueryEvaluationHint hint) { - var age = new Symbol<>("age", 1, Integer.class, null); - var ageView = new FunctionView<>(age); - var query = Query.of("Aggregate", Integer.class, (builder, output) -> builder.clause(Integer.class, (y) -> List.of(output.assign(ageView.aggregate(y, INT_SUM, Variable.of(), y))))); @@ -288,11 +268,6 @@ class FunctionalQueryTest { @QueryEngineTest void predicateAggregationTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var age = new Symbol<>("age", 1, Integer.class, null); - var personView = new KeyOnlyView<>(person); - var ageView = new FunctionView<>(age); - var subQuery = Dnf.of("SubQuery", builder -> { var p1 = builder.parameter("p1"); var x = builder.parameter("x", Integer.class); @@ -329,11 +304,6 @@ class FunctionalQueryTest { @QueryEngineTest void extremeValueTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); - var personView = new KeyOnlyView<>(person); - var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); - var subQuery = Dnf.of("SubQuery", builder -> { var p1 = builder.parameter("p1"); var x = builder.parameter("x", Integer.class); @@ -394,11 +364,6 @@ class FunctionalQueryTest { @QueryEngineTest void invalidComputationTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var age = new Symbol<>("age", 1, Integer.class, null); - var personView = new KeyOnlyView<>(person); - var ageView = new FunctionView<>(age); - var query = Query.of("InvalidComputation", Integer.class, (builder, p1, output) -> builder.clause(Integer.class, (x) -> List.of( personView.call(p1), @@ -435,11 +400,6 @@ class FunctionalQueryTest { @QueryEngineTest void invalidAssumeTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var age = new Symbol<>("age", 1, Integer.class, null); - var personView = new KeyOnlyView<>(person); - var ageView = new FunctionView<>(age); - var query = Query.of("InvalidAssume", (builder, p1) -> builder.clause(Integer.class, (x) -> List.of( personView.call(p1), ageView.call(p1, x), @@ -478,13 +438,6 @@ class FunctionalQueryTest { @QueryEngineTest void notFunctionalTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var age = new Symbol<>("age", 1, Integer.class, null); - var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); - var personView = new KeyOnlyView<>(person); - var ageView = new FunctionView<>(age); - var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); - var query = Query.of("NotFunctional", Integer.class, (builder, p1, output) -> builder.clause((p2) -> List.of( personView.call(p1), friendMustView.call(p1, p2), diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTest.java b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTest.java index a9a2f71c..de0e6da1 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTest.java +++ b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTest.java @@ -13,6 +13,7 @@ import tools.refinery.store.query.dnf.Dnf; import tools.refinery.store.query.dnf.Query; import tools.refinery.store.query.term.Variable; import tools.refinery.store.query.viatra.tests.QueryEngineTest; +import tools.refinery.store.query.view.AnySymbolView; import tools.refinery.store.query.view.FilteredView; import tools.refinery.store.query.view.FunctionView; import tools.refinery.store.query.view.KeyOnlyView; @@ -30,11 +31,14 @@ import static tools.refinery.store.query.term.int_.IntTerms.greaterEq; import static tools.refinery.store.query.viatra.tests.QueryAssertions.assertResults; class QueryTest { + private static final Symbol person = Symbol.of("Person", 1); + private static final Symbol friend = Symbol.of("friend", 2, TruthValue.class, TruthValue.FALSE); + private static final AnySymbolView personView = new KeyOnlyView<>(person); + private static final AnySymbolView friendMustView = new FilteredView<>(friend, "must", TruthValue::must); + @QueryEngineTest void typeConstraintTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var asset = new Symbol<>("Asset", 1, Boolean.class, false); - var personView = new KeyOnlyView<>(person); + var asset = Symbol.of("Asset", 1); var predicate = Query.of("TypeConstraint", (builder, p1) -> builder.clause(personView.call(p1))); @@ -67,11 +71,6 @@ class QueryTest { @QueryEngineTest void relationConstraintTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); - var personView = new KeyOnlyView<>(person); - var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); - var predicate = Query.of("RelationConstraint", (builder, p1, p2) -> builder.clause( personView.call(p1), personView.call(p2), @@ -111,11 +110,6 @@ class QueryTest { @QueryEngineTest void existTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); - var personView = new KeyOnlyView<>(person); - var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); - var predicate = Query.of("Exists", (builder, p1) -> builder.clause((p2) -> List.of( personView.call(p1), personView.call(p2), @@ -155,12 +149,8 @@ class QueryTest { @QueryEngineTest void orTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var animal = new Symbol<>("Animal", 1, Boolean.class, false); - var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); - var personView = new KeyOnlyView<>(person); + var animal = Symbol.of("Animal", 1); var animalView = new KeyOnlyView<>(animal); - var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); var predicate = Query.of("Or", (builder, p1, p2) -> builder.clause( personView.call(p1), @@ -209,9 +199,6 @@ class QueryTest { @QueryEngineTest void equalityTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var personView = new KeyOnlyView<>(person); - var predicate = Query.of("Equality", (builder, p1, p2) -> builder.clause( personView.call(p1), personView.call(p2), @@ -246,11 +233,6 @@ class QueryTest { @QueryEngineTest void inequalityTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); - var personView = new KeyOnlyView<>(person); - var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); - var predicate = Query.of("Inequality", (builder, p1, p2, p3) -> builder.clause( personView.call(p1), personView.call(p2), @@ -289,11 +271,6 @@ class QueryTest { @QueryEngineTest void patternCallTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); - var personView = new KeyOnlyView<>(person); - var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); - var friendPredicate = Dnf.of("Friend", builder -> { var p1 = builder.parameter("p1"); var p2 = builder.parameter("p2"); @@ -341,11 +318,6 @@ class QueryTest { @QueryEngineTest void negativeRelationViewTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); - var personView = new KeyOnlyView<>(person); - var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); - var predicate = Query.of("NegativePatternCall", (builder, p1, p2) -> builder.clause( personView.call(p1), personView.call(p2), @@ -390,11 +362,6 @@ class QueryTest { @QueryEngineTest void negativePatternCallTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); - var personView = new KeyOnlyView<>(person); - var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); - var friendPredicate = Dnf.of("Friend", builder -> { var p1 = builder.parameter("p1"); var p2 = builder.parameter("p2"); @@ -448,11 +415,6 @@ class QueryTest { @QueryEngineTest void negativeRelationViewWithQuantificationTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); - var personView = new KeyOnlyView<>(person); - var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); - var predicate = Query.of("Negative", (builder, p1) -> builder.clause( personView.call(p1), not(friendMustView.call(p1, Variable.of())) @@ -489,11 +451,6 @@ class QueryTest { @QueryEngineTest void negativeWithQuantificationTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); - var personView = new KeyOnlyView<>(person); - var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); - var called = Dnf.of("Called", builder -> { var p1 = builder.parameter("p1"); var p2 = builder.parameter("p2"); @@ -539,11 +496,6 @@ class QueryTest { @QueryEngineTest void transitiveRelationViewTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); - var personView = new KeyOnlyView<>(person); - var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); - var predicate = Query.of("Transitive", (builder, p1, p2) -> builder.clause( personView.call(p1), personView.call(p2), @@ -587,11 +539,6 @@ class QueryTest { @QueryEngineTest void transitivePatternCallTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); - var personView = new KeyOnlyView<>(person); - var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); - var called = Dnf.of("Called", builder -> { var p1 = builder.parameter("p1"); var p2 = builder.parameter("p2"); @@ -644,9 +591,7 @@ class QueryTest { @QueryEngineTest void assumeTest(QueryEvaluationHint hint) { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var age = new Symbol<>("age", 1, Integer.class, null); - var personView = new KeyOnlyView<>(person); + var age = Symbol.of("age", 1, Integer.class); var ageView = new FunctionView<>(age); var query = Query.of("Constraint", (builder, p1) -> builder.clause(Integer.class, (x) -> List.of( @@ -684,8 +629,6 @@ class QueryTest { @Test void alwaysFalseTest() { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var predicate = Query.of("AlwaysFalse", builder -> builder.parameter("p1")); var store = ModelStore.builder() diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTransactionTest.java b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTransactionTest.java index 6860ece9..66f043c6 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTransactionTest.java +++ b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTransactionTest.java @@ -11,6 +11,8 @@ import org.junit.jupiter.api.Test; import tools.refinery.store.model.ModelStore; import tools.refinery.store.query.ModelQueryAdapter; import tools.refinery.store.query.dnf.Query; +import tools.refinery.store.query.dnf.RelationalQuery; +import tools.refinery.store.query.view.AnySymbolView; import tools.refinery.store.query.view.FilteredView; import tools.refinery.store.query.view.FunctionView; import tools.refinery.store.query.view.KeyOnlyView; @@ -26,13 +28,15 @@ import static tools.refinery.store.query.viatra.tests.QueryAssertions.assertNull import static tools.refinery.store.query.viatra.tests.QueryAssertions.assertResults; class QueryTransactionTest { + private static final Symbol person = Symbol.of("Person", 1); + private static final Symbol age = Symbol.of("age", 1, Integer.class); + private static final AnySymbolView personView = new KeyOnlyView<>(person); + private static final AnySymbolView ageView = new FunctionView<>(age); + private static final RelationalQuery predicate = Query.of("TypeConstraint", (builder, p1) -> + builder.clause(personView.call(p1))); + @Test void flushTest() { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var personView = new KeyOnlyView<>(person); - - var predicate = Query.of("TypeConstraint", (builder, p1) -> builder.clause(personView.call(p1))); - var store = ModelStore.builder() .symbols(person) .with(ViatraModelQueryAdapter.builder() @@ -95,11 +99,6 @@ class QueryTransactionTest { @Test void localSearchTest() { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var personView = new KeyOnlyView<>(person); - - var predicate = Query.of("TypeConstraint", (builder, p1) -> builder.clause(personView.call(p1))); - var store = ModelStore.builder() .symbols(person) .with(ViatraModelQueryAdapter.builder() @@ -145,11 +144,7 @@ class QueryTransactionTest { @Test void unrelatedChangesTest() { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var asset = new Symbol<>("Asset", 1, Boolean.class, false); - var personView = new KeyOnlyView<>(person); - - var predicate = Query.of("TypeConstraint", (builder, p1) -> builder.clause(personView.call(p1))); + var asset = Symbol.of("Asset", 1); var store = ModelStore.builder() .symbols(person, asset) @@ -214,11 +209,6 @@ class QueryTransactionTest { @Test void tupleChangingChangeTest() { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var age = new Symbol<>("age", 1, Integer.class, null); - var personView = new KeyOnlyView<>(person); - var ageView = new FunctionView<>(age); - var query = Query.of("TypeConstraint", Integer.class, (builder, p1, output) -> builder.clause( personView.call(p1), ageView.call(p1, output) @@ -256,9 +246,6 @@ class QueryTransactionTest { @Test void tuplePreservingUnchangedTest() { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var age = new Symbol<>("age", 1, Integer.class, null); - var personView = new KeyOnlyView<>(person); var adultView = new FilteredView<>(age, "adult", n -> n != null && n >= 18); var query = Query.of("TypeConstraint", (builder, p1) -> builder.clause( @@ -299,11 +286,6 @@ class QueryTransactionTest { @Disabled("TODO Fix DiffCursor") @Test void commitAfterFlushTest() { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var personView = new KeyOnlyView<>(person); - - var predicate = Query.of("TypeConstraint", (builder, p1) -> builder.clause(personView.call(p1))); - var store = ModelStore.builder() .symbols(person) .with(ViatraModelQueryAdapter.builder() @@ -353,11 +335,6 @@ class QueryTransactionTest { @Disabled("TODO Fix DiffCursor") @Test void commitWithoutFlushTest() { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var personView = new KeyOnlyView<>(person); - - var predicate = Query.of("TypeConstraint", (builder, p1) -> builder.clause(personView.call(p1))); - var store = ModelStore.builder() .symbols(person) .with(ViatraModelQueryAdapter.builder() diff --git a/subprojects/store-query/src/test/java/tools/refinery/store/query/dnf/DnfBuilderLiteralEliminationTest.java b/subprojects/store-query/src/test/java/tools/refinery/store/query/dnf/DnfBuilderLiteralEliminationTest.java index 687b06db..e17496e3 100644 --- a/subprojects/store-query/src/test/java/tools/refinery/store/query/dnf/DnfBuilderLiteralEliminationTest.java +++ b/subprojects/store-query/src/test/java/tools/refinery/store/query/dnf/DnfBuilderLiteralEliminationTest.java @@ -25,7 +25,7 @@ import static tools.refinery.store.query.literal.Literals.not; import static tools.refinery.store.query.tests.QueryMatchers.structurallyEqualTo; class DnfBuilderLiteralEliminationTest { - private final Symbol friend = new Symbol<>("friend", 2, Boolean.class, false); + private final Symbol friend = Symbol.of("friend", 2); private final SymbolView friendView = new KeyOnlyView<>(friend); private final NodeVariable p = Variable.of("p"); private final NodeVariable q = Variable.of("q"); diff --git a/subprojects/store-query/src/test/java/tools/refinery/store/query/dnf/DnfBuilderVariableUnificationTest.java b/subprojects/store-query/src/test/java/tools/refinery/store/query/dnf/DnfBuilderVariableUnificationTest.java index 4a85fe32..fc40c7b3 100644 --- a/subprojects/store-query/src/test/java/tools/refinery/store/query/dnf/DnfBuilderVariableUnificationTest.java +++ b/subprojects/store-query/src/test/java/tools/refinery/store/query/dnf/DnfBuilderVariableUnificationTest.java @@ -18,8 +18,8 @@ import static org.hamcrest.MatcherAssert.assertThat; import static tools.refinery.store.query.tests.QueryMatchers.structurallyEqualTo; class DnfBuilderVariableUnificationTest { - private final Symbol friend = new Symbol<>("friend", 2, Boolean.class, false); - private final Symbol children = new Symbol<>("children", 2, Boolean.class, false); + private final Symbol friend = Symbol.of("friend", 2); + private final Symbol children = Symbol.of("children", 2); private final SymbolView friendView = new KeyOnlyView<>(friend); private final SymbolView childrenView = new KeyOnlyView<>(children); diff --git a/subprojects/store-query/src/test/java/tools/refinery/store/query/dnf/DnfToDefinitionStringTest.java b/subprojects/store-query/src/test/java/tools/refinery/store/query/dnf/DnfToDefinitionStringTest.java index 63310a78..d75d7f17 100644 --- a/subprojects/store-query/src/test/java/tools/refinery/store/query/dnf/DnfToDefinitionStringTest.java +++ b/subprojects/store-query/src/test/java/tools/refinery/store/query/dnf/DnfToDefinitionStringTest.java @@ -6,8 +6,10 @@ package tools.refinery.store.query.dnf; import org.junit.jupiter.api.Test; +import tools.refinery.store.query.term.NodeVariable; import tools.refinery.store.query.term.ParameterDirection; import tools.refinery.store.query.term.Variable; +import tools.refinery.store.query.view.AnySymbolView; import tools.refinery.store.query.view.KeyOnlyView; import tools.refinery.store.representation.Symbol; @@ -16,9 +18,15 @@ import static org.hamcrest.Matchers.is; import static tools.refinery.store.query.literal.Literals.not; class DnfToDefinitionStringTest { + private static final Symbol person = Symbol.of("person", 1); + private static final Symbol friend = Symbol.of("friend", 2); + private static final AnySymbolView personView = new KeyOnlyView<>(person); + private static final AnySymbolView friendView = new KeyOnlyView<>(friend); + private static final NodeVariable p = Variable.of("p"); + private static final NodeVariable q = Variable.of("q"); + @Test void noClausesTest() { - var p = Variable.of("p"); var dnf = Dnf.builder("Example").parameter(p).build(); assertThat(dnf.toDefinitionString(), is(""" @@ -39,7 +47,6 @@ class DnfToDefinitionStringTest { @Test void emptyClauseTest() { - var p = Variable.of("p"); var dnf = Dnf.builder("Example").parameter(p, ParameterDirection.IN).clause().build(); assertThat(dnf.toDefinitionString(), is(""" @@ -50,10 +57,6 @@ class DnfToDefinitionStringTest { @Test void relationViewPositiveTest() { - var p = Variable.of("p"); - var q = Variable.of("q"); - var friend = new Symbol<>("friend", 2, Boolean.class, false); - var friendView = new KeyOnlyView<>(friend); var dnf = Dnf.builder("Example").parameter(p).clause(friendView.call(p, q)).build(); assertThat(dnf.toDefinitionString(), is(""" @@ -64,10 +67,6 @@ class DnfToDefinitionStringTest { @Test void relationViewNegativeTest() { - var p = Variable.of("p"); - var q = Variable.of("q"); - var friend = new Symbol<>("friend", 2, Boolean.class, false); - var friendView = new KeyOnlyView<>(friend); var dnf = Dnf.builder("Example") .parameter(p, ParameterDirection.IN) .clause(not(friendView.call(p, q))) @@ -81,10 +80,6 @@ class DnfToDefinitionStringTest { @Test void relationViewTransitiveTest() { - var p = Variable.of("p"); - var q = Variable.of("q"); - var friend = new Symbol<>("friend", 2, Boolean.class, false); - var friendView = new KeyOnlyView<>(friend); var dnf = Dnf.builder("Example").parameter(p).clause(friendView.callTransitive(p, q)).build(); assertThat(dnf.toDefinitionString(), is(""" @@ -95,10 +90,6 @@ class DnfToDefinitionStringTest { @Test void multipleParametersTest() { - var p = Variable.of("p"); - var q = Variable.of("q"); - var friend = new Symbol<>("friend", 2, Boolean.class, false); - var friendView = new KeyOnlyView<>(friend); var dnf = Dnf.builder("Example").parameters(p, q).clause(friendView.call(p, q)).build(); assertThat(dnf.toDefinitionString(), is(""" @@ -109,12 +100,6 @@ class DnfToDefinitionStringTest { @Test void multipleLiteralsTest() { - var p = Variable.of("p"); - var q = Variable.of("q"); - var person = new Symbol<>("person", 1, Boolean.class, false); - var personView = new KeyOnlyView<>(person); - var friend = new Symbol<>("friend", 2, Boolean.class, false); - var friendView = new KeyOnlyView<>(friend); var dnf = Dnf.builder("Example") .parameter(p) .clause( @@ -134,10 +119,6 @@ class DnfToDefinitionStringTest { @Test void multipleClausesTest() { - var p = Variable.of("p"); - var q = Variable.of("q"); - var friend = new Symbol<>("friend", 2, Boolean.class, false); - var friendView = new KeyOnlyView<>(friend); var dnf = Dnf.builder("Example") .parameter(p) .clause(friendView.call(p, q)) @@ -154,14 +135,8 @@ class DnfToDefinitionStringTest { @Test void dnfTest() { - var p = Variable.of("p"); - var q = Variable.of("q"); var r = Variable.of("r"); var s = Variable.of("s"); - var person = new Symbol<>("person", 1, Boolean.class, false); - var personView = new KeyOnlyView<>(person); - var friend = new Symbol<>("friend", 2, Boolean.class, false); - var friendView = new KeyOnlyView<>(friend); var called = Dnf.builder("Called").parameters(r, s).clause(friendView.call(r, s)).build(); var dnf = Dnf.builder("Example") .parameter(p) diff --git a/subprojects/store-query/src/test/java/tools/refinery/store/query/dnf/TopologicalSortTest.java b/subprojects/store-query/src/test/java/tools/refinery/store/query/dnf/TopologicalSortTest.java index 6d53f184..e22dbb21 100644 --- a/subprojects/store-query/src/test/java/tools/refinery/store/query/dnf/TopologicalSortTest.java +++ b/subprojects/store-query/src/test/java/tools/refinery/store/query/dnf/TopologicalSortTest.java @@ -21,7 +21,7 @@ import static tools.refinery.store.query.literal.Literals.not; import static tools.refinery.store.query.tests.QueryMatchers.structurallyEqualTo; class TopologicalSortTest { - private static final Symbol friend = new Symbol<>("friend", 2, Boolean.class, false); + private static final Symbol friend = Symbol.of("friend", 2); private static final AnySymbolView friendView = new KeyOnlyView<>(friend); private static final Dnf example = Dnf.of("example", builder -> { var a = builder.parameter("a", ParameterDirection.IN); diff --git a/subprojects/store-query/src/test/java/tools/refinery/store/query/dnf/VariableDirectionTest.java b/subprojects/store-query/src/test/java/tools/refinery/store/query/dnf/VariableDirectionTest.java index 0a44664e..3608d09e 100644 --- a/subprojects/store-query/src/test/java/tools/refinery/store/query/dnf/VariableDirectionTest.java +++ b/subprojects/store-query/src/test/java/tools/refinery/store/query/dnf/VariableDirectionTest.java @@ -33,9 +33,9 @@ import static tools.refinery.store.query.literal.Literals.not; import static tools.refinery.store.query.term.int_.IntTerms.*; class VariableDirectionTest { - private static final Symbol person = new Symbol<>("Person", 1, Boolean.class, false); - private static final Symbol friend = new Symbol<>("friend", 2, Boolean.class, false); - private static final Symbol age = new Symbol<>("age", 1, Integer.class, null); + private static final Symbol person = Symbol.of("Person", 1); + private static final Symbol friend = Symbol.of("friend", 2); + private static final Symbol age = Symbol.of("age", 1, Integer.class); private static final AnySymbolView personView = new KeyOnlyView<>(person); private static final AnySymbolView friendView = new KeyOnlyView<>(friend); private static final AnySymbolView ageView = new FunctionView<>(age); diff --git a/subprojects/store-query/src/test/java/tools/refinery/store/query/tests/StructurallyEqualToRawTest.java b/subprojects/store-query/src/test/java/tools/refinery/store/query/tests/StructurallyEqualToRawTest.java index 07a55ff3..d447e99c 100644 --- a/subprojects/store-query/src/test/java/tools/refinery/store/query/tests/StructurallyEqualToRawTest.java +++ b/subprojects/store-query/src/test/java/tools/refinery/store/query/tests/StructurallyEqualToRawTest.java @@ -8,8 +8,10 @@ package tools.refinery.store.query.tests; import org.junit.jupiter.api.Test; import tools.refinery.store.query.dnf.Dnf; import tools.refinery.store.query.dnf.SymbolicParameter; +import tools.refinery.store.query.term.NodeVariable; import tools.refinery.store.query.term.ParameterDirection; import tools.refinery.store.query.term.Variable; +import tools.refinery.store.query.view.AnySymbolView; import tools.refinery.store.query.view.KeyOnlyView; import tools.refinery.store.representation.Symbol; @@ -22,13 +24,15 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static tools.refinery.store.query.tests.QueryMatchers.structurallyEqualTo; class StructurallyEqualToRawTest { + private static final Symbol person = Symbol.of("Person", 1); + private static final Symbol friend = Symbol.of("friend", 2); + private static final AnySymbolView personView = new KeyOnlyView<>(person); + private static final AnySymbolView friendView = new KeyOnlyView<>(friend); + private static final NodeVariable p = Variable.of("p"); + private static final NodeVariable q = Variable.of("q"); + @Test void flatEqualsTest() { - var p = Variable.of("p"); - var q = Variable.of("q"); - var person = new Symbol<>("Person", 1, Boolean.class, false); - var personView = new KeyOnlyView<>(person); - var actual = Dnf.builder("Actual").parameters(p).clause(personView.call(p)).build(); assertThat(actual, structurallyEqualTo( @@ -39,11 +43,6 @@ class StructurallyEqualToRawTest { @Test void flatNotEqualsTest() { - var p = Variable.of("p"); - var q = Variable.of("q"); - var friend = new Symbol<>("friend", 2, Boolean.class, false); - var friendView = new KeyOnlyView<>(friend); - var actual = Dnf.builder("Actual").parameters(p).clause(friendView.call(p, q)).build(); var assertion = structurallyEqualTo( @@ -55,11 +54,6 @@ class StructurallyEqualToRawTest { @Test void deepEqualsTest() { - var p = Variable.of("p"); - var q = Variable.of("q"); - var person = new Symbol<>("Person", 1, Boolean.class, false); - var personView = new KeyOnlyView<>(person); - var actual = Dnf.builder("Actual").parameters(q).clause( Dnf.builder("Actual2").parameters(p).clause(personView.call(p)).build().call(q) ).build(); @@ -76,11 +70,6 @@ class StructurallyEqualToRawTest { @Test void deepNotEqualsTest() { - var p = Variable.of("p"); - var q = Variable.of("q"); - var friend = new Symbol<>("friend", 2, Boolean.class, false); - var friendView = new KeyOnlyView<>(friend); - var actual = Dnf.builder("Actual").parameter(q).clause( Dnf.builder("Actual2").parameters(p).clause(friendView.call(p, q)).build().call(q) ).build(); @@ -103,11 +92,6 @@ class StructurallyEqualToRawTest { @Test void parameterListLengthMismatchTest() { - var p = Variable.of("p"); - var q = Variable.of("q"); - var friend = new Symbol<>("friend", 2, Boolean.class, false); - var friendView = new KeyOnlyView<>(friend); - var actual = Dnf.builder("Actual").parameters(p, q).clause( friendView.call(p, q) ).build(); @@ -122,10 +106,6 @@ class StructurallyEqualToRawTest { @Test void parameterDirectionMismatchTest() { - var p = Variable.of("p"); - var person = new Symbol<>("Person", 1, Boolean.class, false); - var personView = new KeyOnlyView<>(person); - var actual = Dnf.builder("Actual").parameter(p, ParameterDirection.IN).clause( personView.call(p) ).build(); @@ -140,11 +120,6 @@ class StructurallyEqualToRawTest { @Test void clauseCountMismatchTest() { - var p = Variable.of("p"); - var q = Variable.of("q"); - var friend = new Symbol<>("friend", 2, Boolean.class, false); - var friendView = new KeyOnlyView<>(friend); - var actual = Dnf.builder("Actual").parameters(p, q).clause( friendView.call(p, q) ).build(); @@ -165,11 +140,6 @@ class StructurallyEqualToRawTest { @Test void literalCountMismatchTest() { - var p = Variable.of("p"); - var q = Variable.of("q"); - var friend = new Symbol<>("friend", 2, Boolean.class, false); - var friendView = new KeyOnlyView<>(friend); - var actual = Dnf.builder("Actual").parameters(p, q).clause( friendView.call(p, q) ).build(); diff --git a/subprojects/store-query/src/test/java/tools/refinery/store/query/tests/StructurallyEqualToTest.java b/subprojects/store-query/src/test/java/tools/refinery/store/query/tests/StructurallyEqualToTest.java index e2983a3a..f716b805 100644 --- a/subprojects/store-query/src/test/java/tools/refinery/store/query/tests/StructurallyEqualToTest.java +++ b/subprojects/store-query/src/test/java/tools/refinery/store/query/tests/StructurallyEqualToTest.java @@ -7,8 +7,10 @@ package tools.refinery.store.query.tests; import org.junit.jupiter.api.Test; import tools.refinery.store.query.dnf.Dnf; +import tools.refinery.store.query.term.NodeVariable; import tools.refinery.store.query.term.ParameterDirection; import tools.refinery.store.query.term.Variable; +import tools.refinery.store.query.view.AnySymbolView; import tools.refinery.store.query.view.KeyOnlyView; import tools.refinery.store.representation.Symbol; @@ -18,13 +20,15 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static tools.refinery.store.query.tests.QueryMatchers.structurallyEqualTo; class StructurallyEqualToTest { + private static final Symbol person = Symbol.of("Person", 1); + private static final Symbol friend = Symbol.of("friend", 2); + private static final AnySymbolView personView = new KeyOnlyView<>(person); + private static final AnySymbolView friendView = new KeyOnlyView<>(friend); + private static final NodeVariable p = Variable.of("p"); + private static final NodeVariable q = Variable.of("q"); + @Test void flatEqualsTest() { - var p = Variable.of("p"); - var q = Variable.of("q"); - var person = new Symbol<>("Person", 1, Boolean.class, false); - var personView = new KeyOnlyView<>(person); - var expected = Dnf.builder("Expected").parameters(q).clause(personView.call(q)).build(); var actual = Dnf.builder("Actual").parameters(p).clause(personView.call(p)).build(); @@ -33,11 +37,6 @@ class StructurallyEqualToTest { @Test void flatNotEqualsTest() { - var p = Variable.of("p"); - var q = Variable.of("q"); - var friend = new Symbol<>("friend", 2, Boolean.class, false); - var friendView = new KeyOnlyView<>(friend); - var expected = Dnf.builder("Expected").parameters(q).clause(friendView.call(q, q)).build(); var actual = Dnf.builder("Actual").parameters(p).clause(friendView.call(p, q)).build(); @@ -47,11 +46,6 @@ class StructurallyEqualToTest { @Test void deepEqualsTest() { - var p = Variable.of("p"); - var q = Variable.of("q"); - var person = new Symbol<>("Person", 1, Boolean.class, false); - var personView = new KeyOnlyView<>(person); - var expected = Dnf.builder("Expected").parameters(q).clause( Dnf.builder("Expected2").parameters(p).clause(personView.call(p)).build().call(q) ).build(); @@ -64,11 +58,6 @@ class StructurallyEqualToTest { @Test void deepNotEqualsTest() { - var p = Variable.of("p"); - var q = Variable.of("q"); - var friend = new Symbol<>("friend", 2, Boolean.class, false); - var friendView = new KeyOnlyView<>(friend); - var expected = Dnf.builder("Expected").parameters(q).clause( Dnf.builder("Expected2").parameters(p).clause(friendView.call(p, p)).build().call(q) ).build(); @@ -83,11 +72,6 @@ class StructurallyEqualToTest { @Test void parameterListLengthMismatchTest() { - var p = Variable.of("p"); - var q = Variable.of("q"); - var friend = new Symbol<>("friend", 2, Boolean.class, false); - var friendView = new KeyOnlyView<>(friend); - var expected = Dnf.builder("Expected").parameter(p).clause( friendView.call(p, p) ).build(); @@ -101,10 +85,6 @@ class StructurallyEqualToTest { @Test void parameterDirectionMismatchTest() { - var p = Variable.of("p"); - var person = new Symbol<>("Person", 1, Boolean.class, false); - var personView = new KeyOnlyView<>(person); - var expected = Dnf.builder("Expected").parameter(p, ParameterDirection.OUT).clause( personView.call(p) ).build(); @@ -118,11 +98,6 @@ class StructurallyEqualToTest { @Test void clauseCountMismatchTest() { - var p = Variable.of("p"); - var q = Variable.of("q"); - var friend = new Symbol<>("friend", 2, Boolean.class, false); - var friendView = new KeyOnlyView<>(friend); - var expected = Dnf.builder("Expected") .parameters(p, q) .clause(friendView.call(p, q)) @@ -138,11 +113,6 @@ class StructurallyEqualToTest { @Test void literalCountMismatchTest() { - var p = Variable.of("p"); - var q = Variable.of("q"); - var friend = new Symbol<>("friend", 2, Boolean.class, false); - var friendView = new KeyOnlyView<>(friend); - var expected = Dnf.builder("Expected").parameters(p, q).clause( friendView.call(p, q), friendView.call(q, p) diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/base/BaseDecisionTranslationUnit.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/base/BaseDecisionTranslationUnit.java index 405e58ac..a1e4b816 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/base/BaseDecisionTranslationUnit.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/base/BaseDecisionTranslationUnit.java @@ -29,7 +29,7 @@ public class BaseDecisionTranslationUnit extends TranslationUnit { } this.partialRelation = partialRelation; this.seed = seed; - symbol = new Symbol<>(partialRelation.name(), partialRelation.arity(), TruthValue.class, TruthValue.UNKNOWN); + symbol = Symbol.of(partialRelation.name(), partialRelation.arity(), TruthValue.class, TruthValue.UNKNOWN); } public BaseDecisionTranslationUnit(PartialRelation partialRelation) { diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeHierarchyTranslationUnit.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeHierarchyTranslationUnit.java index e1aa2014..06e3c05f 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeHierarchyTranslationUnit.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeHierarchyTranslationUnit.java @@ -16,8 +16,8 @@ import java.util.List; import java.util.Map; public class TypeHierarchyTranslationUnit extends TranslationUnit { - static final Symbol INFERRED_TYPE_SYMBOL = new Symbol<>("inferredType", 1, - InferredType.class, InferredType.UNTYPED); + static final Symbol INFERRED_TYPE_SYMBOL = Symbol.of( + "inferredType", 1, InferredType.class, InferredType.UNTYPED); private final TypeAnalyzer typeAnalyzer; diff --git a/subprojects/store/src/main/java/tools/refinery/store/representation/Symbol.java b/subprojects/store/src/main/java/tools/refinery/store/representation/Symbol.java index aad88921..cc748180 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/representation/Symbol.java +++ b/subprojects/store/src/main/java/tools/refinery/store/representation/Symbol.java @@ -7,18 +7,19 @@ package tools.refinery.store.representation; public record Symbol(String name, int arity, Class valueType, T defaultValue) implements AnySymbol { @Override - public boolean equals(Object o) { - return this == o; + public String toString() { + return "%s/%d".formatted(name, arity); } - @Override - public int hashCode() { - // Compare by identity to make hash table lookups more efficient. - return System.identityHashCode(this); + public static Symbol of(String name, int arity) { + return of(name, arity, Boolean.class, false); } - @Override - public String toString() { - return "%s/%d".formatted(name, arity); + public static Symbol of(String name, int arity, Class valueType) { + return of(name, arity, valueType, null); + } + + public static Symbol of(String name, int arity, Class valueType, T defaultValue) { + return new Symbol<>(name, arity, valueType, defaultValue); } } diff --git a/subprojects/store/src/test/java/tools/refinery/store/model/tests/ModelTest.java b/subprojects/store/src/test/java/tools/refinery/store/model/tests/ModelTest.java index 1017ff28..56b75804 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/model/tests/ModelTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/model/tests/ModelTest.java @@ -14,27 +14,24 @@ import tools.refinery.store.tuple.Tuple; import static org.junit.jupiter.api.Assertions.*; class ModelTest { + private static final Symbol person = Symbol.of("Person", 1); + private static final Symbol age = Symbol.of("age", 1, Integer.class); + private static final Symbol friend = Symbol.of("friend", 2); + @Test void modelConstructionTest() { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var friend = new Symbol<>("friend", 2, Boolean.class, false); - var store = ModelStore.builder().symbols(person, friend).build(); var symbols = store.getSymbols(); assertTrue(symbols.contains(person)); assertTrue(symbols.contains(friend)); - var other = new Symbol<>("other", 2, Integer.class, null); + var other = Symbol.of("other", 2, Integer.class); assertFalse(symbols.contains(other)); } @Test void modelBuildingTest() { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var age = new Symbol<>("age", 1, Integer.class, null); - var friend = new Symbol<>("friend", 2, Boolean.class, false); - var store = ModelStore.builder().symbols(person, age, friend).build(); var model = store.createEmptyModel(); var personInterpretation = model.getInterpretation(person); @@ -62,8 +59,6 @@ class ModelTest { @Test void modelBuildingArityFailTest() { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var store = ModelStore.builder().symbols(person).build(); var model = store.createEmptyModel(); var personInterpretation = model.getInterpretation(person); @@ -75,8 +70,6 @@ class ModelTest { @Test void modelBuildingNullFailTest() { - var age = new Symbol<>("age", 1, Integer.class, null); - var store = ModelStore.builder().symbols(age).build(); var model = store.createEmptyModel(); var ageInterpretation = model.getInterpretation(age); @@ -89,10 +82,6 @@ class ModelTest { @Test void modelUpdateTest() { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var age = new Symbol<>("age", 1, Integer.class, null); - var friend = new Symbol<>("friend", 2, Boolean.class, false); - var store = ModelStore.builder().symbols(person, age, friend).build(); var model = store.createEmptyModel(); var personInterpretation = model.getInterpretation(person); @@ -118,9 +107,6 @@ class ModelTest { @Test void restoreTest() { - var person = new Symbol<>("Person", 1, Boolean.class, false); - var friend = new Symbol<>("friend", 2, Boolean.class, false); - var store = ModelStore.builder().symbols(person, friend).build(); var model = store.createEmptyModel(); var personInterpretation = model.getInterpretation(person); -- cgit v1.2.3-70-g09d2