Codota Logo
OntologyIndexer
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
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

  • Start an intent from android
  • addToBackStack (FragmentTransaction)
  • findViewById (Activity)
  • putExtra (Intent)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • TreeSet (java.util)
    A NavigableSet implementation based on a TreeMap. The elements are ordered using their Comparable, o
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • JButton (javax.swing)
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now