From 3276945fb3e17fc888130720a837abd202982bd1 Mon Sep 17 00:00:00 2001 From: Travis CI Date: Wed, 1 Dec 2021 01:36:32 -0800 Subject: [PATCH] Fixing a few APIs --- io.opencaesar.oml.api.feature/feature.xml | 2 +- io.opencaesar.oml.api.feature/pom.xml | 2 +- io.opencaesar.oml.dsl.feature/feature.xml | 2 +- io.opencaesar.oml.dsl.feature/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- io.opencaesar.oml.dsl.ide/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- io.opencaesar.oml.dsl.tests/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- io.opencaesar.oml.dsl.ui.tests/pom.xml | 2 +- io.opencaesar.oml.dsl.ui/META-INF/MANIFEST.MF | 2 +- io.opencaesar.oml.dsl.ui/pom.xml | 2 +- io.opencaesar.oml.dsl/META-INF/MANIFEST.MF | 2 +- io.opencaesar.oml.dsl/pom.xml | 2 +- io.opencaesar.oml.edit/META-INF/MANIFEST.MF | 2 +- io.opencaesar.oml.edit/pom.xml | 2 +- io.opencaesar.oml.editor/META-INF/MANIFEST.MF | 2 +- io.opencaesar.oml.editor/pom.xml | 2 +- io.opencaesar.oml.repository/pom.xml | 2 +- io.opencaesar.oml.sdk.feature/feature.xml | 2 +- io.opencaesar.oml.sdk.feature/pom.xml | 2 +- io.opencaesar.oml.target/pom.xml | 2 +- io.opencaesar.oml/META-INF/MANIFEST.MF | 2 +- io.opencaesar.oml/pom.xml | 2 +- .../src/io/opencaesar/oml/util/OmlRead.java | 6 +- .../src/io/opencaesar/oml/util/OmlSearch.java | 82 +++++++++---------- .../opencaesar/oml/util/OmlUriResolver.java | 5 +- pom.xml | 2 +- version.txt | 2 +- 29 files changed, 76 insertions(+), 69 deletions(-) diff --git a/io.opencaesar.oml.api.feature/feature.xml b/io.opencaesar.oml.api.feature/feature.xml index f337f2e1..0220508e 100644 --- a/io.opencaesar.oml.api.feature/feature.xml +++ b/io.opencaesar.oml.api.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/io.opencaesar.oml.api.feature/pom.xml b/io.opencaesar.oml.api.feature/pom.xml index ab85b705..33eaff75 100644 --- a/io.opencaesar.oml.api.feature/pom.xml +++ b/io.opencaesar.oml.api.feature/pom.xml @@ -4,7 +4,7 @@ io.opencaesar.oml io.opencaesar.oml.parent - 1.0.5 + 1.0.6 io.opencaesar.oml.api.feature eclipse-feature diff --git a/io.opencaesar.oml.dsl.feature/feature.xml b/io.opencaesar.oml.dsl.feature/feature.xml index 5dc28d9c..a7408ee9 100644 --- a/io.opencaesar.oml.dsl.feature/feature.xml +++ b/io.opencaesar.oml.dsl.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/io.opencaesar.oml.dsl.feature/pom.xml b/io.opencaesar.oml.dsl.feature/pom.xml index 7d98c8df..25649ec4 100644 --- a/io.opencaesar.oml.dsl.feature/pom.xml +++ b/io.opencaesar.oml.dsl.feature/pom.xml @@ -4,7 +4,7 @@ io.opencaesar.oml io.opencaesar.oml.parent - 1.0.5 + 1.0.6 io.opencaesar.oml.dsl.feature eclipse-feature diff --git a/io.opencaesar.oml.dsl.ide/META-INF/MANIFEST.MF b/io.opencaesar.oml.dsl.ide/META-INF/MANIFEST.MF index 894eb12b..27551ea9 100644 --- a/io.opencaesar.oml.dsl.ide/META-INF/MANIFEST.MF +++ b/io.opencaesar.oml.dsl.ide/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Automatic-Module-Name: io.opencaesar.oml.dsl.ide Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-Vendor: %providerName -Bundle-Version: 1.0.5 +Bundle-Version: 1.0.6 Bundle-SymbolicName: io.opencaesar.oml.dsl.ide; singleton:=true Bundle-ActivationPolicy: lazy Bundle-Localization: plugin diff --git a/io.opencaesar.oml.dsl.ide/pom.xml b/io.opencaesar.oml.dsl.ide/pom.xml index 3ee9befc..10856006 100644 --- a/io.opencaesar.oml.dsl.ide/pom.xml +++ b/io.opencaesar.oml.dsl.ide/pom.xml @@ -4,7 +4,7 @@ io.opencaesar.oml io.opencaesar.oml.parent - 1.0.5 + 1.0.6 io.opencaesar.oml.dsl.ide eclipse-plugin diff --git a/io.opencaesar.oml.dsl.tests/META-INF/MANIFEST.MF b/io.opencaesar.oml.dsl.tests/META-INF/MANIFEST.MF index 02e35eb7..da0d19f6 100644 --- a/io.opencaesar.oml.dsl.tests/META-INF/MANIFEST.MF +++ b/io.opencaesar.oml.dsl.tests/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Automatic-Module-Name: io.opencaesar.oml.dsl.tests Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-Vendor: %providerName -Bundle-Version: 1.0.5 +Bundle-Version: 1.0.6 Bundle-SymbolicName: io.opencaesar.oml.dsl.tests; singleton:=true Bundle-ActivationPolicy: lazy Bundle-Localization: plugin diff --git a/io.opencaesar.oml.dsl.tests/pom.xml b/io.opencaesar.oml.dsl.tests/pom.xml index 1e911be0..66d135ca 100644 --- a/io.opencaesar.oml.dsl.tests/pom.xml +++ b/io.opencaesar.oml.dsl.tests/pom.xml @@ -4,7 +4,7 @@ io.opencaesar.oml io.opencaesar.oml.parent - 1.0.5 + 1.0.6 io.opencaesar.oml.dsl.tests eclipse-test-plugin diff --git a/io.opencaesar.oml.dsl.ui.tests/META-INF/MANIFEST.MF b/io.opencaesar.oml.dsl.ui.tests/META-INF/MANIFEST.MF index e79eb17d..cac70828 100644 --- a/io.opencaesar.oml.dsl.ui.tests/META-INF/MANIFEST.MF +++ b/io.opencaesar.oml.dsl.ui.tests/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Automatic-Module-Name: io.opencaesar.oml.dsl.ui.tests Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-Vendor: %providerName -Bundle-Version: 1.0.5 +Bundle-Version: 1.0.6 Bundle-SymbolicName: io.opencaesar.oml.dsl.ui.tests; singleton:=true Bundle-ActivationPolicy: lazy Bundle-Localization: plugin diff --git a/io.opencaesar.oml.dsl.ui.tests/pom.xml b/io.opencaesar.oml.dsl.ui.tests/pom.xml index 239363d5..a3c9f488 100644 --- a/io.opencaesar.oml.dsl.ui.tests/pom.xml +++ b/io.opencaesar.oml.dsl.ui.tests/pom.xml @@ -4,7 +4,7 @@ io.opencaesar.oml io.opencaesar.oml.parent - 1.0.5 + 1.0.6 io.opencaesar.oml.dsl.ui.tests eclipse-test-plugin diff --git a/io.opencaesar.oml.dsl.ui/META-INF/MANIFEST.MF b/io.opencaesar.oml.dsl.ui/META-INF/MANIFEST.MF index c74d8d16..55511e01 100644 --- a/io.opencaesar.oml.dsl.ui/META-INF/MANIFEST.MF +++ b/io.opencaesar.oml.dsl.ui/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Automatic-Module-Name: io.opencaesar.oml.dsl.ui Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-Vendor: %providerName -Bundle-Version: 1.0.5 +Bundle-Version: 1.0.6 Bundle-SymbolicName: io.opencaesar.oml.dsl.ui; singleton:=true Bundle-ActivationPolicy: lazy Bundle-Localization: plugin diff --git a/io.opencaesar.oml.dsl.ui/pom.xml b/io.opencaesar.oml.dsl.ui/pom.xml index 7a49da97..43a9cbbd 100644 --- a/io.opencaesar.oml.dsl.ui/pom.xml +++ b/io.opencaesar.oml.dsl.ui/pom.xml @@ -4,7 +4,7 @@ io.opencaesar.oml io.opencaesar.oml.parent - 1.0.5 + 1.0.6 io.opencaesar.oml.dsl.ui eclipse-plugin diff --git a/io.opencaesar.oml.dsl/META-INF/MANIFEST.MF b/io.opencaesar.oml.dsl/META-INF/MANIFEST.MF index e7dfbb59..58ce60c2 100644 --- a/io.opencaesar.oml.dsl/META-INF/MANIFEST.MF +++ b/io.opencaesar.oml.dsl/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Automatic-Module-Name: io.opencaesar.oml.dsl Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-Vendor: %providerName -Bundle-Version: 1.0.5 +Bundle-Version: 1.0.6 Bundle-SymbolicName: io.opencaesar.oml.dsl; singleton:=true Bundle-ActivationPolicy: lazy Bundle-Localization: plugin diff --git a/io.opencaesar.oml.dsl/pom.xml b/io.opencaesar.oml.dsl/pom.xml index d1660ac6..02e0a7d5 100644 --- a/io.opencaesar.oml.dsl/pom.xml +++ b/io.opencaesar.oml.dsl/pom.xml @@ -4,7 +4,7 @@ io.opencaesar.oml io.opencaesar.oml.parent - 1.0.5 + 1.0.6 io.opencaesar.oml.dsl eclipse-plugin diff --git a/io.opencaesar.oml.edit/META-INF/MANIFEST.MF b/io.opencaesar.oml.edit/META-INF/MANIFEST.MF index 604de12d..318c1baf 100644 --- a/io.opencaesar.oml.edit/META-INF/MANIFEST.MF +++ b/io.opencaesar.oml.edit/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: io.opencaesar.oml.edit;singleton:=true Automatic-Module-Name: io.opencaesar.oml.edit -Bundle-Version: 1.0.5 +Bundle-Version: 1.0.6 Bundle-ClassPath: . Bundle-Activator: io.opencaesar.oml.provider.OmlEditPlugin$Implementation Bundle-Vendor: %providerName diff --git a/io.opencaesar.oml.edit/pom.xml b/io.opencaesar.oml.edit/pom.xml index 13f328eb..f2c5bbae 100644 --- a/io.opencaesar.oml.edit/pom.xml +++ b/io.opencaesar.oml.edit/pom.xml @@ -4,7 +4,7 @@ io.opencaesar.oml io.opencaesar.oml.parent - 1.0.5 + 1.0.6 io.opencaesar.oml.edit eclipse-plugin diff --git a/io.opencaesar.oml.editor/META-INF/MANIFEST.MF b/io.opencaesar.oml.editor/META-INF/MANIFEST.MF index 3040e12d..06102ce8 100644 --- a/io.opencaesar.oml.editor/META-INF/MANIFEST.MF +++ b/io.opencaesar.oml.editor/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: io.opencaesar.oml.editor;singleton:=true Automatic-Module-Name: io.opencaesar.oml.editor -Bundle-Version: 1.0.5 +Bundle-Version: 1.0.6 Bundle-ClassPath: . Bundle-Activator: io.opencaesar.oml.presentation.OmlEditorPlugin$Implementation Bundle-Vendor: %providerName diff --git a/io.opencaesar.oml.editor/pom.xml b/io.opencaesar.oml.editor/pom.xml index b80f21dc..b23bf290 100644 --- a/io.opencaesar.oml.editor/pom.xml +++ b/io.opencaesar.oml.editor/pom.xml @@ -4,7 +4,7 @@ io.opencaesar.oml io.opencaesar.oml.parent - 1.0.5 + 1.0.6 io.opencaesar.oml.editor eclipse-plugin diff --git a/io.opencaesar.oml.repository/pom.xml b/io.opencaesar.oml.repository/pom.xml index 6b453da9..c71e2d6e 100644 --- a/io.opencaesar.oml.repository/pom.xml +++ b/io.opencaesar.oml.repository/pom.xml @@ -5,7 +5,7 @@ io.opencaesar.oml io.opencaesar.oml.parent - 1.0.5 + 1.0.6 io.opencaesar.oml.repository diff --git a/io.opencaesar.oml.sdk.feature/feature.xml b/io.opencaesar.oml.sdk.feature/feature.xml index 6b6fa50f..032dcd6b 100644 --- a/io.opencaesar.oml.sdk.feature/feature.xml +++ b/io.opencaesar.oml.sdk.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/io.opencaesar.oml.sdk.feature/pom.xml b/io.opencaesar.oml.sdk.feature/pom.xml index c44f0c26..0646a715 100644 --- a/io.opencaesar.oml.sdk.feature/pom.xml +++ b/io.opencaesar.oml.sdk.feature/pom.xml @@ -4,7 +4,7 @@ io.opencaesar.oml io.opencaesar.oml.parent - 1.0.5 + 1.0.6 io.opencaesar.oml.sdk.feature eclipse-feature diff --git a/io.opencaesar.oml.target/pom.xml b/io.opencaesar.oml.target/pom.xml index d0ba6c2e..7ff7e809 100644 --- a/io.opencaesar.oml.target/pom.xml +++ b/io.opencaesar.oml.target/pom.xml @@ -4,7 +4,7 @@ io.opencaesar.oml io.opencaesar.oml.parent - 1.0.5 + 1.0.6 io.opencaesar.oml.target eclipse-target-definition diff --git a/io.opencaesar.oml/META-INF/MANIFEST.MF b/io.opencaesar.oml/META-INF/MANIFEST.MF index 08c9a0e1..e1df1270 100644 --- a/io.opencaesar.oml/META-INF/MANIFEST.MF +++ b/io.opencaesar.oml/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: io.opencaesar.oml;singleton:=true Automatic-Module-Name: io.opencaesar.oml -Bundle-Version: 1.0.5 +Bundle-Version: 1.0.6 Bundle-ClassPath: ., libs/org.apache.xml.resolver_1.2.0.v201005080400.jar Bundle-Vendor: %providerName diff --git a/io.opencaesar.oml/pom.xml b/io.opencaesar.oml/pom.xml index 6ff3239a..58f3649d 100644 --- a/io.opencaesar.oml/pom.xml +++ b/io.opencaesar.oml/pom.xml @@ -4,7 +4,7 @@ io.opencaesar.oml io.opencaesar.oml.parent - 1.0.5 + 1.0.6 io.opencaesar.oml eclipse-plugin diff --git a/io.opencaesar.oml/src/io/opencaesar/oml/util/OmlRead.java b/io.opencaesar.oml/src/io/opencaesar/oml/util/OmlRead.java index f31e8b4f..063e625f 100644 --- a/io.opencaesar.oml/src/io/opencaesar/oml/util/OmlRead.java +++ b/io.opencaesar.oml/src/io/opencaesar/oml/util/OmlRead.java @@ -20,6 +20,7 @@ import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.LinkedHashMap; import java.util.LinkedHashSet; @@ -435,7 +436,10 @@ public static Set getResolvableUris(Resource resource) { * @return Whether the given resource URI is of an OML resource mapped by a catalog */ public static boolean isUriMappedByCatalog(URI uri) { - return OmlUriResolver.getInstance().isUriMappedByCatalog(uri); + if (Arrays.asList(OmlConstants.OML_EXTENSIONS).contains(uri.fileExtension())) { + return OmlUriResolver.getInstance().isUriMappedByCatalog(uri); + } + return false; } //------------------------------------------------- diff --git a/io.opencaesar.oml/src/io/opencaesar/oml/util/OmlSearch.java b/io.opencaesar.oml/src/io/opencaesar/oml/util/OmlSearch.java index a6e34f4e..e17760e9 100644 --- a/io.opencaesar.oml/src/io/opencaesar/oml/util/OmlSearch.java +++ b/io.opencaesar.oml/src/io/opencaesar/oml/util/OmlSearch.java @@ -646,7 +646,7 @@ public static boolean findIsKindOf(Instance instance, Classifier type) { return false; } - // Entity + // Classifier /** * Finds instances that have the given type as their direct type @@ -683,78 +683,78 @@ public static List findInstancesOfKind(Classifier type) { } - // StructureInstance + // NamedInstance /** - * Finds instances that are related to the given instance as sources of relations + * Finds target instances that are related by any relation to the given source instance * - * @param instance the given instance - * @return a list of instances that are related to the given instance as sources of relations + * @param source the given source instance + * @return a list of target instances that are related by any relation to the given source instance */ - public static List findInstancesRelatedFrom(NamedInstance instance) { - final List instances = new ArrayList<>(); - instances.addAll(findLinkAssertionsWithTarget(instance).stream() - .map(a -> OmlRead.getSource(a)) + public static List findInstancesRelatedFrom(NamedInstance source) { + final List targets = new ArrayList<>(); + targets.addAll(findLinkAssertions(source).stream() + .map(a -> a.getTarget()) .collect(Collectors.toList())); - instances.addAll(findRelationInstancesWithTarget(instance).stream() - .flatMap(a -> a.getSources().stream()) + targets.addAll(findRelationInstancesWithSource(source).stream() + .flatMap(a -> a.getTargets().stream()) .collect(Collectors.toList())); - return instances; + return targets; } /** - * Finds instances that are related to the given instance as sources of a given relation + * Finds target instances that are related by a given relation to the given source instance * - * @param instance the given instance + * @param source the given source instance * @param relation the given relation - * @return a list of instances that are related to the given instance as sources of a given relation + * @return a list of target instances that are related by a given relation to the given source instance */ - public static List findInstancesRelatedFrom(NamedInstance instance, Relation relation) { - final List instances = new ArrayList<>(); - instances.addAll(findLinkAssertionsWithTarget(instance).stream() + public static List findInstancesRelatedFrom(NamedInstance source, Relation relation) { + final List targets = new ArrayList<>(); + targets.addAll(findLinkAssertions(source).stream() .filter(a -> a.getRelation() == relation) - .map(a -> OmlRead.getSource(a)) + .map(a -> a.getTarget()) .collect(Collectors.toList())); - instances.addAll(findRelationInstancesWithTarget(instance).stream() - .filter(i -> findTypes(i).stream().filter(t -> ((RelationEntity)t).getReverseRelation() == relation).findFirst().isPresent()) - .flatMap(i -> i.getSources().stream()) + targets.addAll(findRelationInstancesWithSource(source).stream() + .filter(i -> findTypes(i).stream().filter(t -> ((RelationEntity)t).getForwardRelation() == relation).findFirst().isPresent()) + .flatMap(a -> a.getTargets().stream()) .collect(Collectors.toList())); - return instances; + return targets; } /** - * Finds instances that are related to the given instance as targets of relations + * Finds source instances that are related by any relation to the given target instance * - * @param instance the given instance - * @return a list of instances that are related to the given instance as targets of relations + * @param target the given target instance + * @return a list of source instances that are related by any relation to the given target instance */ - public static List findInstancesRelatedTo(NamedInstance instance) { - final List instances = new ArrayList<>(); - instances.addAll(findLinkAssertions(instance).stream() - .map(a -> a.getTarget()) + public static List findInstancesRelatedTo(NamedInstance target) { + final List sources = new ArrayList<>(); + sources.addAll(findLinkAssertionsWithTarget(target).stream() + .map(a -> OmlRead.getSource(a)) .collect(Collectors.toList())); - instances.addAll(findRelationInstancesWithSource(instance).stream() - .flatMap(a -> a.getTargets().stream()) + sources.addAll(findRelationInstancesWithTarget(target).stream() + .flatMap(a -> a.getSources().stream()) .collect(Collectors.toList())); - return instances; + return sources; } /** - * Finds instances that are related to the given instance as targets of a given relation + * Finds source instances that are related by a given relation to the given target instance * - * @param instance the given instance + * @param target the given target instance * @param relation the given relation - * @return a list of instances that are related to the given instance as targets of a given relation + * @return a list of source instances that are related by a given relation to the given target instance */ public static List findInstancesRelatedTo(NamedInstance instance, Relation relation) { final List instances = new ArrayList<>(); - instances.addAll(findLinkAssertions(instance).stream() + instances.addAll(findLinkAssertionsWithTarget(instance).stream() .filter(a -> a.getRelation() == relation) - .map(a -> a.getTarget()) + .map(a -> OmlRead.getSource(a)) .collect(Collectors.toList())); - instances.addAll(findRelationInstancesWithSource(instance).stream() - .filter(i -> findTypes(i).stream().filter(t -> ((RelationEntity)t).getForwardRelation() == relation).findFirst().isPresent()) - .flatMap(a -> a.getTargets().stream()) + instances.addAll(findRelationInstancesWithTarget(instance).stream() + .filter(i -> findTypes(i).stream().filter(t -> ((RelationEntity)t).getReverseRelation() == relation).findFirst().isPresent()) + .flatMap(i -> i.getSources().stream()) .collect(Collectors.toList())); return instances; } diff --git a/io.opencaesar.oml/src/io/opencaesar/oml/util/OmlUriResolver.java b/io.opencaesar.oml/src/io/opencaesar/oml/util/OmlUriResolver.java index 3426f5ed..e8986e57 100644 --- a/io.opencaesar.oml/src/io/opencaesar/oml/util/OmlUriResolver.java +++ b/io.opencaesar.oml/src/io/opencaesar/oml/util/OmlUriResolver.java @@ -39,6 +39,7 @@ import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.resource.URIConverter; +import org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl; /** * The Resolver for OML ontology URIs @@ -58,8 +59,10 @@ final class OmlUriResolver { private Map watched; private Map> importCache; private Map catalogCache; + private URIConverter uriConverter; private OmlUriResolver() { + uriConverter = new ExtensibleURIConverterImpl(); activate(); } @@ -286,7 +289,7 @@ public OmlCatalog findCatalog(URI folderUri) { private OmlCatalog getCatalog(URI folderUri) { try { URI catalogUri = folderUri.appendSegment("catalog.xml"); - if (new File(CommonPlugin.asLocalURI(catalogUri).toFileString()).exists()) { + if (uriConverter.exists(catalogUri, null)) { return OmlCatalog.create(catalogUri); } } catch (IOException e) { diff --git a/pom.xml b/pom.xml index aea19cdc..10b5d22e 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 io.opencaesar.oml - 1.0.5 + 1.0.6 io.opencaesar.oml.parent pom diff --git a/version.txt b/version.txt index 1464c521..ece61c60 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.0.5 \ No newline at end of file +1.0.6 \ No newline at end of file