Package ivory.core.exception

Examples of ivory.core.exception.ConfigurationException


    docNode = null;
    termNodes.clear();

    for (GraphNode node : nodes) {
      if (node.getType() == GraphNode.Type.DOCUMENT && docNode != null) {
        throw new ConfigurationException("Only one document node allowed in QueryPotential!");
      } else if (node.getType() == GraphNode.Type.DOCUMENT) {
        docNode = (DocumentNode) node;
      } else if (node.getType() == GraphNode.Type.TERM) {
        termNodes.add((TermNode) node);
      } else {
        throw new ConfigurationException(
            "Unrecognized node type in clique associated with QueryPotential!");
      }
    }

    String[] terms = new String[termNodes.size()];
View Full Code Here


    parseParameters(args);
    loadRetrievalEnv();
    try {
      docnoMapping = RetrievalEnvironment.loadDocnoMapping(indexPath, fs);
    } catch (IOException e) {
      throw new ConfigurationException("Failed to load Docnomapping: "
          + e.getMessage());
    }

    // Load static concept importance models
    for(Map.Entry<String, Node> n : importanceModels.entrySet()) {
      ConceptImportanceModel m = ConceptImportanceModel.get(n.getValue());
      env.addImportanceModel(n.getKey(), m);
    }

    // Load static docscores (e.g., spam score, PageRank, etc.).
    for (Map.Entry<String, Node> n : docscores.entrySet()) {
      String type = XMLTools.getAttributeValue(n.getValue(), "type", "");
      String provider = XMLTools.getAttributeValue(n.getValue(), "provider", "");
      String path = n.getValue().getTextContent();

      if (type.equals("") || provider.equals("") || path.equals("")) {
        throw new ConfigurationException("Invalid docscore!");
      }

      LOG.info("Loading docscore: type=" + type + ", provider=" + provider + ", path="
          + path);
      env.loadDocScore(type, provider, path);
View Full Code Here

  protected void loadRetrievalEnv() throws ConfigurationException{
    try {
      env = new RetrievalEnvironment(indexPath, fs);
      env.initialize(true);
    } catch (IOException e) {
      throw new ConfigurationException("Failed to instantiate RetrievalEnvironment: "
          + e.getMessage());
    }
  }
View Full Code Here

      try {
        d = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(
              fs.open(new Path(element)));
      } catch (SAXException e) {
        throw new ConfigurationException(e.getMessage());
      } catch (IOException e) {
        throw new ConfigurationException(e.getMessage());
      } catch (ParserConfigurationException e) {
        throw new ConfigurationException(e.getMessage());
      }

      parseQueries(d);
      parseImportanceModels(d);
      parseModels(d);
      parseStopwords(d);
      parseIndexLocation(d);
      parseDocscores(d);
      parseJudgments(d);
    }

    // Make sure we have some queries to run.
    if (queries.isEmpty()) {
      throw new ConfigurationException("Must specify at least one query!");
    }

    // Make sure there are models that need evaluated.
    if (models.isEmpty()) {
      throw new ConfigurationException("Must specify at least one model!");
    }

    // Make sure we have an index to run against.
    if (indexPath == null) {
      throw new ConfigurationException("Must specify an index!");
    }
  }
View Full Code Here

      // Get query text.
      String queryText = node.getTextContent();

      // Add query to internal map.
      if (queries.get(qid) != null) {
        throw new ConfigurationException("Duplicate query ids not allowed! Already parsed query with id=" + qid);
      }
      queries.put(qid, queryText);
    }
  }
View Full Code Here

      String id = XMLTools.getAttributeValueOrThrowException(node, "id",
        "Must specify an id for every importancemodel!");

      // Add model to internal map.
      if (importanceModels.get(id) != null) {
        throw new ConfigurationException(
            "Duplicate importancemodel ids not allowed! Already parsed model with id="
                + id);
      }
      importanceModels.put(id, node);     
    }
View Full Code Here

      NodeList children = node.getChildNodes();
      for (int j = 0; j < children.getLength(); j++) {
        Node child = children.item(j);
        if ("expander".equals(child.getNodeName())) {
          if (expanders.containsKey(id)) {
            throw new ConfigurationException("Only one expander allowed per model!");
          }
          expanders.put(id, child);
        }
      }

      // Add model to internal map.
      if (models.get(id) != null) {
        throw new ConfigurationException(
            "Duplicate model ids not allowed! Already parsed model with id=" + id);
      }
      models.put(id, node);
    }
  }
View Full Code Here

      String docscoreType = XMLTools.getAttributeValueOrThrowException(node, "type",
          "Must specify a type for every docscore!");

      // Add model to internal map.
      if (docscores.get(docscoreType) != null) {
        throw new ConfigurationException(
            "Duplicate docscore types not allowed! Already parsed model with id="
                + docscoreType);
      }
      docscores.put(docscoreType, node);
    }
View Full Code Here

      }

      LOG.info("Tokenizer: " + tokenizerClassName);
      tokenizer = (Tokenizer) Class.forName(tokenizerClassName).newInstance();
    } catch (Exception e) {
      throw new ConfigurationException("Error initializing tokenizer!", e);
    }

    LOG.info("Loading postings index...");
    postingsIndex = new IntPostingsForwardIndex(indexPath, fs);
    LOG.info(" - Number of terms: " + readCollectionTermCount());
    LOG.info("Done!");

    try {
      termidMap = new DefaultCachedFrequencySortedDictionary(new Path(getIndexTermsData()), new Path(getIndexTermIdsData()),
          new Path(getIndexTermIdMappingData()), 0.2f,  fs);
    } catch (Exception e) {
      throw new ConfigurationException("Error initializing term to term id mapping!", e);
    }

    try {
      docvectorsIndex = new IntDocVectorsForwardIndex(indexPath, fs);
    } catch (Exception e) {
View Full Code Here

    docNode = null;

    for (GraphNode node : nodes) {
      if (node.getType().equals(GraphNode.Type.DOCUMENT) && docNode != null) {
        throw new ConfigurationException("Only one document node allowed in DocumentPotential!");
      } else if (node.getType().equals(GraphNode.Type.DOCUMENT)) {
        docNode = (DocumentNode) node;
      } else if (node.getType().equals(GraphNode.Type.TERM)) {
        throw new ConfigurationException("TermNodes are not allowed in DocumentPotential!");
      }
    }
  }
View Full Code Here

TOP

Related Classes of ivory.core.exception.ConfigurationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.