15.39 SEM_APIS.CREATE_RDF_GRAPH_COLLECTION

Format

SEM_APIS.CREATE_RDF_GRAPH_COLLECTION(
     rdf_graph_collection_name   IN VARCHAR2, 
     rdf_graphs                  IN SEM_MODELS, 
     rulebases                   IN SEM_RULEBASES DEFAULT NULL, 
     options                     IN VARCHAR2 DEFAULT NULL, 
     inferred_graphs             IN SEM_ENTAILMENTS DEFAULT NULL,
     network_owner               IN VARCHAR2 DEFAULT NULL,
     network_name                IN VARCHAR2 DEFAULT NULL);

Description

Creates an RDF graph collection containing the specified RDF graphs and/or inferred graphs. Inferred graphs can be specified in one of the following ways:

  • By specifying one or more RDF graphs and one or more rulebases. In this case, an RDF graph collection will be created using the single entailment that corresponds to the exact combination of graphs and rulebases specified. An error is raised if no such entailment exists.

  • By specifying zero or more graphs and one or more entailments. In this case, the contents of the graphs 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

rdf_graph_collection_name

Name of the RDF graph collection to be created.

rdf_graphs

One or more RDF graph names. Its data type is SEM_MODELS, which has the following definition: TABLE OF VARCHAR2(25). If this parameter is null, no graphs are included in the RDF graph collection.

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 RDF graph collection. Rules and rulebases are explained in Inferencing: Rules and Rulebases.

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

options

Options for creation:

  • PXN=T forces a UNION ALL-based view definition for the RDF graph collection. This is the default for RDF graph collections with 16 or fewer components.

  • PXN=F forces an IN LIST-based view definition for the RDF graph collection. This is the default for RDF graph collections with more than 16 components.

  • PXN=F INMEMORY=T (in combination) let you to create an in-memory RDF graph collection.

    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 RDF graph collection is not created in-memory. (See also Using In-Memory Virtual Columns with RDF.)

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

inferred_graphs

One or more inferred graph names. Its data type is SEM_ENTAILMENTS, which has the following definition: TABLE OF VARCHAR2(25). If this parameter is null, no inferred graphs are included in the RDF graph collection. Inferred graphs are explained in Using OWL Inferencing.

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

network_owner

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

network_name

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

Usage Notes

For an explanation of RDF graph collections, including usage information, see RDF Graph Collections.

An inferred graph must exist for each specified combination of RDF graph and rulebase.

To create an RDF graph collection, you must either be (A) the owner of each specified graph and any corresponding inferred graphs, or (B) a user with DBA privileges.

To replace an RDF graph collection, you must be the owner of the graph 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 graph and inferred graph. This view may contain duplicates.

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

To use the example in RDF Graph Collections of an RDF graph collection vm1 created from graphs 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 RDF graph collection and will have SELECT WITH GRANT privileges on the SEMU_vm_name and SEMV_vm_name views. To query the corresponding RDF graph collection, a user must have select privileges on these views.

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

Examples

The following example creates an RDF graph collection named VM1.

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

The following example creates an RDF graph collection named VM1 using the relaxed entailment specification.

EXECUTE sem_apis.create_rdf_graph_collection('VM1',
                                          rdf_graphs=>sem_models('model_1', 'model_2'),
                                          inferred_graphs=>sem_entailments('entailment1','entailment2'),
                                          network_owner=>'RDFUSER',
                                          network_name=>'NET1');

The following example effectively redefines RDF graph collection VM1 by using the REPLACE=T option.

EXECUTE sem_apis.create_rdf_graph_collection('VM1',
                                          rdf_graphs=>sem_models('model_1', 'model_2'),
                                          inferred_graphs=>sem_entailments('entailment1'),
                                          options=>'REPLACE=T',
                                          network_owner=>'RDFUSER',
                                          network_name=>'NET1');