Skip to content

Commit

Permalink
Fixing a few APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
melaasar committed Dec 1, 2021
1 parent b23fa0e commit 3276945
Show file tree
Hide file tree
Showing 29 changed files with 76 additions and 69 deletions.
2 changes: 1 addition & 1 deletion io.opencaesar.oml.api.feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feature
id="io.opencaesar.oml.api.feature"
label="%featureName"
version="1.0.5"
version="1.0.6"
provider-name="%providerName">

<description>
Expand Down
2 changes: 1 addition & 1 deletion io.opencaesar.oml.api.feature/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.opencaesar.oml</groupId>
<artifactId>io.opencaesar.oml.parent</artifactId>
<version>1.0.5</version>
<version>1.0.6</version>
</parent>
<artifactId>io.opencaesar.oml.api.feature</artifactId>
<packaging>eclipse-feature</packaging>
Expand Down
2 changes: 1 addition & 1 deletion io.opencaesar.oml.dsl.feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feature
id="io.opencaesar.oml.dsl.feature"
label="%featureName"
version="1.0.5"
version="1.0.6"
provider-name="%providerName">

<description>
Expand Down
2 changes: 1 addition & 1 deletion io.opencaesar.oml.dsl.feature/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.opencaesar.oml</groupId>
<artifactId>io.opencaesar.oml.parent</artifactId>
<version>1.0.5</version>
<version>1.0.6</version>
</parent>
<artifactId>io.opencaesar.oml.dsl.feature</artifactId>
<packaging>eclipse-feature</packaging>
Expand Down
2 changes: 1 addition & 1 deletion io.opencaesar.oml.dsl.ide/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion io.opencaesar.oml.dsl.ide/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.opencaesar.oml</groupId>
<artifactId>io.opencaesar.oml.parent</artifactId>
<version>1.0.5</version>
<version>1.0.6</version>
</parent>
<artifactId>io.opencaesar.oml.dsl.ide</artifactId>
<packaging>eclipse-plugin</packaging>
Expand Down
2 changes: 1 addition & 1 deletion io.opencaesar.oml.dsl.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion io.opencaesar.oml.dsl.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.opencaesar.oml</groupId>
<artifactId>io.opencaesar.oml.parent</artifactId>
<version>1.0.5</version>
<version>1.0.6</version>
</parent>
<artifactId>io.opencaesar.oml.dsl.tests</artifactId>
<packaging>eclipse-test-plugin</packaging>
Expand Down
2 changes: 1 addition & 1 deletion io.opencaesar.oml.dsl.ui.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion io.opencaesar.oml.dsl.ui.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.opencaesar.oml</groupId>
<artifactId>io.opencaesar.oml.parent</artifactId>
<version>1.0.5</version>
<version>1.0.6</version>
</parent>
<artifactId>io.opencaesar.oml.dsl.ui.tests</artifactId>
<packaging>eclipse-test-plugin</packaging>
Expand Down
2 changes: 1 addition & 1 deletion io.opencaesar.oml.dsl.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion io.opencaesar.oml.dsl.ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.opencaesar.oml</groupId>
<artifactId>io.opencaesar.oml.parent</artifactId>
<version>1.0.5</version>
<version>1.0.6</version>
</parent>
<artifactId>io.opencaesar.oml.dsl.ui</artifactId>
<packaging>eclipse-plugin</packaging>
Expand Down
2 changes: 1 addition & 1 deletion io.opencaesar.oml.dsl/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion io.opencaesar.oml.dsl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.opencaesar.oml</groupId>
<artifactId>io.opencaesar.oml.parent</artifactId>
<version>1.0.5</version>
<version>1.0.6</version>
</parent>
<artifactId>io.opencaesar.oml.dsl</artifactId>
<packaging>eclipse-plugin</packaging>
Expand Down
2 changes: 1 addition & 1 deletion io.opencaesar.oml.edit/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion io.opencaesar.oml.edit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.opencaesar.oml</groupId>
<artifactId>io.opencaesar.oml.parent</artifactId>
<version>1.0.5</version>
<version>1.0.6</version>
</parent>
<artifactId>io.opencaesar.oml.edit</artifactId>
<packaging>eclipse-plugin</packaging>
Expand Down
2 changes: 1 addition & 1 deletion io.opencaesar.oml.editor/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion io.opencaesar.oml.editor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.opencaesar.oml</groupId>
<artifactId>io.opencaesar.oml.parent</artifactId>
<version>1.0.5</version>
<version>1.0.6</version>
</parent>
<artifactId>io.opencaesar.oml.editor</artifactId>
<packaging>eclipse-plugin</packaging>
Expand Down
2 changes: 1 addition & 1 deletion io.opencaesar.oml.repository/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.opencaesar.oml</groupId>
<artifactId>io.opencaesar.oml.parent</artifactId>
<version>1.0.5</version>
<version>1.0.6</version>
</parent>

