10.6.13 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 RDF model must have classes defined and the application uses a SPARQL query to retrieve the distinct classes defined on an RDF model. For example:
    SELECT DISTINCT ?o
    WHERE { ?s a ?o } order by ?o
  • One or more RDF classes can define a vertex view. A vertex view consists of:
    • Database vertex view name
    • Key attribute name
    • Vertex properties from RDF class
  • One or two vertex views can define an edge view. An edge view consists of:
    • Database edge view name
    • Source and destination vertex keys
    • Label property from RDF classes

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

10.6.13.1 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 10-89 Create Graph View Option

    Description of Figure 10-89 follows
    Description of "Figure 10-89 Create Graph View Option"
  2. Click Create Graph Views.

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

    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 10-91 Sample Graph Definition

    Description of Figure 10-91 follows
    Description of "Figure 10-91 Sample Graph Definition"
  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 10-92 Action Menu Options

    Description of Figure 10-92 follows
    Description of "Figure 10-92 Action Menu Options"
  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 10-93 Graph Visualization for RDF Database Views

    Description of Figure 10-93 follows
    Description of "Figure 10-93 Graph Visualization for RDF Database Views"
  8. Click Create to create the RDF graph view in the database.

    The Create Views dialog opens as shown:

    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 10-95 RDF Database Graph Views

    Description of Figure 10-95 follows
    Description of "Figure 10-95 RDF Database Graph Views"

10.6.13.2 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 10-96 Creating a Vertex View

    Description of Figure 10-96 follows
    Description of "Figure 10-96 Creating a Vertex View"
  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 10-97 Vertex View Definitions

    Description of Figure 10-97 follows
    Description of "Figure 10-97 Vertex View Definitions"

10.6.13.3 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:
  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 10-99 Edge View Definition

    Description of Figure 10-99 follows
    Description of "Figure 10-99 Edge View Definition"