本文整理匯總了Java中org.openrdf.repository.RepositoryConnection.remove方法的典型用法代碼示例。如果您正苦於以下問題:Java RepositoryConnection.remove方法的具體用法?Java RepositoryConnection.remove怎麽用?Java RepositoryConnection.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.openrdf.repository.RepositoryConnection
的用法示例。
在下文中一共展示了RepositoryConnection.remove方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: remove
import org.openrdf.repository.RepositoryConnection; //導入方法依賴的package包/類
@Override
public void remove( DbInfo t ) throws Exception {
RepositoryConnection rc = store.getConnection();
Resource idToRemove = getId( t, rc );
if ( null != idToRemove ) {
try{
rc.begin();
rc.remove( idToRemove, null, null );
rc.commit();
}
catch( RepositoryException re ){
rc.rollback();
throw re;
}
}
}
示例2: update
import org.openrdf.repository.RepositoryConnection; //導入方法依賴的package包/類
@Override
public void update( DbInfo data ) throws Exception {
RepositoryConnection rc = store.getConnection();
Resource id = getId( data, rc );
if ( null != id ) {
try{
rc.begin();
rc.remove( id, null, null );
rc.add( getCreateStatements( id, data, rc.getValueFactory() ) );
rc.commit();
}
catch( RepositoryException re ){
rc.rollback();
throw re;
}
}
}
示例3: update
import org.openrdf.repository.RepositoryConnection; //導入方法依賴的package包/類
@Override
public void update( User user ) throws Exception {
RepositoryConnection rc = store.getConnection();
try {
Map<URI, DbAccess> accesses = getAccesses( user );
Resource id = getId( user, rc );
if ( null != id ) {
rc.begin();
rc.remove( id, null, null );
rc.add( getCreateStatements( id, user, rc.getValueFactory() ) );
addAccesses( id, accesses, rc );
rc.commit();
}
}
catch ( RepositoryException e ) {
log.error( e, e );
try {
rc.rollback();
}
catch ( Exception x ) {
log.warn( x, x );
}
}
}
示例4: save
import org.openrdf.repository.RepositoryConnection; //導入方法依賴的package包/類
private void save( Model model ) {
// get old model, which we'll remove
Model olds = getModel();
ModificationExecutor eme = new ModificationExecutorAdapter( true ) {
@Override
public void exec( RepositoryConnection conn ) throws RepositoryException {
conn.remove( olds );
conn.add( model );
}
};
try {
engine.execute( eme );
}
catch ( Exception e ) {
log.error( e, e );
}
}
示例5: setUp
import org.openrdf.repository.RepositoryConnection; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
eng = InMemorySesameEngine.open();
RepositoryConnection rc = eng.getRawConnection();
rc.begin();
rc.add( DATA, null, RDFFormat.NTRIPLES );
rc.add( new StatementImpl( RDFS.DOMAIN, RDFS.LABEL,
new LiteralImpl( "label" ) ) );
rc.remove( eng.getBaseUri(), MetadataConstants.DCT_MODIFIED, null );
rc.add( eng.getBaseUri(), MetadataConstants.DCT_MODIFIED,
rc.getValueFactory().createLiteral( new Date() ) );
rc.commit();
}
示例6: deleteStatements
import org.openrdf.repository.RepositoryConnection; //導入方法依賴的package包/類
public static void deleteStatements( IEngine engine, Collection<Statement> statements ) {
ProgressTask pt = new ProgressTask( "Deleting Statements from the Knowledge Base",
new Runnable() {
@Override
public void run() {
try {
ModificationExecutor mea = new ModificationExecutorAdapter() {
@Override
public void exec( RepositoryConnection conn ) throws RepositoryException {
conn.begin();
conn.remove( statements );
}
};
engine.execute( mea );
engine.commit();
}
catch ( RepositoryException re ) {
log.error( "RepositoryException trying to delete Statements: " + re, re );
}
}
} );
OperationsProgress.getInstance( PlayPane.UIPROGRESS ).add( pt );
}
示例7: remove
import org.openrdf.repository.RepositoryConnection; //導入方法依賴的package包/類
@Override
public void remove( User t ) throws Exception {
RepositoryConnection rc = store.getConnection();
try {
Resource idToRemove = getId( t, rc );
if ( null != idToRemove ) {
rc.remove( idToRemove, null, null );
}
}
catch ( RepositoryException e ) {
log.error( e, e );
}
}
示例8: addAccesses
import org.openrdf.repository.RepositoryConnection; //導入方法依賴的package包/類
private static void addAccesses( Resource userid, Map<URI, DbAccess> accesses,
RepositoryConnection rc ) throws RepositoryException {
for ( Map.Entry<URI, DbAccess> en : accesses.entrySet() ) {
URI dbid = en.getKey();
if ( DbAccess.NONE == en.getValue() ) {
rc.remove( userid, ACL_READ, dbid );
rc.remove( userid, ACL_WRITE, dbid );
}
else {
URI uri = ( DbAccess.READ == en.getValue() ? ACL_READ : ACL_WRITE );
rc.add( new StatementImpl( userid, uri, dbid ) );
}
}
}
示例9: updateLastModifiedDate
import org.openrdf.repository.RepositoryConnection; //導入方法依賴的package包/類
public static void updateLastModifiedDate( RepositoryConnection rc,
Resource baseuri ) {
// updates the base uri's last modified key
// 1) if we don't know it already, figure out what our base uri is
// 2) remove any last modified value
// 3) add the new last modified value
ValueFactory vf = rc.getValueFactory();
try {
if ( null == baseuri ) {
RepositoryResult<Statement> rr = rc.getStatements( null, RDF.TYPE,
SEMTOOL.Database, false );
List<Statement> stmts = Iterations.asList( rr );
for ( Statement s : stmts ) {
baseuri = s.getSubject();
}
}
if ( null == baseuri ) {
log.warn( "cannot update last modified date when no base uri is set" );
}
else {
rc.remove( baseuri, MetadataConstants.DCT_MODIFIED, null );
rc.add( new StatementImpl( baseuri, MetadataConstants.DCT_MODIFIED,
vf.createLiteral( QueryExecutorAdapter.getCal( new Date() ) ) ) );
}
}
catch ( RepositoryException e ) {
log.warn( "could not update last modified date", e );
}
}
示例10: setUpClass
import org.openrdf.repository.RepositoryConnection; //導入方法依賴的package包/類
@BeforeClass
public static void setUpClass() throws Exception {
engine = InMemorySesameEngine.open();
engine.setBuilders( datab, UriBuilder.getBuilder( "http://os-em.com/ontologies/semtool/" ) );
RepositoryConnection rc = engine.getRawConnection();
rc.begin();
rc.add( LOADFILE, null, RDFFormat.NTRIPLES );
for ( URI extra : new URI[]{ YIGO, YUGO2, YUGO3 } ) {
rc.add( new StatementImpl( extra, RDF.TYPE, CAR ) );
rc.add( new StatementImpl( extra, RDFS.LABEL,
new LiteralImpl( extra.getLocalName() ) ) );
}
//rc.add( new StatementImpl( REL2, RDF.TYPE, REL ) );
rc.add( new StatementImpl( REL2, RDFS.LABEL, new LiteralImpl( "Yuri Purchased a Yigo" ) ) );
rc.add( new StatementImpl( REL2, RDFS.SUBPROPERTYOF, PURCHASE ) );
rc.add( new StatementImpl( REL2, new URIImpl( "http://os-em.com/ontologies/semtool/Price" ),
new LiteralImpl( "8000 USD" ) ) );
rc.remove( REL1, null, null );
rc.add( new StatementImpl( REL1, RDFS.LABEL, new LiteralImpl( "Yuri Purchased Yugo" ) ) );
rc.add( new StatementImpl( REL1, RDFS.SUBPROPERTYOF, PURCHASE ) );
rc.add( new StatementImpl( REL1, new URIImpl( "http://os-em.com/ontologies/semtool/Price" ),
new LiteralImpl( "3000 USD" ) ) );
rc.commit();
if ( log.isTraceEnabled() ) {
File tmpdir = FileUtils.getTempDirectory();
try ( Writer w = new BufferedWriter( new FileWriter( new File( tmpdir,
"ecctest.ttl" ) ) ) ) {
engine.getRawConnection().export( new TurtleWriter( w ) );
}
}
}