Search in sources :

Example 1 with CurieMappings

use of org.geneontology.minerva.curie.CurieMappings in project minerva by geneontology.

the class ARTHandlerTest method setUpBeforeClass.

/**
 * @throws java.lang.Exception
 */
@BeforeClass
public static void setUpBeforeClass() throws Exception {
    LOGGER.info("Setup shex.");
    File shex_schema_file = new File("src/test/resources/validate.shex");
    File shex_map_file = new File("src/test/resources/validate.shapemap");
    LOGGER.info("Set up molecular model manager - loading files into a journal");
    // set curie handler
    final CurieMappings localMappings = new CurieMappings.SimpleCurieMappings(Collections.singletonMap(modelIdcurie, modelIdPrefix));
    curieHandler = new MappedCurieHandler(DefaultCurieHandler.loadDefaultMappings(), localMappings);
    String inputDB = makeBlazegraphJournal(valid_model_folder);
    OWLOntologyManager ontman = OWLManager.createOWLOntologyManager();
    // empty tbox
    tbox_ontology = ontman.createOntology(IRI.create("http://example.org/dummy"));
    models = new UndoAwareMolecularModelManager(tbox_ontology, curieHandler, modelIdPrefix, inputDB, model_save, go_lego_journal_file, true);
    models.addTaxonMetadata();
    LOGGER.info("Setup Jetty config.");
    ResourceConfig resourceConfig = new ResourceConfig();
    resourceConfig.register(GsonMessageBodyHandler.class);
    resourceConfig.register(RequireJsonpFilter.class);
    MinervaShexValidator shex = new MinervaShexValidator(shex_schema_file, shex_map_file, curieHandler, models.getGolego_repo());
    shex.setActive(true);
    // setup the config for the startup tool.
    MinervaStartUpConfig conf = new MinervaStartUpConfig();
    conf.reasonerOpt = "arachne";
    conf.shex = shex;
    conf.port = 6800;
    conf.contextString = "/";
    InferenceProviderCreator ipc = StartUpTool.createInferenceProviderCreator(conf.reasonerOpt, models, conf.shex);
    ModelARTHandler artHandler = new ModelARTHandler(models, ipc);
    // set up a handler for testing with M3BatchRequest service
    handler = new JsonOrJsonpBatchHandler(models, "development", ipc, Collections.<OWLObjectProperty>emptySet(), (ExternalLookupService) null);
    resourceConfig = resourceConfig.registerInstances(artHandler);
    // setup jetty server port, buffers and context path
    server = new Server();
    // create connector with port and custom buffer sizes
    HttpConfiguration http_config = new HttpConfiguration();
    http_config.setRequestHeaderSize(conf.requestHeaderSize);
    ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory(http_config));
    connector.setPort(conf.port);
    server.addConnector(connector);
    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setContextPath(conf.contextString);
    server.setHandler(context);
    ServletHolder h = new ServletHolder(new ServletContainer(resourceConfig));
    context.addServlet(h, "/*");
    // start jetty server
    LOGGER.info("Start server on port: " + conf.port + " context: " + conf.contextString);
    server.start();
}
Also used : MappedCurieHandler(org.geneontology.minerva.curie.MappedCurieHandler) CurieMappings(org.geneontology.minerva.curie.CurieMappings) Server(org.eclipse.jetty.server.Server) HttpConnectionFactory(org.eclipse.jetty.server.HttpConnectionFactory) UndoAwareMolecularModelManager(org.geneontology.minerva.UndoAwareMolecularModelManager) ServletHolder(org.eclipse.jetty.servlet.ServletHolder) InferenceProviderCreator(org.geneontology.minerva.server.inferences.InferenceProviderCreator) MinervaStartUpConfig(org.geneontology.minerva.server.StartUpTool.MinervaStartUpConfig) HttpConfiguration(org.eclipse.jetty.server.HttpConfiguration) ServerConnector(org.eclipse.jetty.server.ServerConnector) ServletContainer(org.glassfish.jersey.servlet.ServletContainer) ResourceConfig(org.glassfish.jersey.server.ResourceConfig) ServletContextHandler(org.eclipse.jetty.servlet.ServletContextHandler) File(java.io.File) MinervaShexValidator(org.geneontology.minerva.server.validation.MinervaShexValidator) ExternalLookupService(org.geneontology.minerva.lookup.ExternalLookupService)

