15.49 SEM_APIS.CREATE_VIRTUAL_MODEL

Format

SEM_APIS.CREATE_VIRTUAL_MODEL(
     vm_name       IN VARCHAR2, 
     models        IN SEM_MODELS, 
     rulebases     IN SEM_RULEBASES DEFAULT NULL, 
     options       IN VARCHAR2 DEFAULT NULL, 
     entailments   IN SEM_ENTAILMENTS 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.CREATE_RDF_GRAPH_COLLECTION subprogram instead.

Description

Creates a virtual model containing the specified semantic models and/or entailments. Entailments can be specified in one of the following ways:

  • By specifying one or more models and one or more rulebases. In this case, a virtual model will be created using the single entailment that corresponds to the exact combination of models and rulebases specified. An error is raised if no such entailment exists.

  • By specifying zero or more models and one or more entailments. In this case, the contents of the models and entailments will be combined regardless of their relationship.

The first method ensures a sound and complete dataset, whereas the second method relaxes the sound and complete constraints for more flexibility.

Parameters

vm_name

Name of the virtual model to be created.

models

One or more semantic model names. Its data type is SEM_MODELS, which has the following definition: TABLE OF VARCHAR2(25). If this parameter is null, no models are included in the virtual model definition.

rulebases

One or more rulebase names. Its data type is SEM_RULEBASES, which has the following definition: TABLE OF VARCHAR2(25). If this parameter is null, no rulebases are included in the virtual model definition. Rules and rulebases are explained in Inferencing: Rules and Rulebases.

If you specify this parameter, you cannot also specify the entailments parameter.

options

Options for creation:

  • PXN=T forces a UNION ALL-based view definition for the virtual model. This is the default for virtual models with 16 or fewer components.

  • PXN=F forces an IN LIST-based view definition for the virtual model. This is the default for virtual models with more than 16 components.

  • PXN=F INMEMORY=T (in combination) let you to create an in-memory virtual model.

    If you specify INMEMORY=T but not PXN=F, then the in-memory virtual columns are created, but the performance will suffer. If you do not specify INMEMORY=T, the virtual model is not created in-memory. (See also Using In-Memory Virtual Columns with RDF.)

  • REPLACE=T lets you to replace a virtual model without dropping it. (Using this option is analogous to using CREATE OR REPLACE VIEW with a view.)

entailments

One or more entailment names. Its data type is SEM_ENTAILMENTS, which has the following definition: TABLE OF VARCHAR2(25). If this parameter is null, no entailments are included in the virtual model definition. Entailments are explained in Using OWL Inferencing.

If you specify this parameter, you cannot also specify the rulebases parameter.

network_owner

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

network_name

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

Usage Notes

For an explanation of virtual models, including usage information, see Virtual Models.

An entailment must exist for each specified combination of semantic model and rulebase.

To create a virtual model, you must either be (A) the owner of each specified model and any corresponding entailments, or (B) a user with DBA privileges.

To replace a virtual model, you must be the owner of the virtual model or a user with DBA privileges.

The option INMEMORY=T should be used only if you have the appropriate licenses.

This procedure creates views with names in the following format:

  • SEMV_vm_name, which corresponds to a UNION ALL of the triples in each model and entailment. This view may contain duplicates.

  • SEMU_vm_name, which corresponds to a UNION of the triples in each model and entailment. This view will not contain duplicates (thus, the U in SEMU indicates unique).

To use the example in Virtual Models of a virtual model vm1 created from models m1, m2, m3, and with an entailment created for m1, m2 ,and m3 using the OWLPrime rulebase, this procedure will create the following two views (assuming that m1, m2, and m3, and the OWLPRIME entailment have internal model_id values 1, 2, 3, 4):

CREATE VIEW RDFUSER.NET1#.SEMV_VM1 AS
  SELECT p_value_id, start_node_id, canon_end_node_id, end_node_id, g_id, model_id
  FROM RDFUSER.NET1#.rdf_link$ partition (MODEL_1)
UNION ALL
  SELECT p_value_id, start_node_id, canon_end_node_id, end_node_id, g_id, model_id
  FROM RDFUSER.NET1#.rdf_link$ partition (MODEL_2)
UNION ALL
  SELECT p_value_id, start_node_id, canon_end_node_id, end_node_id, g_id, model_id
  FROM RDFUSER.NET1#.rdf_link$ partition (MODEL_3)
UNION ALL
  SELECT p_value_id, start_node_id, canon_end_node_id, end_node_id, g_id, model_id
  FROM RDFUSER.NET1#.rdf_link$ partition (MODEL_4);

CREATE VIEW RDFUSER.NET1#.SEMU_VM1 AS
  SELECT p_value_id, start_node_id, canon_end_node_id, MIN(end_node_id) end_node_id, g_id, MIN(model_id) model_id 
  FROM RDFUSER.NET1#.rdf_link$ 
  WHERE model_id in (1, 2, 3, 4)
  GROUP BY p_value_id, start_node_id, canon_end_node_id, g_id;

The user that invokes this procedure will be the owner of the virtual model and will have SELECT WITH GRANT privileges on the SEMU_vm_name and SEMV_vm_name views. To query the corresponding virtual model, a user must have select privileges on these views.

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

Examples

The following example creates a virtual model named VM1.

EXECUTE sem_apis.create_virtual_model('VM1',
                                          sem_models('model_1', 'model_2'),
                                          sem_rulebases('OWLPRIME'),
                                          network_owner=>'RDFUSER',
                                          network_name=>'NET1');

The following example creates a virtual model named VM1 using the relaxed entailment specification.

EXECUTE sem_apis.create_virtual_model('VM1',
                                          models=>sem_models('model_1', 'model_2'),
                                          entailments=>sem_entailments('entailment1','entailment2'),
                                          network_owner=>'RDFUSER',
                                          network_name=>'NET1');

The following example effectively redefines virtual model VM1 by using the REPLACE=T option.

EXECUTE sem_apis.create_virtual_model('VM1',
                                          models=>sem_models('model_1', 'model_2'),
                                          entailments=>sem_entailments('entailment1'),
                                          options=>'REPLACE=T',
                                          network_owner=>'RDFUSER',
                                          network_name=>'NET1');