Package de.fuberlin.wiwiss.d2rq

Examples of de.fuberlin.wiwiss.d2rq.D2RQException


        Resource type = typeIt.nextStatement().getResource();
        if (!classes.contains(type)) continue;
        if (matchingType == null) {
          matchingType = type;
        } else {
          throw new D2RQException("Name " + PrettyPrinter.toString(resource) + " cannot be both a "
              + PrettyPrinter.toString(matchingType) + " and a " + PrettyPrinter.toString(type),
              errorCode);
        }
      }
    }
View Full Code Here


    if (s != null) {
      String value = s.getLiteral().getLexicalForm();
      try {
        this.port = Integer.parseInt(value);
      } catch (NumberFormatException ex) {
        throw new D2RQException("Illegal integer value '" + value
            + "' for d2r:port", D2RQException.MUST_BE_NUMERIC);
      }
    }
    s = server.getProperty(RDFS.label);
    if (s != null) {
      this.serverName = s.getString();
    }
    s = server.getProperty(D2RConfig.documentMetadata);
    if (s != null) {
      this.documentMetadata = s.getResource();
    }
    s = server.getProperty(D2RConfig.vocabularyIncludeInstances);
    if (s != null) {
      this.vocabularyIncludeInstances = s.getBoolean();
    }
    s = server.getProperty(D2RConfig.autoReloadMapping);
    if (s != null) {
      this.autoReloadMapping = s.getBoolean();
    }
    s = server.getProperty(D2RConfig.limitPerClassMap);
    if (s != null) {
      try {
        limitPerClassMap = s.getInt();
      } catch (JenaException ex) {
        if (!s.getBoolean()) {
          limitPerClassMap = Relation.NO_LIMIT;
        }
      }
    }
    s = server.getProperty(D2RConfig.limitPerPropertyBridge);
    if (s != null) {
      try {
        limitPerPropertyBridge = s.getInt();
      } catch (JenaException ex) {
        if (!s.getBoolean()) {
          limitPerPropertyBridge = Relation.NO_LIMIT;
        }
      }
    }
    s = server.getProperty(D2RConfig.enableMetadata);
    if (s != null) {
      this.enableMetadata = s.getBoolean();
    }
    s = server.getProperty(D2RConfig.pageTimeout);
    if (s != null) {
      try {
        String value = s.getLiteral().getLexicalForm();
        pageTimeout = Double.parseDouble(value);
      } catch (Exception ex) {
        throw new D2RQException("Value for d2r:pageTimeout must be a numeric literal: '" +
            s.getObject() + "'", D2RQException.MUST_BE_NUMERIC);
      }
    }
    s = server.getProperty(D2RConfig.sparqlTimeout);
    if (s != null) {
      try {
        String value = s.getLiteral().getLexicalForm();
        sparqlTimeout = Double.parseDouble(value);
      } catch (Exception ex) {
        throw new D2RQException("Value for d2r:sparqlTimeout must be a numeric literal: '" +
            s.getObject() + "'", D2RQException.MUST_BE_NUMERIC);
      }
    }
  }
View Full Code Here

        configuration.setUseAllOptimizations(stmts.nextStatement().getBoolean());
      }     
      this.mapping.setConfiguration(configuration);

      if (it.hasNext())
        throw new D2RQException("Only one configuration block is allowed");
    }
  }
