org.openrdf.repository.RepositoryConnection.exportStatements()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(70)

本文整理了Java中org.openrdf.repository.RepositoryConnection.exportStatements方法的一些代码示例,展示了RepositoryConnection.exportStatements的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RepositoryConnection.exportStatements方法的具体详情如下:
包路径:org.openrdf.repository.RepositoryConnection
类名称:RepositoryConnection
方法名:exportStatements

RepositoryConnection.exportStatements介绍

暂无

代码示例

代码示例来源:origin: org.semweb4j/rdf2go.impl.sesame

public void writeTo(RDFWriter writer) throws ModelRuntimeException {
  assertModel();
  try {
    this.connection.exportStatements(null, null, null, false, writer, this.openRdfContext);
  } catch(RepositoryException e) {
    throw new ModelRuntimeException(e);
  } catch(RDFHandlerException e) {
    throw new ModelRuntimeException(e);
  }
}

代码示例来源:origin: org.semweb4j/rdf2go.impl.sesame20

public void writeTo(RDFWriter writer)
  throws ModelRuntimeException
{
  assertModel();
  try {
    connection.exportStatements(null, null, null, false, writer, openRdfContext);
  }
  catch (RepositoryException e) {
    throw new ModelRuntimeException(e);
  }
  catch (RDFHandlerException e) {
    throw new ModelRuntimeException(e);
  }
}

代码示例来源:origin: org.apache.marmotta/marmotta-core

try {
  if(context == null) {
    connection.exportStatements(resource,null,null,true,handler);
  } else {
    connection.exportStatements(resource,null,null,true,handler,context);

代码示例来源:origin: org.apache.marmotta/marmotta-core

@Override
  public void write(OutputStream output) throws IOException, WebApplicationException {
    // FIXME: This method is executed AFTER the @Transactional!
    RDFWriter writer = Rio.createWriter(serializer, output);
    try {
      RepositoryConnection connection = sesameService.getConnection();
      try {
        connection.begin();
        connection.exportStatements(subject, null, null, true, writer);
      } finally {
        connection.commit();
        connection.close();
      }
    } catch (RepositoryException e) {
      throw new WebApplicationException(e, Status.INTERNAL_SERVER_ERROR);
    } catch (RDFHandlerException e) {
      throw new IOException("error while writing RDF data to stream", e);
    }
  }
};

代码示例来源:origin: apache/marmotta

@Override
  public void write(OutputStream output) throws IOException, WebApplicationException {
    // FIXME: This method is executed AFTER the @Transactional!
    RDFWriter writer = Rio.createWriter(serializer, output);
    try {
      RepositoryConnection connection = sesameService.getConnection();
      try {
        connection.begin();
        connection.exportStatements(subject, null, null, true, writer);
      } finally {
        connection.commit();
        connection.close();
      }
    } catch (RepositoryException e) {
      throw new WebApplicationException(e, Status.INTERNAL_SERVER_ERROR);
    } catch (RDFHandlerException e) {
      throw new IOException("error while writing RDF data to stream", e);
    }
  }
};

代码示例来源:origin: org.apache.marmotta/marmotta-core

