Package org.ontoware.rdf2go.exception

Examples of org.ontoware.rdf2go.exception.ModelRuntimeException


   
    if(backend.equalsIgnoreCase(MEMORY)) {
      dataset = DatasetFactory.createMem();
      assert dataset != null;
    } else if(backend.equalsIgnoreCase(DATABASE)) {
      throw new ModelRuntimeException(
              "This release of RDF2Go no longer supports Jena database backends. Use RDF2Go-Jena 2.6 or wait until we support SDB or TDB.");
    } else if(backend.equalsIgnoreCase(FILE)) {
      String filename = p.getProperty(FILENAME);
      if(filename == null) {
        throw new RuntimeException("Please specify a filename in your property file!");
      }
      throw new ModelRuntimeException(
              "This release of RDF2Go does not support ModelSets backed by files.");
    } else {
      throw new IllegalArgumentException("Illegal back-end type: " + backend);
    }
   
    switch(reasoning) {
    case rdfsAndOwl:
    case owl:
      throw new ModelRuntimeException(
              "This release of RDF2Go does not support ModelSets with reasoning capability.");
    case rdfs:
      throw new ModelRuntimeException(
              "This release of RDF2Go does not support ModelSets with reasoning capability.");
    default:
      return new ModelSetImplJena(dataset);
    }
  }
View Full Code Here


  @Override
    public Resource getSubject() {
    try {
      return (Resource)TypeConversion.toRDF2Go(this.s);
    } catch(ModelRuntimeException e) {
      throw new ModelRuntimeException(e);
    }
  }
View Full Code Here

  @Override
    public URI getPredicate() {
    try {
      return (URI)TypeConversion.toRDF2Go(this.p);
    } catch(ModelRuntimeException e) {
      throw new ModelRuntimeException(e);
    }
  }
View Full Code Here

  @Override
    public org.ontoware.rdf2go.model.node.Node getObject() {
    try {
      return TypeConversion.toRDF2Go(this.o);
    } catch(ModelRuntimeException e) {
      throw new ModelRuntimeException(e);
    }
  }
View Full Code Here

      assert node != null : "null node for varname " + v
              + ". Do you have unbound variables in the query?";
      try {
        row.put(v, TypeConversion.toRDF2Go((node == null ? null : node.asNode())));
      } catch(ModelRuntimeException e) {
        throw new ModelRuntimeException(e);
      }
    }
    return row;
  }
View Full Code Here

  }
 
  @Override
  public void addAll(Iterator<? extends Statement> iterator) throws ModelRuntimeException {
    if(this.isLocked()) {
      throw new ModelRuntimeException("Model is locked, cannot perform an update.");
    }
    // do not auto-commit
    this.assertModel();
    try {
     
      this.connection.begin();
      try {
        try {
          // add
          while(iterator.hasNext()) {
            Statement s = iterator.next();
            org.openrdf.model.URI context = ConversionUtil.toOpenRDF(s.getContext(),
                    this.valueFactory);
            org.openrdf.model.Statement sd = ConversionUtil.toOpenRDF(s,
                    this.valueFactory);
            this.connection.add(sd, context);
          }
          this.connection.commit();
        } catch(RepositoryException x) {
          this.connection.rollback();
        }
      } finally {
        this.connection.commit();
      }
    } catch(RepositoryException x) {
      throw new ModelRuntimeException(x);
    }
  }
View Full Code Here

                  context);
         
          // doesn't hurt to explicitly add them to the same context
          this.connection.add(statements, context);
        } catch(RepositoryException e) {
          throw new ModelRuntimeException(e);
        } finally {
          if(statements != null) {
            try {
              statements.close();
            } catch(RepositoryException e) {
              throw new ModelRuntimeException(e);
            }
          }
        }
      }
    } else {
View Full Code Here

          for(org.openrdf.model.Statement stmt : stmts) {
            this.valueFactory.createStatement(stmt.getSubject(), stmt.getPredicate(),
                    stmt.getObject(), openrdfContextURI);
          }
        } catch(RepositoryException e) {
          throw new ModelRuntimeException(e);
        }
      } else {
        // copy statements directly from Repository to Repository,
        // without using RDF2Go-specific wrappers
        org.openrdf.model.URI context = repositoryModel.getOpenRDFContextURI();
       
        RepositoryResult<org.openrdf.model.Statement> statements = null;
        try {
          statements = repositoryModel.connection.getStatements(null, null, null, false,
                  context);
         
          // doesn't hurt to explicitly add them to the right context
          while (statements.hasNext()) {
            org.openrdf.model.Statement stmt = statements.next();
            this.connection.add(
                    this.valueFactory.createStatement(stmt.getSubject(),
                            stmt.getPredicate(), stmt.getObject(), openrdfContextURI),
                    openrdfContextURI);
          }
        } catch(RepositoryException e) {
          throw new ModelRuntimeException(e);
        } finally {
          if(statements != null) {
            try {
              statements.close();
            } catch(RepositoryException e) {
              throw new ModelRuntimeException(e);
            }
          }
        }
      }
    } else {
View Full Code Here

          statements = repositoryModel.connection.getStatements(null, null, null, false,
                  new Resource[0]);
         
          this.connection.add(statements);
        } catch(RepositoryException e) {
          throw new ModelRuntimeException(e);
        } finally {
          if(statements != null) {
            try {
              statements.close();
            } catch(RepositoryException e) {
              throw new ModelRuntimeException(e);
            }
          }
        }
      }
    } else {
View Full Code Here

    this.assertModel();
    try {
      org.openrdf.model.Statement s = ConversionUtil.toOpenRDF(statement, this.valueFactory);
      this.connection.add(s, s.getContext());
    } catch(RepositoryException e) {
      throw new ModelRuntimeException(e);
    }
  }
View Full Code Here

TOP

Related Classes of org.ontoware.rdf2go.exception.ModelRuntimeException

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.