View Full Code Here

    while (stmts.hasNext()) {
      try {
        int limit = Integer.parseInt(stmts.nextStatement().getString());
        database.setResultSizeLimit(limit);
      } catch (NumberFormatException ex) {
        throw new D2RQException("Value of d2rq:resultSizeLimit must be numeric", D2RQException.MUST_BE_NUMERIC);
      }
    }
    stmts = r.listProperties(D2RQ.textColumn);
    while (stmts.hasNext()) {
      database.addTextColumn(stmts.nextStatement().getString());
    }
    stmts = r.listProperties(D2RQ.numericColumn);
    while (stmts.hasNext()) {
      database.addNumericColumn(stmts.nextStatement().getString());
    }
    stmts = r.listProperties(D2RQ.booleanColumn);
    while (stmts.hasNext()) {
      database.addBooleanColumn(stmts.nextStatement().getString());
    }
    stmts = r.listProperties(D2RQ.dateColumn);
    while (stmts.hasNext()) {
      database.addDateColumn(stmts.nextStatement().getString());
    }
    stmts = r.listProperties(D2RQ.timestampColumn);
    while (stmts.hasNext()) {
      database.addTimestampColumn(stmts.nextStatement().getString());
    }
    stmts = r.listProperties(D2RQ.timeColumn);
    while (stmts.hasNext()) {
      database.addTimeColumn(stmts.nextStatement().getString());
    }
    stmts = r.listProperties(D2RQ.binaryColumn);
    while (stmts.hasNext()) {
      database.addBinaryColumn(stmts.nextStatement().getString());
    }
    stmts = r.listProperties(D2RQ.bitColumn);
    while (stmts.hasNext()) {
      database.addBitColumn(stmts.nextStatement().getString());
    }
    stmts = r.listProperties(D2RQ.intervalColumn);
    while (stmts.hasNext()) {
      database.addIntervalColumn(stmts.nextStatement().getString());
    }
    stmts = r.listProperties(D2RQ.fetchSize);
    while (stmts.hasNext()) {
      try {
        int fetchSize = Integer.parseInt(stmts.nextStatement().getString());
        database.setFetchSize(fetchSize);
      } catch (NumberFormatException ex) {
        throw new D2RQException("Value of d2rq:fetchSize must be numeric", D2RQException.MUST_BE_NUMERIC);
      }
    }
    stmts = r.listProperties(D2RQ.startupSQLScript);
    while (stmts.hasNext()) {
      database.setStartupSQLScript(stmts.next().getResource());
View Full Code Here

    while (stmts.hasNext()) {
      String s = stmts.nextStatement().getString();
      try {
        resourceMap.setValueMaxLength(Integer.parseInt(s));
      } catch (NumberFormatException nfex) {
        throw new D2RQException("d2rq:valueMaxLength \"" + s + "\" on " +
            PrettyPrinter.toString(r) + " must be an integer number");
      }
    }
    stmts = r.listProperties(D2RQ.join);
    while (stmts.hasNext()) {
      resourceMap.addJoin(stmts.nextStatement().getString());
    }
    stmts = r.listProperties(D2RQ.condition);
    while (stmts.hasNext()) {
      resourceMap.addCondition(stmts.nextStatement().getString());
    }
    stmts = r.listProperties(D2RQ.alias);
    while (stmts.hasNext()) {
      resourceMap.addAlias(stmts.nextStatement().getString());
    }
    stmts = r.listProperties(D2RQ.containsDuplicates);
    while (stmts.hasNext()) {
      String containsDuplicates = stmts.nextStatement().getString();
      if ("true".equals(containsDuplicates)) {
        resourceMap.setContainsDuplicates(true);
      } else if ("false".equals(containsDuplicates)) {
        resourceMap.setContainsDuplicates(false);
      } else if (containsDuplicates != null) {
        throw new D2RQException("Illegal value '" + containsDuplicates +
            "' for d2rq:containsDuplicates on " + PrettyPrinter.toString(r),
            D2RQException.RESOURCEMAP_ILLEGAL_CONTAINSDUPLICATE);
      }
    }
    stmts = r.listProperties(D2RQ.translateWith);
View Full Code Here

    return vocabularyModel;
  }
 
  public void validate() throws D2RQException {
    if (this.databases.isEmpty()) {
      throw new D2RQException("No d2rq:Database defined in the mapping",
          D2RQException.MAPPING_NO_DATABASE);
    }
    for (Database db: databases.values()) {
      db.validate();
    }
    for (TranslationTable table: translationTables.values()) {
      table.validate();
    }
    Collection<ClassMap> classMapsWithoutProperties = new ArrayList<ClassMap>(classMaps.values());
    for (ClassMap classMap: classMaps.values()) {
      classMap.validate()// Also validates attached bridges
      if (classMap.hasProperties()) {
        classMapsWithoutProperties.remove(classMap);
      }
      for (PropertyBridge bridge: classMap.propertyBridges()) {
        if (bridge.refersToClassMap() != null) {
          classMapsWithoutProperties.remove(bridge.refersToClassMap());
        }
      }
    }
    if (!classMapsWithoutProperties.isEmpty()) {
      throw new D2RQException(classMapsWithoutProperties.iterator().next().toString() +
          " has no d2rq:PropertyBridges and no d2rq:class",
          D2RQException.CLASSMAP_NO_PROPERTYBRIDGES);
    }
    for (DownloadMap dlm: downloadMaps.values()) {
      dlm.validate();
View Full Code Here

    void validate() {
      for (Attribute attribute: relation.allKnownAttributes()) {
        DataType dataType = relation.database().columnType(
            relation.aliases().originalOf(attribute));
        if (dataType == null) {
          throw new D2RQException("Column " + relation.aliases().originalOf(attribute) +
              " has a datatype that is unknown to D2RQ; override it with d2rq:xxxColumn in the mapping file",
              D2RQException.DATATYPE_UNKNOWN);
        }
        if (dataType.isUnsupported()) {
          throw new D2RQException("Column " +
              relation.aliases().originalOf(attribute) +
              " has a datatype that D2RQ cannot express in RDF: " + dataType,
              D2RQException.DATATYPE_UNMAPPABLE);
        }
      }
View Full Code Here

    try {
      stmt.execute("ALTER SESSION SET NLS_DATE_FORMAT = 'SYYYY-MM-DD'");
      stmt.execute("ALTER SESSION SET NLS_TIMESTAMP_FORMAT = 'SYYYY-MM-DD HH24:MI:SS'");
      setSessionTimeZone(connection, getTimeZoneForSession().getID());
    } catch (Exception ex) {
      throw new D2RQException(ex);
    } finally {
      stmt.close();
    }
  }
View Full Code Here

        try {
          URI url = URI.create(startupSQLScript);
          SQLScriptLoader.loadURI(url, connection.connection());
        } catch (IOException ex) {
          connection.close();
          throw new D2RQException(ex);
        } catch (SQLException ex) {
          connection.close();
          throw new D2RQException(ex);
        }
      }
    }
    return connection;
  }
View Full Code Here

    return "d2rq:Database " + super.toString();
  }

  public void validate() throws D2RQException {
    if (this.jdbcDSN == null) {
      throw new D2RQException("d2rq:Database must have d2rq:jdbcDSN",
          D2RQException.DATABASE_MISSING_DSN);
    }
    if (this.jdbcDSN != null && this.jdbcDriver == null) {
      throw new D2RQException("Missing d2rq:jdbcDriver",
          D2RQException.DATABASE_MISSING_JDBCDRIVER);
    }
    // TODO
  }
View Full Code Here

TOP

Related Classes of de.fuberlin.wiwiss.d2rq.D2RQException

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.