Skip to content

Commit 75da4eb

Browse files
add proposal changes
1 parent cc994bb commit 75da4eb

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

core/esmf-aspect-meta-model-java/src/main/java/org/eclipse/esmf/aspectmodel/resolver/FileSystemStrategy.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH
2+
* Copyright (c) 2025 Robert Bosch Manufacturing Solutions GmbH
33
*
44
* See the AUTHORS file(s) distributed with this work for additional
55
* information regarding authorship.
@@ -33,14 +33,12 @@
3333

3434
import io.vavr.control.Try;
3535
import org.apache.jena.rdf.model.Model;
36-
import org.slf4j.Logger;
37-
import org.slf4j.LoggerFactory;
36+
import org.apache.jena.riot.RiotException;
3837

3938
/**
4039
* Resolution strategy for Aspect model URNs that finds Aspect model files in the local file system.
4140
*/
4241
public class FileSystemStrategy implements ResolutionStrategy {
43-
private static final Logger LOG = LoggerFactory.getLogger( FileSystemStrategy.class );
4442
protected final ModelsRoot modelsRoot;
4543

4644
/**
@@ -79,7 +77,7 @@ public FileSystemStrategy( final ModelsRoot modelsRoot ) {
7977
*
8078
* @param aspectModelUrn The model URN
8179
* @return The model on success, {@link IllegalArgumentException} if the model file can not be read,
82-
* {@link org.apache.jena.riot.RiotException} on parser error, {@link MalformedURLException} if the AspectModelUrn is invalid,
80+
* {@link RiotException} on parser error, {@link MalformedURLException} if the AspectModelUrn is invalid,
8381
* {@link FileNotFoundException} if no file containing the element was found
8482
*/
8583
@Override
@@ -94,7 +92,10 @@ public AspectModelFile apply( final AspectModelUrn aspectModelUrn, final Resolut
9492
new ModelResolutionException.LoadingFailure( aspectModelUrn, namedResourceFile.getAbsolutePath(),
9593
tryFile.getCause().getMessage(), tryFile.getCause() ) );
9694
}
97-
return tryFile.get();
95+
final RawAspectModelFile loadedFile = tryFile.get();
96+
if ( resolutionStrategySupport.containsDefinition( loadedFile, aspectModelUrn ) ) {
97+
return loadedFile;
98+
}
9899
} else {
99100
checkedLocations.add( new ModelResolutionException.LoadingFailure( aspectModelUrn, namedResourceFile.getAbsolutePath(),
100101
"File does not exist" ) );

0 commit comments

Comments
 (0)