Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 ·...

37
Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 Graph Visualization Using Cytoscape 3.2 February 2016 Provides usage and reference information about Oracle Database support for semantic technologies, including storage, inference, and query capabilities for data and ontologies based on Resource Description Framework (RDF), RDF Schema (RDFS), and Web Ontology Language (OWL).

Transcript of Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 ·...

Page 1: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

February 2016

Provides usage and reference information

about Oracle Database support for semantic

technologies, including storage, inference, and

query capabilities for data and ontologies

based on Resource Description Framework

(RDF), RDF Schema (RDFS), and Web

Ontology Language (OWL).

Page 2: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

2

Introduction .................................................................................................................................... 4

Installing and Configuring Support for Cytoscape ............................................................................. 4

Connecting to Oracle Database and Viewing a Model or Entailment ................................................. 9

Overview of Graph Visualization Operations .................................................................................. 12

Menu Overview ............................................................................................................................ 12

Quick Tour: A FAMILY Social Network ............................................................................................. 13

Schema Operations ....................................................................................................................... 16

Node and Property Operations ...................................................................................................... 17

Search for a Concept ..................................................................................................................... 19

Instance Summary ......................................................................................................................... 20

Visualizing a Subset of a Graph ...................................................................................................... 20

Analyzing the Paths Between Nodes .............................................................................................. 25

Recalculating Label Counts ............................................................................................................ 27

Color settings ................................................................................................................................ 29

Data Set Sizes ................................................................................................................................ 31

Effect of OVERLAY Option on the Displayed Graph ......................................................................... 32

Adjusting The Edge Size, Shape And Background Colors ................................................................. 32

Construct Queries ......................................................................................................................... 34

Shortcuts for the Most Used Features ............................................................................................ 35

Saving the Steps that Created the Current View ............................................................................. 36

Page 3: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

3

This document is an addendum to the Oracle Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1. Oracle Spatial and Graph RDF Semantic Graph Developer's Guide provides usage and reference information about Oracle Database Enterprise Edition support for semantic technologies, including storage, inference, and query capabilities for data and ontologies based on Resource Description Framework (RDF), RDF Schema (RDFS), and Web Ontology Language (OWL). The RDF Semantic Graph feature is licensed with the Oracle Spatial and Graph option to Oracle Database Enterprise Edition, and it requires the Oracle Partitioning option to Oracle Database Enterprise Edition.

This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.

The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing.

If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable:

U.S. GOVERNMENT END USERS: Oracle programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, delivered to U.S. Government end users are "commercial computer software" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, use, duplication, disclosure, modification, and adaptation of the programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, shall be subject to license terms and license restrictions applicable to the programs. No other rights are granted to the U.S. Government.

This software or hardware is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications that may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software or hardware in dangerous applications.

Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group.

This software or hardware and documentation may provide access to or information on content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services.

Page 4: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

4

Introduction

Cytoscape 3.2 (also referred to here as Cytoscape) is an open source graph visualization tool. The

Cytoscape Consortium describes it as a general platform for complex network analysis and

visualization.

Oracle gratefully acknowledges the Cytoscape Consortium licensor of Cytoscape, which is available at

http://www.cytoscape.org/download.php

Oracle Spatial and Graph RDF Semantic Graph support for Cytoscape 3.2 (also referred to here as

support for Cytoscape) allows users to visualize World Wide Web Consortium (W3C) Resource

Description Framework (RDF) graphs stored in Oracle Database with Cytoscape. The support for

Cytoscape implements a Cytoscape “App” that conforms to the Cytoscape Apps (formerly called

plugins) architecture, as described in the Cytoscape 3.0 App Development documentation.

Large RDF data sets can be stored in Oracle Database and viewed efficiently using the support for

Cytoscape as subsets, summaries and samples.

• Subsets create static and dynamic views of a portion of a graph or subgraph.

• Summaries capture the essence of RDF data being viewed. Summarized data can be expanded

on demand, letting you create hybrid (summary-detail) fisheye views of RDF data.

• Sampling creates a representative sample of the RDF data to further optimize visualization of a

large dataset.

RDF data elements are stored as subject-predicate-object “triples” where the predicate expresses a