Example 2 with CurieMappings

use of org.geneontology.minerva.curie.CurieMappings in project minerva by geneontology.

the class LocalServerTest method init.

static void init(ParserWrapper pw) throws Exception {
    final OWLOntology tbox = OWLManager.createOWLOntologyManager().loadOntology(IRI.create(new File("src/test/resources/go-lego-minimal.owl")));
    // curie handler
    final String modelIdcurie = "gomodel";
    final String modelIdPrefix = "http://model.geneontology.org/";
    final CurieMappings localMappings = new CurieMappings.SimpleCurieMappings(Collections.singletonMap(modelIdcurie, modelIdPrefix));
    curieHandler = new MappedCurieHandler(DefaultCurieHandler.loadDefaultMappings(), localMappings);
    models = new UndoAwareMolecularModelManager(tbox, curieHandler, modelIdPrefix, folder.newFile().getAbsolutePath(), null, go_lego_journal_file, true);
    MinervaStartUpConfig conf = new MinervaStartUpConfig();
    conf.reasonerOpt = "elk";
    conf.useRequestLogging = true;
    conf.checkLiteralIds = false;
    conf.lookupService = null;
    conf.importantRelations = null;
    conf.port = 6800;
    conf.contextString = "/";
    server = StartUpTool.startUp(models, conf, null);
    urlPrefix = "http://localhost:" + conf.port + conf.contextString;
}
Also used : MappedCurieHandler(org.geneontology.minerva.curie.MappedCurieHandler) CurieMappings(org.geneontology.minerva.curie.CurieMappings) UndoAwareMolecularModelManager(org.geneontology.minerva.UndoAwareMolecularModelManager) OWLOntology(org.semanticweb.owlapi.model.OWLOntology) MinervaStartUpConfig(org.geneontology.minerva.server.StartUpTool.MinervaStartUpConfig) File(java.io.File)

Example 3 with CurieMappings

use of org.geneontology.minerva.curie.CurieMappings in project minerva by geneontology.

the class ModelEditTest method init.

static void init(ParserWrapper pw) throws OWLOntologyCreationException, IOException {
    // This includes only the needed terms for the test to pass
    final OWLOntology tbox = OWLManager.createOWLOntologyManager().loadOntology(IRI.create(new File("src/test/resources/edit-test/go-lego-empty.owl")));
    // curie handler
    final String modelIdcurie = "gomodel";
    final String modelIdPrefix = "http://model.geneontology.org/";
    final CurieMappings localMappings = new CurieMappings.SimpleCurieMappings(Collections.singletonMap(modelIdcurie, modelIdPrefix));
    curieHandler = new MappedCurieHandler(DefaultCurieHandler.loadDefaultMappings(), localMappings);
    models = new UndoAwareMolecularModelManager(tbox, curieHandler, modelIdPrefix, folder.newFile().getAbsolutePath(), null, go_lego_journal_file, true);
    InferenceProviderCreator ipc = null;
    handler = new JsonOrJsonpBatchHandler(models, "development", ipc, Collections.<OWLObjectProperty>emptySet(), (ExternalLookupService) null);
}
Also used : MappedCurieHandler(org.geneontology.minerva.curie.MappedCurieHandler) CurieMappings(org.geneontology.minerva.curie.CurieMappings) UndoAwareMolecularModelManager(org.geneontology.minerva.UndoAwareMolecularModelManager) InferenceProviderCreator(org.geneontology.minerva.server.inferences.InferenceProviderCreator) File(java.io.File) ExternalLookupService(org.geneontology.minerva.lookup.ExternalLookupService)

Example 4 with CurieMappings

use of org.geneontology.minerva.curie.CurieMappings in project minerva by geneontology.

the class ParallelModelReasonerTest method init.

