Skip to content

Commit

Permalink
Add IRIMapper for SKOS Core Vocabulary
Browse files Browse the repository at this point in the history
Resolves #22
  • Loading branch information
jvendetti committed Nov 2, 2023
1 parent 1cb461b commit 894594b
Show file tree
Hide file tree
Showing 4 changed files with 512 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/org/stanford/ncbo/owlapi/wrapper/OntologyParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.semanticweb.owlapi.search.EntitySearcher;
import org.semanticweb.owlapi.util.AutoIRIMapper;
import org.semanticweb.owlapi.util.InferredSubClassAxiomGenerator;
import org.semanticweb.owlapi.util.SimpleIRIMapper;
import org.semanticweb.owlapi.vocab.OWLRDFVocabulary;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -25,6 +26,7 @@
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.net.URL;
import java.util.*;

public class OntologyParser {
Expand Down Expand Up @@ -52,6 +54,16 @@ public OntologyParser(ParserInvocation parserInvocation) throws OntologyParserEx
setLocalFileRepositaryMapping(this.sourceOwlManager, this.parserInvocation.getInputRepositoryFolder());

this.targetOwlManager = OWLManager.createOWLOntologyManager();

// Maintain a local copy of the SKOS Core Vocabulary to work around W3C rate limiting
IRI skosCoreIRI = IRI.create("http://www.w3.org/2004/02/skos/core");
ClassLoader classLoader = OntologyParser.class.getClassLoader();
URL url = classLoader.getResource("skos.rdf");
log.info("Loaded SKOS Core Vocabulary from: {}", url.getPath());
IRI skosCoreDocumentIRI = IRI.create(url);
SimpleIRIMapper mapper = new SimpleIRIMapper(skosCoreIRI, skosCoreDocumentIRI);
this.sourceOwlManager.getIRIMappers().add(mapper);
this.targetOwlManager.getIRIMappers().add(mapper);
}


Expand Down
Loading

0 comments on commit 894594b

Please sign in to comment.