Package ivory.core

Examples of ivory.core.ConfigurationException


      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


    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

    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> grammarPaths = 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!");

      String grammar = XMLTools.getAttributeValue(node, "grammar");

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

    // Initialize clique set.
    clearCliques();

    if (dependenceType.equals("sequential")) {
      throw new ConfigurationException(
          "Unsupported operation: there are no unordered cliques within a sequentially dependent graph.");
    } else if (dependenceType.equals("full")) {
      addCliques(CascadeCliqueFactory.getFullDependenceCliques(env, queryTerms, domNode, false,
          docDependent, cascadeStage, pruner_and_params));
    } else {
      throw new ConfigurationException("Unrecognized UnorderedCliqueSet type: " + dependenceType);
    }
  }
View Full Code Here

          docDependent, cascadeStage, pruner_and_params));
    } else if (dependenceType.equals("full")) {
      addCliques(CascadeCliqueFactory.getFullDependenceCliques(env, queryTerms, domNode, true,
          docDependent, cascadeStage, pruner_and_params));
    } else {
      throw new ConfigurationException("Unrecognized OrderedCliqueSet type \"" + dependenceType + "\"!");
    }
  }
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

        builder = MRFBuilder.get(env, child);
      }
    }

    if (builder == null) {
      throw new ConfigurationException(
          "ConstrainedMRFBuilder is missing required constrainedModel node!");
    }
  }
View Full Code Here

   * ConfigurationException with the specified message.
   */
  public static String getAttributeValueOrThrowException(Node node, String name, String errMsg)
      throws ConfigurationException {
    if (node == null || !node.hasAttributes()) {
      throw new ConfigurationException(errMsg);
    }

    NamedNodeMap attributes = node.getAttributes();
    if (attributes.getNamedItem(name) == null) {
      throw new ConfigurationException(errMsg);
    }

    return attributes.getNamedItem(name).getNodeValue();
  }
View Full Code Here

TOP

Related Classes of ivory.core.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.