Database Views from RDF Models

You can create relational views from RDF models. These views can represent a vertex or an edge view of a graph.

SPARQL query patterns can be used as a declarative language for specifying how to build vertex and edge views from RDF data.

It is important to note the following when creating the vertex and edge views from an RDF model:

The following sections explain the steps to create a database graph view:

Creating a Graph View

Perform the following steps to create a database graph view:

  1. Right-click the RDF model to open the context menu as shown:

    Figure: Create Graph View Option

    Description of the illustration create_graph_view_option.png

  2. Click Create Graph Views.

    The application opens an editor with the available RDF classes populated from a SPARQL query as shown:

    Figure: RDF Classes

    Description of the illustration rdf_classes.png

    Note that the database graph views cannot be created if there are no RDF classes.

  3. Add Vertex Views as required.

    See Creating a Vertex View for more information.

  4. Add Edge Views as required.

    See Creating an Edge View for more information.

  5. Review and verify the graph representation of the Database Views.

    The following figure shows a sample graph representation:

    Figure: Sample Graph Definition

    Description of the illustration sample_graph_representation.png

  6. Optionally, you can hover over a table row and click the action menu icon to Remove, Edit, or Preview a specific vertex or an edge view.

    Figure: Action Menu Options

    Description of the illustration graphview_action_menu.bmp

  7. Click Graph View to visualize the sample graph.

    Note that in a graph view, each node represents a vertex view and the link between nodes have an edge label. The following figure shows a sample graph visualization containing two vertex views with key attributes movieId and entityId which are linked by the actor edge label.

    Figure: Graph Visualization for RDF Database Views

    Description of the illustration graph_view_viz.png

  8. Click Create to create the RDF graph view in the database.

    The Create Views dialog opens as shown:

    Figure: Create Views

    Description of the illustration create_db_views.png

    1. Optionally, switch ON the Overwrite option to replace any existing view definition.

    2. Click Create.

    The database graph view gets created.

    The following figure shows the views that are created in the database for the sample graph definition shown in step-5:

    Figure: RDF Database Graph Views

    Description of the illustration sqldev_dbviews.png

Creating a Vertex View

Perform the following steps to create a vertex view:

  1. Click Add in the Vertex Views panel shown in the following figure:

    Figure: Creating a Vertex View

    Description of the illustration vertex_views_panel.png

  2. Configure the Vertex View Definition.

    Provide the following parameter values to define the vertex view:

    • Vertex view: Name of the vertex view. This will be used for querying the vertex.

    • Vertex key: Vertex key attribute.

    • RDF classes: One or more RDF classes. When RDF classes are added, the application retrieves the available properties for the class and lists them in the dialog. You can choose the properties to be added to the view. The Vertex Properties table has the following columns:

      • Include: At least one property must be included

      • Label: Property label

      • Data type: Displays the property data type

      • Nullable: At least one FALSE property must be included

        • TRUE: Vertices with NULL (missing) values for the property will be included.

        • FALSE: Vertices with NULL (missing) values for the property will be excluded.

    The following figure shows two examples of vertex view definitions (movie and actor entities):

    Figure: Vertex View Definitions

    Description of the illustration vertex_view_definitions.png

Creating an Edge View

An edge view can be defined using one or two vertex views.

To create an edge view:

  1. Click Add in the Edge Views panel shown in the following figure:

    Figure: Edge Views

    Description of the illustration create_edge_view.png

  2. Configure the Edge View Definition.

    Provide the following parameter values to define the edge view:

    • Edge view: Name of the edge view. This will be used for querying the edge.

    • Source Vertex key: Source vertex key attribute.

    • Edge label: Edge label value.

    • Destination Vertex key: Destination vertex key attribute.

    In the following figure, the edge links the movie and actor entities:

    Figure: Edge View Definition

    Description of the illustration edge_view_def.png