relationship between the subject and the object. Triples can be asserted and inferred. Applying rules to

the asserted triples using W3C standard rule sets, including the RDF Schema (RDF/S) and the Web

Ontology Language (OWL) semantics, generates inferred triples. The support for Cytoscape can

visualize both RDF asserted and inferred triples.

This document assumes you are familiar with the concepts, terms and information in the Oracle Spatial

and Graph documentation, the RDF Semantic Graph Developer’s Guide.

Installing and Configuring Support for Cytoscape

Prerequisites to install support for Cytoscape:

Oracle Database 12c Release 1, 12.1.0.1 or higher.

Cytoscape 3.2.0 available from: http://www.cytoscape.org/download.html

Java 7 and higher available from: https://www.java.com/en/download/

To install support for Cytoscape follow these steps.

1. Use the Cytoscape App Manager or a file copy operation to copy oraclerdf.jar into the

required path

1. Use the Cytoscape App Manager:

Page 5: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

5

1. Navigate to Apps then AppManager

2. Choose the option “Install from File” as shown in Figure 1 below.

3. Select the support for Cytoscape file, oraclerdf.jar.

This option copies the file oraclerdf.jar into the path

“C:\Users\[local_username]\CytoscapeConfiguration\3\apps\installed

where [local_username] refers to the current username in the operating system.

4. Start Cytoscape 3.2

2. Perform a file copy operation to move oraclerdf.jar into the path

C:\Users\[local_username]\CytoscapeConfiguration\3\apps\installed,

where [local_username] refers to the current username in the operating system.

Note: The directory CytoscapeConfiguration\3\apps\installed is created the first time

you open Cytoscape.

Note: Please enable either oraclerdf.jar or propertyGraphSupport.jar. Do not enable both at the

same time; this will avoid the confusion of two menus. Cytoscape provides an option to uninstall

or disable applications from the Apps Manager. If both jars are enabled, please disable one of them

to avoid errors.

2. Copy ojdbc7.jar into the Cytoscape installation path as follows:

1. Microsoft Windows: the usual location is C:\\Program Files\Cytoscape_v3.2.0\framework\lib

2. MAC OS: /Applications/Cytoscape_v3.2.0/framework/lib.

3. Linux: Cytoscape_v3.2.0/framework/lib

Page 6: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

6

3. Cytoscape3.props is used to configure default values in the support for Cytoscape. This file

is located in the Cytoscape configuration directory as follows:

Microsoft Windows C:/Users/local_username/CytoscapeConfiguration/cytoscape3.props

MAC OS and Linux: located in the user's home directory.

The following table describes the parameters that can be customized with support for Cytoscape.

Property name Description Possible values

oracle-plugin.host The host to connect to Oracle

Database

oracle-plugin.sid The SID of Oracle Database to

connect

oracle-plugin.port The port to connect to Oracle

Database

oracle-

plugin.timeout.in.seconds The timeout in seconds

customized for the Oracle

Database connection

An integer value (default value is

30)

oracle-plugin.username The username to connect to

Oracle Database

Figure 1. The application manager used to install support for Cytoscape

Page 7: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

7

oracle-

plugin.background.color The background color of the

views

A hexadecimal value

representing a color in the format

#FFFFFF

oracle-

plugin.background.color.fa

cets

The background color of the

views for the facets

A hexadecimal value

representing a color in the format

#FFFFFF

