Package org.ontoware.rdf2go.model

Examples of org.ontoware.rdf2go.model.Model.open()


   * @param language language which should be kept
   * @return a Model that contains only literals in the desired language
   */
  public static Model selectLanguage(Model model, String language) {
    Model result = RDF2Go.getModelFactory().createModel();
    result.open();
    ClosableIterator<Statement> it = model.iterator();
    while(it.hasNext()) {
      Statement s = it.next();
      if(s.getObject() instanceof LanguageTagLiteral) {
        LanguageTagLiteral lit = s.getObject().asLanguageTagLiteral();
View Full Code Here


 
 
  public static void searchAndReplace( Model model, Map<String, URI> namespaceMap, String search, String remove, String add ) {
    log.trace("rule remove... ");
    Model removeModel = RDF2Go.getModelFactory().createModel();
    removeModel.open();
    ClosableIterator<Statement> it = model.sparqlConstruct(
        Transformer.toSparqlConstruct(namespaceMap, remove, search))
        .iterator();
    while (it.hasNext()) {
      Statement stmt = it.next();
View Full Code Here

    }
    it.close();

    log.trace("rule remove... ");
    Model addModel = RDF2Go.getModelFactory().createModel();
    addModel.open();
    it = model.sparqlConstruct(
        Transformer.toSparqlConstruct(namespaceMap, add, search))
        .iterator();
    while (it.hasNext()) {
      Statement stmt = it.next();
View Full Code Here

  @Override
    public void applyRule(Model model, Map<String, URI> namespaceMap) {

    Model removeModel = RDF2Go.getModelFactory().createModel();
    removeModel.open();

    Model addModel = RDF2Go.getModelFactory().createModel();
    addModel.open();

    String query = Transformer.toSparqlConstruct(namespaceMap, this.add, this.search);
View Full Code Here

    Model removeModel = RDF2Go.getModelFactory().createModel();
    removeModel.open();

    Model addModel = RDF2Go.getModelFactory().createModel();
    addModel.open();

    String query = Transformer.toSparqlConstruct(namespaceMap, this.add, this.search);

    ClosableIterator<Statement> it = model.sparqlConstruct(query)
        .iterator();
View Full Code Here

   * @throws ModelRuntimeException ...
   * @throws IOException ...
   */
  public static Model loadFoaf(ModelFactory factory) throws IOException, ModelRuntimeException {
    Model result = factory.createModel();
    result.open();
    InputStream in = getFoafAsStream();
    try {
      result.readFrom(in);
    } finally {
      in.close();
View Full Code Here

   * @throws ModelRuntimeException ...
   * @throws IOException ...
   */
  public static Model loadICAL(ModelFactory factory) throws IOException, ModelRuntimeException {
    Model result = factory.createModel();
    result.open();
    InputStream in = getICALAsStream();
    try {
      result.readFrom(in);
    } finally {
      in.close();
View Full Code Here

    public void test() {
        RepositoryModelFactory rmf = new RepositoryModelFactory();
        RDF2Go.register(rmf);
        ModelFactory modelFactory = RDF2Go.getModelFactory();
        Model model = modelFactory.createModel();
        model.open();
        assertTrue(model.isOpen());
    }
   
}
View Full Code Here

  private void getNonEmptyStmtIterator() {
    // make sure we have a statement iterator
    if (this.stmtit == null) {
      Model m = this.modelit.next();
      m.open();
      this.stmtit = m.findStatements(this.pattern);
    }
    // make sure we have a statement iterator, which contains statements
    while (this.modelit.hasNext() && !this.stmtit.hasNext()) {
      this.stmtit.close();
View Full Code Here

    }
    // make sure we have a statement iterator, which contains statements
    while (this.modelit.hasNext() && !this.stmtit.hasNext()) {
      this.stmtit.close();
      Model m = this.modelit.next();
      m.open();
      this.stmtit = m.findStatements(this.pattern);
    }
  }

  @Override
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.