Package ivory.core.exception

Examples of ivory.core.exception.ConfigurationException


    Document d = null;

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

    Map<String, String> queries = Maps.newLinkedHashMap();
    NodeList queryNodes = d.getElementsByTagName("query");

    LOG.info("Parsing "+queryNodes.getLength()+" nodes...");
    for (int i = 0; i < queryNodes.getLength(); i++) {
      // Get query XML node.
      Node node = queryNodes.item(i);

      // Get query id.
      String qid = XMLTools.getAttributeValueOrThrowException(node, "id",
      "Must specify a query id attribute for every query!");

      // 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


                        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());
                        }
               
                        parseModels(d);                       
                        parseIndexLocation(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

      }
      internalOutputFiles[i] = internalOutputFile;


      if (modelID == null) {
        throw new ConfigurationException("Must specify a model id for every model!");
      }

      // Parse parent nodes.
      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(modelID)) {
            throw new ConfigurationException("Only one expander allowed per model!");
          }
          expanders.put(modelID, child);
        }
      }
View Full Code Here

    Document d = null;
    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());
    }

    conf.set(Constants.QueriesPath, cmdline.getOptionValue(Constants.QueriesPath));

    NodeList list = d.getElementsByTagName(Constants.QueryType);
View Full Code Here

      }

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

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

    try {
      termidMap = new DefaultFrequencySortedDictionary(new Path(getIndexTermsData()),
          new Path(getIndexTermIdsData()), new Path(getIndexTermIdMappingData()), fs);
    } catch (Exception e) {
      throw new ConfigurationException("Error initializing dictionary!");
    }

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

    Parameter parameter = new Parameter(Parameter.DEFAULT, 1.0f);

    // Get potential type.
    String potentialType = XMLTools.getAttributeValue(domNode, "potential", null);
    if (potentialType == null) {
      throw new ConfigurationException("A potential attribute must be specified in order to generate a clique set!");
    }

    // If there is more than one term, then add appropriate cliques.
    List<GraphNode> cliqueNodes = null;
    Clique c = null;
View Full Code Here

    Parameter parameter = new Parameter(Parameter.DEFAULT, 1.0f);

    // Get potential type.
    String potentialType = XMLTools.getAttributeValue(domNode, "potential", null);
    if (potentialType == null) {
      throw new ConfigurationException("A potential attribute must be specified in order to generate a clique set!");
    }
    // If there is more than one term, then add appropriate cliques.
    ArrayList<GraphNode> cliqueNodes = null;
    Clique c = null;
View Full Code Here

    Parameter termParameter = new Parameter(Parameter.DEFAULT, 1.0f);

    // Get potential type.
    String potentialType = XMLTools.getAttributeValue(domNode, "potential", null);
    if (potentialType == null) {
      throw new ConfigurationException("A potential attribute must be specified in order to generate a CliqueSet!");
    }

    // Add clique for each query term.
    for (String element : queryTerms) {
      // Add term node.
View Full Code Here

    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

      f.configure(functionNode);

      return f;
    } catch (Exception e) {
      e.printStackTrace();
      throw new ConfigurationException(
          "Unable to instantiate scoring function \"" + functionType + "\"!", e);
    }
  }
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.