oracle-plugin.edge.type The types of possible edges {"Separate Arrow", "Contiguous

Arrow", "Solid Edge", "Solid

Without Arrowhead"}

oracle-plugin.edge.size The width of the edge {1,2,3,4,5} the default value is 3

oracle-

plugin.use.rectangular.nod

es

If true then the nodes are

represented as rectangular nodes,

if false then nodes are

represented as shapes

{true, false}

oracle-

plugin.add.literals.to.gra

ph

If true then literals are included

into the graph as nodes linked by

edges

{true, false}

oracle-

plugin.enable.animation If true then animation is used

when nodes are expanded

{true, false}

oracle-

plugin.background.color.rd

b2rdf

The value representing a

background color in a

hexadecimal format

A background color in a

hexadecimal representation. For

instance #DADADA

oracle-

plugin.enable.logging If true then logging capabilities

are enabled to log information.

{true, false}

Note: for security reasons, the connection password must to be provided each time a new schema

connection is established.

4. Connect to Oracle Database as a user with database administrator privileges and create two new

indexes using the flexible indexing scheme, as follows:

EXECUTE sem_apis.add_sem_index('SPCGM');

EXECUTE sem_apis.add_sem_index('CSPGM');

5. Rebuild the Subject-Predicate-Canonical Object-Graph-Model (SPCGM) and Canonical object-

Predicate-Subject-Predicate-Graph-Model (CSPGM) indexes for any existing models that you

want to visualize using Cytoscape with the following commands:

EXEC sem_apis.alter_sem_index_on_model('<model_name>', 'SPCGM',

'REBUILD');

EXEC sem_apis.alter_sem_index_on_model('<model_name>','CSPGM',

'REBUILD');

Page 8: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

8

6. It is also recommended that you rebuild the indexes for each entailment you plan to visualize.

EXECUTE SEM_APIS.ALTER_SEM_INDEX_ON_ENTAILMENT('<entailment_name>',

'SPCGM', 'REBUILD');

EXECUTE SEM_APIS.ALTER_SEM_INDEX_ON_ENTAILMENT('<entailment_name>',

'CSPGM', 'REBUILD');

7. Go to the directory containing the catsemviz.sql, semviz_setup.sql and semviz.plb

files.

8. Connect to Oracle Database as user SYS with SYSDBA privileges.

9. Load the catsemviz.sql file, as follows:

@catsemviz.sql

This will set up the required database tables and PLSQL packages needed for the visualization.

Note: For a multitenant environment, run installation scripts using catcon.pl:

$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -u SYS -d

/home/oracle/oracle_support_12.1.0.2_for_cytoscape_3_2/PLSQL -b catsemviz_output

catsemviz.sql

10. Create summaries and auxiliary data structures to optimize visualization. To do this, connect to

Oracle Database as the user that owns the schema contains the RDF model(s) and enter the

following statements, where

<model_name> is replaced by your model name; and

<rulebase> is replaced by either a rulebase name if you have created a rules index

(entailment) or a null value.

Repeat this step for every combination of model and rulebase you wish to visualize.

--Computes Class instance and Class property summary to optimize performance

DECLARE

cnt1 NUMBER;

cnt2 NUMBER;

BEGIN

MDSYS.SEM_ANALYSIS.GEN_SUMMARY('<model_name>','<rulebase>’,100,1,cnt1,cnt2);

END;

/

--Computes local RDF term values for fast lookup

EXECUTE MDSYS.SEM_ANALYSIS.GEN_AUX_VALUES('<model_name>','<rulebase>’,100,1); -- Computes demographics count on the model/rulebase

EXECUTE MDSYS.SEM_ANALYSIS.GEN_DEMOGRAPHICS('<model_name>','<rulebase>’,100,1);

--Computes node cardinality for the model/rulebases

EXECUTE MDSYS.SEM_ANALYSIS.GEN_NODE_CONN('<model_name>','<rulebase>’,1);

EXEC dbms_stats.gather_table_stats(ownname => '<user_name>’, tabname => 'RDFV_SAMPLE_MODEL$', estimate_percent => 10,

method_opt=>'FOR ALL COLLUMNS SIZE AUTO', cascade => TRUE, no_invalidate=>FALSE);

Page 9: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

9

Note: These summaries can also be created, deleted and updated graphically from the model settings

panel shown in Figure 4.

Connecting to Oracle Database and Viewing a Model or Entailment

Before visualizing an RDF graph stored in Oracle Database, you must have support for Cytoscape

installed. After invoking Cytoscape, connect to Oracle Database, read an RDF graph or entailment (a

model) into Cytoscape and explore the data.

Invoking Cytoscape

For Microsoft Windows:

Invoke Cytoscape either by executing the shortcut provided in the Windows Start menu or executing

the file cytoscape.bat located in the Cytoscape installation directory C:/Program

Files/Cytoscape_v3.2

For Linux: Invoke Cytoscape by executing the script cytoscape.sh.

Connecting to Oracle Database from Cytoscape

Select the option Load Data From Oracle Database from the File menu option as shown in Figure 2.

Loading data from Oracle

A dialog box will be displayed asking for the JDBC connection settings: host, port, and database SID,

driver mode, and username and password. The values in the cytoscape3.props file are displayed as

the defaults. The JDBC connection string is created according to these values. Clicking on the edit

button next to the text field can also customize it. This dialog is shown in Figure 3.

Figure 2. Loading data from Oracle Database

Page 10: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

10

Once you have established a JDBC connection with Oracle Database by pressing the Connect button,

the models available in the Oracle Database RDF graph store will be displayed as shown in Figure 3.

The support for Cytoscape also supports connections using operating system authentication. In order to

use this feature follow the steps below:

1. Populate the username and password fields. Click on the Connect button to be connected to

Oracle Database using operating system authentication.

2. Make sure the operating system user has been created appropriately on the database server. For

example, if the user is user1 the remote operating system user should be created as

ops$user1. Also, while connected to the database as the user which owns the semantic model,

grant the following privileges to the remote user:

• grant select on mdsys.semm_<model_name> to <remote_user>

• grant select on mdsys.rdfm_<model_name> to <remote_user>

• grant select on <application_table_name> to <remote_user>

3. If the user has generated summary, demographics information on the model (recommended),

then also grant the following:

• grant select on mdsys.semm_psum_<model_name> to <remote_user>

• grant select on mdsys.semm_isum_<model_name> to <remote_user>

• grant select on mdsys.semm_auxval_<model_name> to <remote_user>

• grant select on mdsys.semm_conn_<model_name> to <remote_user>

Reading data from Oracle Database into Cytoscape

Select a regular or virtual RDF model to visualize in Cytoscape. You can visualize a model and an

entailment combination. An entailment is viewed by specifying the rulebase that generated it (See the

Figure 3. JDBC connection settings

Page 11: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

11

(See the RDF Semantic Graph Developer’s Guide for details about rulebases.) The Overlay option

controls whether subsequent views are displayed in the current window or in a new one.

The model settings panel shown in Figure 4 is used to select an available model. Once a model has

been selected, the settings are shown, including the summaries created for this model.

Note: Support for Cytoscape does not require summaries. However, it is recommended that

summaries be created to enhance performance on large graphs. Some features, such as searches

will not work if the summaries or the full text index have not been created. These summaries can

be created, deleted or updated on demand in the model settings panel shown in Figure 4.

Pre-computed summaries replace portions of the graph with summarized data. Summaries are

useful for graphs that have multiple inbound and/or outbound edges of the same predicate type for

a node. Summaries help by storing a count for the number of edges of a given node and predicate

combination, rather than storing each triple individually. These aggregate edges can be expanded

as needed. Edge counts are not updated automatically. See the Recalculate Label Counts section.

Figure 4. The model settings panel to select an available model and rule base.

Page 12: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

12

Viewing a Model or Entailment

The root classes in the schema of the data set are initially selected and displayed for viewing and

browsing. You can expand the root nodes to find an area of interest. In addition, you can expand the

graph using the options described below. The resulting graph can be included in the current display or

displayed in a new window by turning the OVERLAY feature on or off, respectively.

Overview of Graph Visualization Operations

Figure 5 shows the basic operations allowed by the support for Cytoscape.

Figure 5. Basic Operations Overview

Regarding the operations described in Figure 5:

The SPARQL-like SEM_MATCH (with focal point) capability visualizes the result of a

SEM_MATCH query in Oracle Database that is centered on a node of interest. (See the RDF

Semantic Graph Developer’s Guide for details about the Oracle SQL SEM_MATCH table

function.)

The other operations can further expand the graph.

The Get Class Representative Summary returns summary information about a class

representative.

The Get Instance Summary returns summary information about a specific instance.

Root Classes displays all the root classes in the graph

Expand Class, Expand Object, and Expand Property operations can be performed on the

graphs returned in the preceding operations to selectively expand a class, node, or property,

respectively.

Menu Overview

The menu options fall into the following categories:

Page 13: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

13

Use the Root Nodes menu option at any time to view the primary nodes of a graph. Root

classes are automatically displayed once the connection to Oracle Database is established and

the model and rulebase information is loaded. This view displays all the root nodes in the class.

If there are no root classes in the model, then an empty screen is displayed. In this case, you can

start by displaying a subset of the data set using Get Subset.

View schema elements using the operations Get Demographics, Get Schema Demographics,

Get View Metadata, and Toggle Overlay for information about the metadata for the selected

view.

Explore and expand a graph using node and property level operations:

o Expand Class displays all first level subclasses of the selected class.

o Expand Object displays all nodes that are one hop away from the selected node.

o Expand Property displays the expanded property list for the selected edges.

o Get Class Representative Summary displays a summary of the instances for a class.

o Get Instance Summary displays a summary for a particular instance.

Perform a query to visualize a subset of the graph. Queries can include filter conditions, such as

the SQL WHERE clause, ROWNUM clause, etc.

o Get Subset specifies a SPARQL-like Oracle SQL SEM_MATCH query and displays the

sub-graph.

o Get Subset Summary is similar to Get Subset but allows you to specify a focal point.

o Facets allows you to browse the facets of a large data set efficiently. It returns all the

individual sub-graphs matching the query pattern and allows you explore the resulting

sub-graphs.

Search with keywords to build a Get Subset query. If you want to specify a value (RDF

resource) for a node (subject or object) or a predicate in the query but don’t know its Uniform

Resource Identifier (URI) you can search for it by specifying part of the resource name in the

subject, predicate, or object. A list of up to forty matching names is displayed. You can select

the URI of the resource and enter it in the triple pattern.

Literals can be hidden to present a more streamlined graph using the right-click menu.

Recalculate Label Counts is used to update the aggregate edge counts for any expanded edges.

Quick Tour: A FAMILY Social Network

A sample data set for a Family Social Network (FAMILY) is used for this example. The following

figures show the graphs that result from various operations.

The root classes are loaded when the support for Cytoscape connects to the database and loads the

semantic model corresponding to the dataset. Figure 6 shows that #Resource is the only root class.

Page 14: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

14

Figure 6. Root class

When the #Resource class is expanded, the graph has several subclasses (Person, Male, Female, Class,

etc.)

Figure 7. The class hierarchy of the root node

Right click on the #Person node and get a particular Instance Summary, in this case, the pattern to

Page 15: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

15

search for is the name Matt.

Figure 8. The Instance Summary of the node labeled as “Matt”

The sequence in Figure 9 shows the effect of the OVERLAY option when the Expand Property

operation is performed on the edge for #type.

Page 16: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

16

Figure 9. OVERLAY option

Schema Operations

Once a model is loaded and selected, schema operations can display the metadata for the current view

of the model. You can simultaneously open multiple views of the same or different models.

Get Demographics menu command returns the demographics for the model, such as the number of

distinct subjects, predicate, objects, and triples in the model.

Get Schema Demographics returns the information about the schema level statistics for the model,

such as the total number of subclasses, and the maximum fan out of a node in the graph.

Get View Metadata displays information about the selected view, including the model, the rulebase

used for displaying the entailed graph, the sample size selected, and whether the Overlay option is on.

Page 17: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

17

Figure 10. Get demographics operation

Note that you must click OK in the window that displays the metadata information before you can

proceed with other operations in Cytoscape.

Node and Property Operations

Once a semantic model is loaded and its root classes are displayed in Cytoscape, you can explore the

graph with node and property operations. Select a node or edge and use the context sensitive right-click

menu as shown in Figure 11 and Figure 12, or the menu bar.

Get Class Representative Summary displays a summary of the instances for a class. The properties

that the instances of a class could have are represented in the summary. Both incoming and outgoing

property edges are displayed and a count is given for each edge indicating the number of instances

having that property.

Get Instance Summary displays a summary for an instance of the class. The incoming and outgoing

edges indicate the properties of the instance. A count is provided if there are multiple edges of the same

type.

Expand Class displays all the immediate subclasses of a selected node.

Expand Node operation expands the subclasses of the selected node, and its properties and instances.

It displays all of the triples that have the selected node as a subject or an object.

Page 18: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

18

Figure 11. Node context menu invoked from the right-click menu.

Expand Property displays the property list for an edge; it shows the individual property edges. Select

the edge and using right-click menu as shown in Figure 12. When there are a large number of triples,

pagination can be used to create and browse the multi-page list.

Expand with selective can be used to expand an edge using a selective query pattern or keyword. All

the triples matching the keyword will be displayed.

Note: Expand Class and Expand Property operations can return a large number of triples. If the

number of edges resulting from property expansion is too large to be displayed on the graph

without clutter only the first K property edges are displayed. This restriction is set in the result

returned by the database and/or the number of triples displayed by Cytoscape.

Figure 12. Property context menu invoked from the right-click menu

Page 19: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

19

Search for a Concept

To search for a concept in the RDF model, press the Search button in the left upper corner as shown in

Figure 13. This will display a window dialog. Enter a concept to search as shown in Figure 14.

After a keyword has been entered and the query submitted, a list of triples is displayed. If you select a

triple and press the Instance Summary button, the sub-graph containing this triple is displayed.

To perform a keyword search, first create a full text index for the current selected model.

Figure 13. The button to perform a keyword-based search of

triples

Figure 14. The list of triples that match with a keyword

Page 20: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

20

Instance Summary

To query an instance of a specific class, right-click over the node representing the class, and select the

option Get Instance Summary as shown in Figure 15. Then specify a keyword or the URI for an

instance of interest. This option can also be invoked from the menu bar after a node has been selected.

Figure 15. Get Instance Summary option invoked from the right-click menu

Visualizing a Subset of a Graph

Once a semantic model is loaded and its root classes are displayed, you can explore the graph with the

Node and Property operations previously described or by issuing a SPARQL query for a subset of

nodes in the graph. As described in the next three sections, use the Get Subset menu item to specify a

query pattern. Use Get Subset Summary to obtain a summary of a graph or a subgraph based on a

focal point. Use Facets to perform efficient queries over large data sets.

Get Subset

The Get Subset option can be invoked from the right-click menu or the menu bar. The dialog in Figure

16 is displayed. You can enter a custom query and include up to ten triple patterns by clicking on the “+”

button. Click Submit to enter the query. The results of the query are displayed as a graph.

For example, grandfathers can found with the following SPARQL query pattern:

{ ?s <http://www.example.org/family/fatherOf> ?o ?o <http://www.example.org/family/fatherOf> ?o2

}

This SPARQL query is entered in the Get Subset dialog as follows.

Page 21: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

21

Figure 16. Get subset window

Query Options:

Keyword searches can be performed to find URIs for the subject, predicate and object elements

of a query by entering a keyword in the text field and clicking the search icon. A list of up to

forty matches is displayed in a drop-down list.

Subset queries can include SQL filter clauses, such as the WHERE and ROWNUM clauses.

Subset queries can be named and saved for reuse. Selecting a stored query causes it to be loaded

into the triple patterns where it can be edited and executed.

Click Show Subgraphs to display a list of matching subgraphs as seen in Figure 19.

Clicking Submit returns a graph of the grandfather subset in Figure 17:

Figure 17. Get Subset result

Page 22: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

22

Note: Get Subset operations can return a large number of triples. If the number of edges resulting

from property expansion is too large to be displayed on the graph without clutter only the first K

property edges are displayed. This restriction is set in the result returned by the database and/or the

number of triples displayed by Cytoscape.

Get Subset Summary

Get Subset Summary is used to obtain a summary of the graph or sub-graph based on a focal point.

For example, a wildcard query that has a “?s” focal point, returns the subset summary in Figure 18.

Figure 108. Get Subset Summary result

The subgraphs panel shows the query and the subgraphs resulting from the query. A list of subgraphs is

located in the upper left of the window as seen in Error! Reference source not found.9. Select a

subgraph from the list to highlight the subgraph on the right. Selecting a triple from the list on the

lower left highlights the subgraphs that contain the selected triple.

Page 23: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

23

Figure 119. The subgraphs panel allows interaction with the subgraphs queried and the triples.

Facets Option

Use the Facets button in the Subset Query window to browse the facets of a subset query more

efficiently for a large data set. A pair of graphs showing facets of the subgraph is created, a “query-

refinement” graph and an “original query pattern” graph. Figure 20 shows an example of both graphs.

The query-refinement graph in the box on the left displays a hierarchy of queries. There is one

node for each query. The corresponding edge has the value of the variable for the child query.

“Q1” is currently selected. It is the original query. The child nodes that branch from “Q1” are

the finer-grained queries; they can also be examined.

The query graph on the right shows the query structure for the selected query. Each node and

edge is a variable in the query pattern. The number in parenthesis for each is the total number of

distinct values for that variable in the data.

Page 24: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

24

Figure 21 shows the Apps -> Facets menu options that are available by right clicking on a node in the

query refinement graph:

Execute query will visualize the matching triples in a subgraphs panel as shown in the previous

section.

Show query-refinement-graph changes the query pattern to show facet values for the selected

node in the query refinement graph. For example, selecting the node Q2 would display a graph

with the node op1 replaced by the value Adrian.

View SQL Query shows the SQL used to query the graph in Oracle Database.

Figure 20. The query refinement graph is on the left with the query pattern for the selected query

“Q1” on the right.

Page 25: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

25

Analyzing the Paths Between Nodes

Common questions when an RDF model is analyzed include: Is there a path connecting two elements?

What is the separation degree in this path? These questions can be answered with the Path finder

option, located in the top level menu.

The Path finder dialog is shown in Figure 22. Analyze a path by entering a pattern in the text field and

clicking the search button. The results of the search will be inserted in the boxes below the text fields.

Figure 21. The facets menu option includes the execution of the current query and to show the

facets result of a specific refinement node.

Page 26: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

26

Figure 22. The Path finder dialog

Specifying the origin and target allows support for Cytoscape to calculate the distance from each node.

All the paths having a distance less than or equal to the distance in the distance slider will be retrieved.

The subgraph panel in Figure 23 shows the results of the query from Figure 22. In this case, there are

seven paths identified as sub-graphs. The user can select a subgraph from the list to highlight the

associated triples in the table or select a triple from the table to highlight the associated subgraphs.

For example, selecting the triple [Tom -> type -> Person] highlights sub-graphs two and seven.

Page 27: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

27

Figure 23. Analyzing the Paths Between Nodes

Recalculating Label Counts

Recalculate Label Counts is used to update the aggregate edge counts for any expanded edges. The

edge counts are not updated automatically. If a node has multiple edges with the same predicate, the

edge is compacted and is shown as an aggregate edge with an edge count. The edge count indicates the

numbers of triples that are incoming and outgoing with the same predicate.

If you expand the graph through a series of operations, the aggregate edge count becomes incorrect and

needs to be adjusted to account for the expanded edges. Recalculate Label Counts recalculates the

aggregate edge count and updates the edge label.

For example, the aggregate count on the incoming #type property for Person in Figure 24 is incorrect,

since there is already an explicit expanded edge #type. Figure 25 reflects the corrected edge count

after Adjust Label Count is executed.

Page 28: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

28

Figure 124. Incorrect label count.

Figure 135. Corrected count after recalculating label counts.

Page 29: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

29

Color settings

Color settings in Figure 26 enables filtering in or out the label or the predicates in the sub-graph, as

well as changing the color of the edges and nodes. It is invoked using the Filter icon located in the

right menu.

The color assigned to each edge or predicate can be changed as shown in Figure 27. It shows the

changed colors in the subgraph, according to the colors in Figure 26.

Figure 146. The Filter Predicates interface

Page 30: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

30

Color settings for nodes

Color settings for the nodes can also be configured using the interface shown in Figure 28. The nodes

are grouped according to the following types: URI’s, literals, blanks, query graph nodes, query-

refinement graph nodes and a no-fill option for nodes.

Figure 27. Custom coloring of edges

Page 31: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

31

Data Set Sizes

The table lists the size of a data set resulting from various operations.

Operation Type Result Size

Default (Get Root Classes) Static Subset

Get Demographics Static Summary 1

Get Class Demographics Static Summary 1

SEM_MATCH

(with focal point)

Dynamic Subset Summary [2*num_predicates]

SEM_MATCH Dynamic Subset [0,num_triples]

Get Representative Summary

(for a class instance set)

Static Subset Summary [2*num_predicates]

Figure 28. The node color interface

Page 32: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

32

Operation Type Result Size

Get Particular Instance

Summary

Static Subset Summary [2*num_predicates]

Expand Class Dynamic Subset [0, num_triples]

Expand Object Dynamic Subset Summary [2*num_predicates]

Expand Property Dynamic Subset [0,num_triples]

Effect of OVERLAY Option on the Displayed Graph

The following table describes how OVERLAY=YES option works. OVERLAY=NO will always

display the resulting graph in a new view.

Operation Old

Annotated

Graph

New

Annotated

Graph

OVERLAY

=YES

Load Model

(getRootClasses)

N/A Singleton node

Set

New View

SEM_MATCH Subset N/A Triple Set New View

SEM_MATCH

Summary

N/A Summary based

Triple Set

New View

Class Representative

Summary

N/A Summary based

Triple Set

New View

Particular Instance

Summary

N/A Summary based

Triple Set

New View

Expand Class AGold AGold U AGnew Old View

Expand Object AGold AGold U AGnew Old View

Expand Property AGold AGold U AGnew Old View

Adjusting The Edge Size, Shape And Background Colors

The support for Cytoscape lets you configure the edge shape and color. The option, Color and Edge

Configuration located in the menu bar displays a small configuration window to modify the

background colors for the options, the edge shape and size, the node’s shape, and whether animations

should be used. These configuration options are shown in Figure 29.

Page 33: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

33

Figure 29. General settings configuration window

If the option to use animation is set to true, then the nodes included in the expansions are added to the

current graph without the use of animation.

Figure 30 shows the result of applying color customization on edges and nodes on the current network

or graph.

Page 34: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

34

Figure 30. The graph result of applying customization on nodes and edges

Construct Queries

The menu option Construct query provides a dialog to create a query, as shown in Figure 31

Page 35: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

35

Figure 31. The construct query dialog

Shortcuts for the Most Used Features

Icons in the menu provide shortcuts for the most used features. Figure 32 shows the menu with the

shortcuts as described below from left to right:

The first icon expands the hierarchy of the selected nodes. It expands all the <subclassOf>

relations.

The second icon expands the selected nodes in the current graph. The hot-key for this option is

‘e’.

The third icon expands the selected edges in the current graph. The hot-key for this option is

‘p’.

The fourth icon displays the literals in the current graph. The hot-key for this option is ‘s’.

The fifth icon hides the annotations that represent the literals, this menu can have two options:

display the literals as annotations or display the literals as nodes. To change this option, modify

the value “oracle-plugin.add.literals.to.graph” as described in section 2. The hot-hey for this

option is ‘h’.

The sixth icon creates a subset query by specifying a triple pattern.

The seventh icon configures color settings of the nodes and edges.

The eighth icon searches for a specific triple using a pattern.

The last two options perform undo and redo operations.

Figure 32. The shortcuts to the most used features.

Page 36: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

36

Saving the Steps that Created the Current View

The sequence of steps performed by the user for the current visualization is recorded in the panel on the

left as shown in Figure 33. The copy to clipboard button can save the sequence for future use.

Figure 33. The panel that displays the sequence of steps in the current visualization

Page 37: Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c … · 2016-02-19 · Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph

Oracle Spatial and Graph RDF Semantic Graph Developer ’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2

37

Copyright (C) 2016. Oracle and/or its affiliates. All Rights Reserved Oracle® Spatial and Graph RDF Semantic Graph Developer’s Guide 12c Release 1 – Graph Visualization Using Cytoscape 3.2 February 2016 Oracle Corporation World Headquarters 500 Oracle Parkway Redwood Shores, CA 94065 U.S.A. Phone 650.506.7000 Fax 650.506.7200 International Inquiries: Phone 44.932.872.020 Telex 851.927444(ORACLEG) Fax 44.932.874.625 http://www.oracle.com