Tabnine Logo
OntologyIndexer
Code IndexAdd Tabnine to your IDE (free)

How to use
OntologyIndexer
in
uk.ac.ebi.intact.dataexchange.psimi.solr.ontology

Best Java code snippets using uk.ac.ebi.intact.dataexchange.psimi.solr.ontology.OntologyIndexer (Showing top 20 results out of 315)

origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr-core

public void indexOntology(OntologyIterator ontologyIterator) throws IntactSolrException {
  if (ontologySolrServer == null) {
    throw new IllegalStateException("To index an ontology, an ontology SolrServer must be passed to the constructor");
  }
  OntologyIndexer ontologyIndexer = new OntologyIndexer(ontologySolrServer);
  ontologyIndexer.indexOntology(ontologyIterator);
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr-core

public void indexOntologies(OntologyMapping[] ontologyMappings) throws IntactSolrException {
  if (ontologySolrServer == null) {
    throw new IllegalStateException("To index an ontology, an ontology SolrServer must be passed to the constructor");
  }
  
  if (log.isInfoEnabled()) log.info("Indexing ontologies: "+ Arrays.asList(ontologyMappings));
  
  OntologyIndexer ontologyIndexer = new OntologyIndexer(ontologySolrServer);
  ontologyIndexer.indexObo(ontologyMappings);
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr

public void index(OntologyDocument ontologyDocument) throws IntactSolrException {
   index(ontologyDocument, new DefaultDocumentFilter());
}
origin: uk.ac.ebi.intact.dataexchange/intact-tasks

public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
  if (ontologiesSolrUrl == null) {
    throw new NullPointerException("ontologiesSolrUrl is null");
  }
  HttpSolrServer ontologiesSolrServer = createSolrServer();
  OntologyIndexer ontologyIndexer = new OntologyIndexer(ontologiesSolrServer);
  if (taxonomyOntologyMappings != null) {
    indexUniprotTaxonomy = true;
  }
  if (indexUniprotTaxonomy) {
    if (taxonomyOntologyMappings == null) {
      ontologyIndexer.indexUniprotTaxonomy();
    } else {
      for (OntologyMapping om : taxonomyOntologyMappings) {
        ontologyIndexer.indexOntology(new UniprotTaxonomyOntologyIterator(om.getUrl()));
      }
    }
  }
  ontologyIndexer.indexObo(oboOntologyMappings.toArray(new OntologyMapping[oboOntologyMappings.size()]));
  long count = countDocs(ontologiesSolrServer);
  contribution.getExitStatus().addExitDescription("Total docs in index: "+count);
  ontologiesSolrServer.shutdown();
  return RepeatStatus.FINISHED;
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr-core

public void indexOntology(OntologyIterator ontologyIterator) {
  indexOntology(ontologyIterator, new DefaultDocumentFilter());
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr-core

public void indexObo(String ontologyName, URL oboUrl) throws IntactSolrException {
  indexObo(ontologyName, oboUrl, new DefaultDocumentFilter());
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr

public void index(OntologyDocument ontologyDocument, DocumentFilter documentFilter) throws IntactSolrException {
  if (documentFilter != null && !documentFilter.accept(ontologyDocument)) {
    return;
  }
  SolrInputDocument doc = createSolrInputDocument(ontologyDocument);
  try {
    solrServer.add(doc);
  } catch (Exception e) {
    throw new IntactSolrException("Problem adding ontology document to SOLR server: "+ontologyDocument, e);
  }
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr-core

    commitSolr(false);
    numberDoc = 0;
commitSolr(false);
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr

private SolrInputDocument createSolrInputDocument(OntologyDocument ontologyDocument) {
  SolrInputDocument doc = new SolrInputDocument();
  String uniqueKey = ontologyDocument.getOntology() + "_" + ontologyDocument.getParentId() + "_" + ontologyDocument.getChildId() + "_" + ontologyDocument.getRelationshipType();
  addField(doc, OntologyFieldNames.ID, uniqueKey, false);
  addField(doc, OntologyFieldNames.ONTOLOGY, ontologyDocument.getOntology(), false);
  addField(doc, OntologyFieldNames.PARENT_ID, ontologyDocument.getParentId(), false);
  addField(doc, OntologyFieldNames.PARENT_NAME, ontologyDocument.getParentName(), true);
  addField(doc, OntologyFieldNames.CHILD_ID, ontologyDocument.getChildId(), false);
  addField(doc, OntologyFieldNames.CHILD_NAME, ontologyDocument.getChildName(), true);
  addField(doc, OntologyFieldNames.RELATIONSHIP_TYPE, ontologyDocument.getRelationshipType(), false);
  addField(doc, OntologyFieldNames.CYCLIC, ontologyDocument.isCyclicRelationship(), false);
  
  for (String synonym : ontologyDocument.getParentSynonyms()) {
    addField(doc, OntologyFieldNames.PARENT_SYNONYMS, synonym, false);
  }
  for (String synonym : ontologyDocument.getChildSynonyms()) {
    addField(doc, OntologyFieldNames.CHILDREN_SYNONYMS, synonym, false);
  }
  return doc;
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr

public void indexOntology(OntologyIterator ontologyIterator) {
  indexOntology(ontologyIterator, new DefaultDocumentFilter());
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr

public void indexObo(OntologyMapping[] ontologyMappings) throws IntactSolrException {
  indexObo(ontologyMappings, new DefaultDocumentFilter());
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr-core

public void index(OntologyDocument ontologyDocument, DocumentFilter documentFilter) throws IntactSolrException {
  if (documentFilter != null && !documentFilter.accept(ontologyDocument)) {
    return;
  }
  SolrInputDocument doc = createSolrInputDocument(ontologyDocument);
  try {
    solrServer.add(doc);
  } catch (Exception e) {
    int numberOfTries = 1;
    boolean isSuccessful = false;
    while (numberOfTries <= this.numberOfTries && !isSuccessful){
      try {
        solrServer.add(doc);
        isSuccessful = true;
      } catch (Exception e2) {
        numberOfTries++;
      }
    }
    if (!isSuccessful){
      throw new IntactSolrException("Problem adding ontology document to SOLR server: "+ontologyDocument, e);
    }
  }
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr

public void indexOntology(OntologyIterator ontologyIterator, DocumentFilter documentFilter) {
  Iterator<SolrInputDocument> iter = new SolrInputDocumentIterator(ontologyIterator, documentFilter);
  try {
    solrServer.add(iter);
  } catch (Throwable e) {
    throw new IntactSolrException("Problem indexing documents using iterator", e);
  }
  commitSolr(true);
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr-core

private SolrInputDocument createSolrInputDocument(OntologyDocument ontologyDocument) {
  SolrInputDocument doc = new SolrInputDocument();
  String uniqueKey = ontologyDocument.getOntology() + "_" + ontologyDocument.getParentId() + "_" + ontologyDocument.getChildId() + "_" + ontologyDocument.getRelationshipType();
  addField(doc, OntologyFieldNames.ID, uniqueKey, false);
  addField(doc, OntologyFieldNames.ONTOLOGY, ontologyDocument.getOntology(), false);
  addField(doc, OntologyFieldNames.PARENT_ID, ontologyDocument.getParentId(), false);
  addField(doc, OntologyFieldNames.PARENT_NAME, ontologyDocument.getParentName(), true);
  addField(doc, OntologyFieldNames.CHILD_ID, ontologyDocument.getChildId(), false);
  addField(doc, OntologyFieldNames.CHILD_NAME, ontologyDocument.getChildName(), true);
  //addField(doc, OntologyFieldNames.RELATIONSHIP_TYPE, ontologyDocument.getRelationshipType(), false);
  //addField(doc, OntologyFieldNames.CYCLIC, ontologyDocument.isCyclicRelationship(), false);
  for (String synonym : ontologyDocument.getParentSynonyms()) {
    addField(doc, OntologyFieldNames.PARENT_SYNONYMS, synonym, false);
  }
  for (String synonym : ontologyDocument.getChildSynonyms()) {
    addField(doc, OntologyFieldNames.CHILDREN_SYNONYMS, synonym, false);
  }
  return doc;
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr

public void indexOntology(OntologyIterator ontologyIterator) throws IntactSolrException {
  if (ontologySolrServer == null) {
    throw new IllegalStateException("To index an ontology, an ontology SolrServer must be passed to the constructor");
  }
  OntologyIndexer ontologyIndexer = new OntologyIndexer(ontologySolrServer);
  ontologyIndexer.indexOntology(ontologyIterator);
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr

public void indexOntologies(OntologyMapping[] ontologyMappings) throws IntactSolrException {
  if (ontologySolrServer == null) {
    throw new IllegalStateException("To index an ontology, an ontology SolrServer must be passed to the constructor");
  }
  
  if (log.isInfoEnabled()) log.info("Indexing ontologies: "+ Arrays.asList(ontologyMappings));
  
  OntologyIndexer ontologyIndexer = new OntologyIndexer(ontologySolrServer);
  ontologyIndexer.indexObo(ontologyMappings);
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr-core

public void indexObo(String ontologyName, URL oboUrl, DocumentFilter documentFilter) throws IntactSolrException {
  OntologyIterator oboIterator;
  if ( log.isInfoEnabled() ) log.info( "Starting to index " + ontologyName + " from " + oboUrl );
  try {
    oboIterator = new OboOntologyIterator(ontologyName, oboUrl);
  } catch (Throwable e) {
    throw new IntactSolrException("Problem creating OBO iterator for: "+ontologyName+" URL: "+oboUrl, e);
  }
  indexOntology(oboIterator, documentFilter);
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr

public void indexObo(String ontologyName, URL oboUrl) throws IntactSolrException {
  indexObo(ontologyName, oboUrl, new DefaultDocumentFilter());
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr-core

public void index(OntologyDocument ontologyDocument) throws IntactSolrException {
  index(ontologyDocument, new DefaultDocumentFilter());
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr

public void indexObo(String ontologyName, URL oboUrl, DocumentFilter documentFilter) throws IntactSolrException {
  OntologyIterator oboIterator;
  if ( log.isInfoEnabled() ) log.info( "Starting to index " + ontologyName + " from " + oboUrl );
  try {
    oboIterator = new OboOntologyIterator(ontologyName, oboUrl);
  } catch (Throwable e) {
    throw new IntactSolrException("Problem creating OBO iterator for: "+ontologyName+" URL: "+oboUrl, e);
  }
  indexOntology(oboIterator, documentFilter);
}
uk.ac.ebi.intact.dataexchange.psimi.solr.ontologyOntologyIndexer

Javadoc

Indexes in a SOLR instance the ontologies passed as URL. The created index is useful to do fast queries to find elements, parents and children in the indexed ontologies.

Most used methods

  • <init>
  • indexObo
  • indexOntology
  • addField
  • commitSolr
  • createSolrInputDocument
  • index
  • indexUniprotTaxonomy

Popular in Java

  • Reading from database using SQL prepared statement
  • setContentView (Activity)
  • compareTo (BigDecimal)
  • scheduleAtFixedRate (Timer)
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now