diff --git a/robot/src/main/java/org/incenp/obofoundry/sssom/robot/SSSOMInjectionCommand.java b/robot/src/main/java/org/incenp/obofoundry/sssom/robot/SSSOMInjectionCommand.java index 10cd14d..5a04a2e 100644 --- a/robot/src/main/java/org/incenp/obofoundry/sssom/robot/SSSOMInjectionCommand.java +++ b/robot/src/main/java/org/incenp/obofoundry/sssom/robot/SSSOMInjectionCommand.java @@ -144,6 +144,7 @@ public CommandState execute(CommandState state, String[] args) throws Exception OWLOntology ontology = state.getOntology(); OWLGenerator axiomGenerator = new OWLGenerator(); + Map prefixes = ioHelper.getPrefixes(); MappingSet mappingSet = null; if ( line.hasOption("sssom") ) { @@ -158,7 +159,7 @@ public CommandState execute(CommandState state, String[] args) throws Exception } if ( line.hasOption("extract") ) { XrefExtractor extractor = new XrefExtractor(); - extractor.setPrefixMap(ioHelper.getPrefixes()); + extractor.setPrefixMap(prefixes); extractor.fillPrefixToPredicateMap(ontology); if ( mappingSet == null ) { mappingSet = extractor.extract(ontology); @@ -175,14 +176,14 @@ public CommandState execute(CommandState state, String[] args) throws Exception } if ( line.hasOption("only-subject-in") ) { - String pr = ioHelper.getPrefixes().get(line.getOptionValue("only-subject-in")); + String pr = prefixes.get(line.getOptionValue("only-subject-in")); if ( pr != null ) { axiomGenerator.addStopingRule((mapping) -> !mapping.getSubjectId().startsWith(pr)); } } if ( line.hasOption("only-object-in") ) { - String pr = ioHelper.getPrefixes().get(line.getOptionValue("only-object-in")); + String pr = prefixes.get(line.getOptionValue("only-object-in")); if ( pr != null ) { axiomGenerator.addStopingRule((mapping) -> !mapping.getObjectId().startsWith(pr)); } @@ -209,9 +210,8 @@ public CommandState execute(CommandState state, String[] args) throws Exception if (line.hasOption("hasdbxref")) { PrefixManager pm = new PrefixManager(); - Map clMap = ioHelper.getPrefixes(); - for ( String prefixName : clMap.keySet() ) { - pm.add(prefixName, clMap.get(prefixName)); + for ( String prefixName : prefixes.keySet() ) { + pm.add(prefixName, prefixes.get(prefixName)); } IMappingTransformer texter = (mapping) -> pm.shortenIdentifier(mapping.getObjectId()); axiomGenerator.addRule(null, null, new AnnotationAxiomGenerator(ontology, @@ -223,7 +223,7 @@ public CommandState execute(CommandState state, String[] args) throws Exception SSSOMTransformReader sssomtReader = new SSSOMTransformReader(sssomApplication, line.getOptionValue("ruleset")); if ( !line.hasOption("no-default-prefixes") ) { - sssomtReader.addPrefixMap(ioHelper.getPrefixes()); + sssomtReader.addPrefixMap(prefixes); } sssomtReader.read();