15.156 SEM_APIS.UPDATE_MODEL

Format

SEM_APIS.UPDATE_MODEL(
     apply_model         IN VARCHAR2, 
     update_stmt         IN CLOB, 
     match_models        IN RDF_MODELS DEFAULT NULL, 
     match_rulebases     IN RDF_RULEBASES DEFAULT NULL, 
     match_index_status  IN VARCHAR2 DEFAULT NULL, 
     match_options       IN VARCHAR2 DEFAULT NULL, 
     options             IN VARCHAR2 DEFAULT NULL,
     network_owner       IN VARCHAR2 DEFAULT NULL,
     network_name        IN VARCHAR2 DEFAULT NULL);

Note:

This subprogram will be deprecated in a future release. It is recommended that you use the SEM_APIS.UPDATE_RDF_GRAPH subprogram instead.

Description

Executes a SPARQL Update statement on a semantic model.

Parameters

apply_model

Name of the RDF model to be updated. This is the name specified when the model was created using the SEM_APIS.CREATE_SEM_MODEL procedure.

It cannot be a virtual model (see RDF Graph Collections) or an RDF view).

update_stmt

One or more SPARQL Update commands to be executed on the apply_model model. Use the semicolon (;) to separate commands.

match_models

A list of models that forms the SPARQL data set to query for graph pattern matching during a SPARQL Update operation (INSERT WHERE, DELETE WHERE, COPY, MOVE, ADD). Can include virtual models and/or RDF views If this parameter is not specified, the apply_model model is used.

match_rulebases

A list of rulebases to use with match_models to provide an entailment that generates additional triples or quads to use for graph pattern matching during a SPARQL Update operation.

match_index_status

The desired status for any entailments used for graph pattern matching during a SPARQL Update operation.

match_options

String specifying hints to influence graph pattern matching during a SPARQL Update operation. The set of hints that can be used here is identical to those that can be used in the options parameter of SEM_MATCH.

options

String specifying hints that affect SPARQL operations. See the Usage Notes for a list of available options.

network_owner

Owner of the semantic network. (See Table 1-2.)

network_name

Name of the semantic network. (See Table 1-2.)

Usage Notes

Before using this procedure, be sure you understand the material in Support for SPARQL Update Operations on an RDF Graph.

The options parameter can specify one or more of the following options:

  • APP_TAB_IDX={INDEX_NAME} uses an INDEX optimizer hint for INDEX_NAME when doing DML operations on the application table.

  • APPEND uses the SQL APPEND hint with DML operations.

  • AUTOCOMMIT=F avoids starting and committing a transaction for each SEM_APIS.UPDATE_MODEL call. Instead, this option gives transaction control to the caller. Each SEM_APIS.UPDATE_MODEL call will execute as part of a main transaction that is started, committed, or rolled back by the caller.

  • BULK_OPTIONS={OPTIONS_STRING} uses OPTIONS_STRING as the flags parameter when calling SEM_APIS.BULK_LOAD_FROM_STAGING_TABLE.

  • CLOB_UPDATE_SUPPORT=T turns on CLOB functionality.

  • DEL_AS_INS=T performs a large delete operation by inserting all data that should remain after the delete operation instead of doing deletions. This option may significantly improve the performance of large delete operations.

  • DYNAMIC_SAMPLING(n) uses DYNAMIC_SAMPLING(n) SQL optimizer hint with query operations.

  • FORCE_BULK=T uses the SEM_APIS.BULK_LOAD_FROM_STAGING_TABLE procedure for bulk insertion of triples. This option may provide better performance on large updates.

  • LOAD_CLOB_ONLY=T loads only triples/quads with object values longer than 4000 bytes in length when executing LOAD operations on N-Triple or N-Quad documents.

  • LOAD_OPTIONS={ OPTIONS_STRING } uses OPTIONS_STRING as the extra file names when performing a LOAD operation.

  • MM_OPTIONS={ OPTIONS_STRING } uses OPTIONS_STRING as the options parameter for operations calling SEM_APIS.MERGE_MODELS.

  • PARALLEL(n) uses the SQL PARALLEL(n) hint for query and DML operations.

  • RESUME_LOAD=T allows resuming an interrupted LOAD operation.

  • SERIALIZABLE=T uses the SERIALIZABLE transaction isolation level for SEM_APIS.UPDATE_MODEL operations. READ COMMITTED is the default transaction isolation level.

  • STREAMING=F materializes intermediate data and uses INSERT AS SELECT operations instead of streaming through JDBC Result Sets. This mode may provide better performance on large updates or updates with complex patterns in the WHERE clause.

  • STRICT_BNODE=F enables ID-only operations for ADD, COPY, and MOVE. (ID-only operations are explained in Blank Nodes: Special Considerations for SPARQL Update.)

You can override some options settings at the session level by using the MDSYS.SDO_SEM_UPDATE_CTX.SET_PARAM procedure, as explained in Setting UPDATE_RDF_GRAPH Options at the Session Level.

For information about semantic network types and options, see RDF Networks.

Examples

The following example inserts six triples into a semantic model.

BEGIN
  sem_apis.update_model('electronics',
   'PREFIX : <http://www.example.org/electronics/> 
    INSERT DATA {
       :camera1 :name "Camera 1" .
       :camera1 :price 120 .
       :camera1 :cameraType :Camera .
       :camera2 :name "Camera 2" .
       :camera2 :price 150 .
       :camera2 :cameraType :Camera .
      } ');
END;
/