static void init(ParserWrapper pw) throws OWLOntologyCreationException, IOException {
    // FIXME need more from go-lego
    final OWLOntology tbox = OWLManager.createOWLOntologyManager().loadOntology(IRI.create(new File("src/test/resources/go-lego-minimal.owl")));
    // curie handler
    final String modelIdcurie = "gomodel";
    final String modelIdPrefix = "http://model.geneontology.org/";
    final CurieMappings localMappings = new CurieMappings.SimpleCurieMappings(Collections.singletonMap(modelIdcurie, modelIdPrefix));
    curieHandler = new MappedCurieHandler(DefaultCurieHandler.loadDefaultMappings(), localMappings);
    models = new UndoAwareMolecularModelManager(tbox, curieHandler, modelIdPrefix, folder.newFile().getAbsolutePath(), null, go_lego_journal_file, true);
    ipc = new CountingCachingInferenceProvider(false);
    handler = new JsonOrJsonpBatchHandler(models, "development", ipc, Collections.<OWLObjectProperty>emptySet(), (ExternalLookupService) null);
// models.setPathToOWLFiles("src/test/resources/reasoner-test");
}
Also used : MappedCurieHandler(org.geneontology.minerva.curie.MappedCurieHandler) CurieMappings(org.geneontology.minerva.curie.CurieMappings) UndoAwareMolecularModelManager(org.geneontology.minerva.UndoAwareMolecularModelManager) OWLOntology(org.semanticweb.owlapi.model.OWLOntology) File(java.io.File) OWLObjectProperty(org.semanticweb.owlapi.model.OWLObjectProperty) ExternalLookupService(org.geneontology.minerva.lookup.ExternalLookupService)

Example 5 with CurieMappings

use of org.geneontology.minerva.curie.CurieMappings in project minerva by geneontology.

the class ValidationTest method setUpBeforeClass.

@BeforeClass
public static void setUpBeforeClass() {
    CurieMappings localMappings = new CurieMappings.SimpleCurieMappings(Collections.singletonMap(modelIdcurie, modelIdPrefix));
    curieHandler = new MappedCurieHandler(DefaultCurieHandler.loadDefaultMappings(), localMappings);
    LOGGER.info("loading tbox ontology: " + ontologyIRI);
    OWLOntologyManager ontman = OWLManager.createOWLOntologyManager();
    LOGGER.info("using catalog: " + catalog);
    try {
        ontman.setIRIMappers(Sets.newHashSet(new owltools.io.CatalogXmlIRIMapper(catalog)));
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    try {
        tbox_ontology = ontman.loadOntology(IRI.create(ontologyIRI));
    } catch (OWLOntologyCreationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    LOGGER.info("tbox ontologies loaded: " + tbox_ontology.getAxiomCount());
}
Also used : MappedCurieHandler(org.geneontology.minerva.curie.MappedCurieHandler) CurieMappings(org.geneontology.minerva.curie.CurieMappings) IOException(java.io.IOException) BeforeClass(org.junit.BeforeClass)

Aggregations

CurieMappings (org.geneontology.minerva.curie.CurieMappings)11 MappedCurieHandler (org.geneontology.minerva.curie.MappedCurieHandler)11 UndoAwareMolecularModelManager (org.geneontology.minerva.UndoAwareMolecularModelManager)7 File (java.io.File)6 ExternalLookupService (org.geneontology.minerva.lookup.ExternalLookupService)5 InferenceProviderCreator (org.geneontology.minerva.server.inferences.InferenceProviderCreator)5 Server (org.eclipse.jetty.server.Server)3 MinervaShexValidator (org.geneontology.minerva.server.validation.MinervaShexValidator)3 URL (java.net.URL)2 HttpConfiguration (org.eclipse.jetty.server.HttpConfiguration)2 HttpConnectionFactory (org.eclipse.jetty.server.HttpConnectionFactory)2 ServerConnector (org.eclipse.jetty.server.ServerConnector)2 ServletContextHandler (org.eclipse.jetty.servlet.ServletContextHandler)2 ServletHolder (org.eclipse.jetty.servlet.ServletHolder)2 CurieHandler (org.geneontology.minerva.curie.CurieHandler)2 DefaultCurieHandler (org.geneontology.minerva.curie.DefaultCurieHandler)2 GPADSPARQLExport (org.geneontology.minerva.legacy.sparql.GPADSPARQLExport)2 MinervaStartUpConfig (org.geneontology.minerva.server.StartUpTool.MinervaStartUpConfig)2 ResourceConfig (org.glassfish.jersey.server.ResourceConfig)2 ServletContainer (org.glassfish.jersey.servlet.ServletContainer)2