public void performAdd ( String baseURI , Resource subject , URI predicate , Value object , Transaction tx , Resource ... contexts ) throws MarkLogicSesameException { StringBuilder sb = new StringBuilder ( ) ; if ( notNull ( contexts ) && contexts . length > 0 ) { if ( notNull ( baseURI ) ) sb . append ( "BASE <" + baseURI + ">\n" ) ; sb . append ( "INSERT DATA { " ) ; for ( int i = 0 ; i < contexts . length ; i ++ ) { if ( notNull ( contexts [ i ] ) ) { sb . append ( "GRAPH <" + contexts [ i ] . stringValue ( ) + "> { ?s ?p ?o .} " ) ; } else { sb . append ( "GRAPH <" + DEFAULT_GRAPH_URI + "> { ?s ?p ?o .} " ) ; } } sb . append ( "}" ) ; } else { sb . append ( "INSERT DATA { GRAPH <" + DEFAULT_GRAPH_URI + "> {?s ?p ?o .}}" ) ; } SPARQLQueryDefinition qdef = sparqlManager . newQueryDefinition ( sb . toString ( ) ) ; if ( notNull ( ruleset ) ) { qdef . setRulesets ( ruleset ) ; } if ( notNull ( graphPerms ) ) { qdef . setUpdatePermissions ( graphPerms ) ; } if ( notNull ( baseURI ) && ! baseURI . isEmpty ( ) ) { qdef . setBaseUri ( baseURI ) ; } if ( notNull ( subject ) ) qdef . withBinding ( "s" , subject . stringValue ( ) ) ; if ( notNull ( predicate ) ) qdef . withBinding ( "p" , predicate . stringValue ( ) ) ; if ( notNull ( object ) ) bindObject ( qdef , "o" , object ) ; sparqlManager . executeUpdate ( qdef , tx ) ; }
executes INSERT of single triple