try {
  if(context == null) {
    connection.exportStatements(null,null,null,true,handler);
  } else {
    connection.exportStatements(null,null,null,true,handler,context);

代码示例来源:origin: org.openrdf.elmo/elmo-repository

@Override
protected synchronized void removeWithoutCommit(Resource subject,
    URI predicate, Value object, Resource... contexts)
    throws RepositoryException {
  RDFHandler handler = new RDFInserter(removed);
  try {
    getDelegate().exportStatements(subject, predicate, object, true,
        handler, contexts);
  } catch (RDFHandlerException e) {
    if (e.getCause() instanceof RepositoryException)
      throw (RepositoryException) e.getCause();
    throw new AssertionError(e);
  }
  added.remove(subject, predicate, object, contexts);
}

代码示例来源:origin: apache/marmotta

try {
  if(context == null) {
    connection.exportStatements(null,null,null,true,handler);
  } else {
    connection.exportStatements(null,null,null,true,handler,context);

代码示例来源:origin: apache/marmotta

try {
  if(context == null) {
    connection.exportStatements(resource,null,null,true,handler);
  } else {
    connection.exportStatements(resource,null,null,true,handler,context);

代码示例来源:origin: org.apache.marmotta/marmotta-core

try {
  if(context == null) {
    connection.exportStatements(resource,null,null,true,handler);
  } else {
    connection.exportStatements(resource,null,null,true,handler,context);

代码示例来源:origin: apache/marmotta

try {
  if(context == null) {
    connection.exportStatements(resource,null,null,true,handler);
  } else {
    connection.exportStatements(resource,null,null,true,handler,context);

代码示例来源:origin: apache/marmotta

try {
  if(context == null) {
    connection.exportStatements(null,null,null,true,handler);
  } else {
    connection.exportStatements(null,null,null,true,handler,context);

代码示例来源:origin: apache/marmotta

@Override
  public void write(OutputStream output) throws IOException, WebApplicationException {
    RDFWriter writer = Rio.createWriter(serializer, output);
    try {
      RepositoryConnection con = versioningService.getSnapshot(date);
      URI subject = con.getValueFactory().createURI(resource.stringValue());
      try {
        con.exportStatements(subject,null,null,true,writer);
      } catch (RepositoryException e) {
        throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR);
      } catch (RDFHandlerException e) {
        throw new IOException("error while writing RDF data to stream");
      } finally {
        con.commit();
        con.close();
      }
    } catch (RepositoryException e) {
      throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR);
    }
  }
};

代码示例来源:origin: org.apache.marmotta/marmotta-versioning-kiwi

@Override
  public void write(OutputStream output) throws IOException, WebApplicationException {
    RDFWriter writer = Rio.createWriter(serializer, output);
    try {
      RepositoryConnection con = versioningService.getSnapshot(date);
      URI subject = con.getValueFactory().createURI(resource.stringValue());
      try {
        con.exportStatements(subject,null,null,true,writer);
      } catch (RepositoryException e) {
        throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR);
      } catch (RDFHandlerException e) {
        throw new IOException("error while writing RDF data to stream");
      } finally {
        con.commit();
        con.close();
      }
    } catch (RepositoryException e) {
      throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR);
    }
  }
};

代码示例来源:origin: org.apache.marmotta/marmotta-core

try {
  if(context == null) {
    connection.exportStatements(null,null,null,true,handler);
  } else {
    connection.exportStatements(null,null,null,true,handler,context);

代码示例来源:origin: org.openrdf.sesame/sesame-http-webclient-spring

conn.exportStatements(settings.getSubject(), settings.getPredicate(), settings.getObject(),
    settings.isIncludeInferred(), writer, settings.getContexts());

代码示例来源:origin: org.openrdf.sesame/sesame-repository-compliance-base

public void testAddRemove()
  throws Exception
{
  URI FOAF_PERSON = vf.createURI("http://xmlns.com/foaf/0.1/Person");
  final Statement stmt = vf.createStatement(bob, name, nameBob);
  testCon.add(bob, RDF.TYPE, FOAF_PERSON);
  testCon.setAutoCommit(false);
  testCon.add(stmt);
  testCon.remove(stmt);
  testCon.commit();
  testCon.exportStatements(null, null, null, false, new RDFHandlerBase() {
    @Override
    public void handleStatement(Statement st)
      throws RDFHandlerException
    {
      assertTrue(!stmt.equals(st));
    }
  });
}

代码示例来源:origin: blazegraph/database

@Test
public void testAddRemove()
  throws Exception
{
  URI FOAF_PERSON = vf.createURI("http://xmlns.com/foaf/0.1/Person");
  final Statement stmt = vf.createStatement(bob, name, nameBob);
  testCon.add(bob, RDF.TYPE, FOAF_PERSON);
  testCon.begin();
  testCon.add(stmt);
  testCon.remove(stmt);
  testCon.commit();
  testCon.exportStatements(null, null, null, false, new RDFHandlerBase() {
    @Override
    public void handleStatement(Statement st)
      throws RDFHandlerException
    {
      assertThat(st, is(not(equalTo(stmt))));
    }
  });
}

代码示例来源:origin: org.openrdf.sesame/sesame-repository-contextaware

@Override
protected void removeWithoutCommit(Resource subject, IRI predicate, Value object, Resource... contexts)
  throws RepositoryException
{
  IRI[] archiveContexts = getArchiveContexts();
  if (archiveContexts.length > 0) {
    RDFHandler handler = new RDFInserter(getDelegate());
    try {
      getDelegate().exportStatements(subject, predicate, object, true, handler, archiveContexts);
    }
    catch (RDFHandlerException e) {
      if (e.getCause() instanceof RepositoryException) {
        throw (RepositoryException)e.getCause();
      }
      throw new AssertionError(e);
    }
  }
  if (isAllContext(contexts)) {
    getDelegate().remove(subject, predicate, object, getRemoveContexts());
  }
  else {
    getDelegate().remove(subject, predicate, object, contexts);
  }
}

代码示例来源:origin: blazegraph/database

@Test
public void testAddRemove()
  throws Exception
{
  URI FOAF_PERSON = vf.createURI("http://xmlns.com/foaf/0.1/Person");
  final Statement stmt = vf.createStatement(bob, name, nameBob);
  testCon.add(bob, RDF.TYPE, FOAF_PERSON);
  testCon.begin();
  testCon.add(stmt);
  testCon.remove(stmt);
  testCon.commit();
  testCon.exportStatements(null, null, null, false, new RDFHandlerBase() {
    @Override
    public void handleStatement(Statement st)
      throws RDFHandlerException
    {
      assertThat(st, is(not(equalTo(stmt))));
    }
  });
}

相关文章

微信公众号

最新文章

更多