<artifactId>io.opencaesar.oml.repository</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion io.opencaesar.oml.sdk.feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feature
id="io.opencaesar.oml.sdk.feature"
label="%featureName"
version="1.0.5"
version="1.0.6"
provider-name="%providerName">

<description>
Expand Down
2 changes: 1 addition & 1 deletion io.opencaesar.oml.sdk.feature/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.opencaesar.oml</groupId>
<artifactId>io.opencaesar.oml.parent</artifactId>
<version>1.0.5</version>
<version>1.0.6</version>
</parent>
<artifactId>io.opencaesar.oml.sdk.feature</artifactId>
<packaging>eclipse-feature</packaging>
Expand Down
2 changes: 1 addition & 1 deletion io.opencaesar.oml.target/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.opencaesar.oml</groupId>
<artifactId>io.opencaesar.oml.parent</artifactId>
<version>1.0.5</version>
<version>1.0.6</version>
</parent>
<artifactId>io.opencaesar.oml.target</artifactId>
<packaging>eclipse-target-definition</packaging>
Expand Down
2 changes: 1 addition & 1 deletion io.opencaesar.oml/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion io.opencaesar.oml/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.opencaesar.oml</groupId>
<artifactId>io.opencaesar.oml.parent</artifactId>
<version>1.0.5</version>
<version>1.0.6</version>
</parent>
<artifactId>io.opencaesar.oml</artifactId>
<packaging>eclipse-plugin</packaging>
Expand Down
6 changes: 5 additions & 1 deletion io.opencaesar.oml/src/io/opencaesar/oml/util/OmlRead.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -435,7 +436,10 @@ public static Set<URI> 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;
}

//-------------------------------------------------
Expand Down
82 changes: 41 additions & 41 deletions io.opencaesar.oml/src/io/opencaesar/oml/util/OmlSearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -683,78 +683,78 @@ public static List<Instance> 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<NamedInstance> findInstancesRelatedFrom(NamedInstance instance) {
final List<NamedInstance> instances = new ArrayList<>();
instances.addAll(findLinkAssertionsWithTarget(instance).stream()
.map(a -> OmlRead.getSource(a))
public static List<NamedInstance> findInstancesRelatedFrom(NamedInstance source) {
final List<NamedInstance> 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<NamedInstance> findInstancesRelatedFrom(NamedInstance instance, Relation relation) {
final List<NamedInstance> instances = new ArrayList<>();
instances.addAll(findLinkAssertionsWithTarget(instance).stream()
public static List<NamedInstance> findInstancesRelatedFrom(NamedInstance source, Relation relation) {
final List<NamedInstance> 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<NamedInstance> findInstancesRelatedTo(NamedInstance instance) {
final List<NamedInstance> instances = new ArrayList<>();
instances.addAll(findLinkAssertions(instance).stream()
.map(a -> a.getTarget())
public static List<NamedInstance> findInstancesRelatedTo(NamedInstance target) {
final List<NamedInstance> 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<NamedInstance> findInstancesRelatedTo(NamedInstance instance, Relation relation) {
final List<NamedInstance> 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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <B>Resolver</B> for OML ontology URIs
Expand All @@ -58,8 +59,10 @@ final class OmlUriResolver {
private Map<WatchKey, File> watched;
private Map<URI, Map<String, URI>> importCache;
private Map<URI, OmlCatalog> catalogCache;
private URIConverter uriConverter;

private OmlUriResolver() {
uriConverter = new ExtensibleURIConverterImpl();
activate();
}

Expand Down Expand Up @@ -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) {
Expand Down
Loading

0 comments on commit 3276945

Please sign in to comment.