Visualize and explore

This guide uses a variation of the Star Wars dataset that you can download and use to execute the examples yourself.

See also

The Geo tab in the SPARQL view allows you to Visualize geospatially linked data using maps from OpenStreetView.

Class hierarchy

To explore your data, navigate to Explore ‣ Class hierarchy. You can see a diagram depicting the hierarchy of the imported RDF classes by the number of instances. The biggest circles are the parent classes and the nested ones are their children.

Note

If your data model is not hierarchical, the RDF classes are visualized as separate circles instead of nested ones.

_images/rdf-class-hierarchy-diagram.png

Explore your data — different actions

  • To see what classes each parent has, hover over the nested circles.

  • To explore a given class, click its circle. The selected class is highlighted with a dashed line and a side panel with its instances opens for further exploration. For each RDF class, you can see its local name, IRI, and a list of its first 1,000 class instances. The class instances are represented by their IRIs, which, when clicked, lead to another view where you can further explore their metadata.

    _images/rdf-class-hierarchy-diagram-selected-class.png

Note

The side panel includes the following:

  • Local name

  • IRI (Press Ctrl+C / Cmd+C to copy to clipboard and Enter to close)

  • Domain-Range Graph button

  • Class instances count

  • Scrollable list of the first 1,000 class instances

  • A View Instances in SPARQL View button; this redirects to the SPARQL view and executes an auto-generated query that lists all class instances without LIMIT

  • To go to the Domain-Range Graph diagram, double-click a class circle or the Domain-Range Graph button from the side panel.

  • To explore an instance, click its IRI from the side panel. The following shows an example of an instance display:

    _images/rdf-class-hierarchy-diagram-class-instance-resource-view.png
  • To adjust the number of classes displayed, drag the slider on the left side of the screen. Classes are sorted by the maximum instance count, and the diagram displays only the current slider value.

    _images/rdf-class-hierarchy-diagram-slider-low-value.png
  • To administrate your data view, use the toolbar options on the right side of the screen.

    _images/rdf-class-hierarchy-diagram-toolbar.png
    • To see only the class labels, click the Hide/Show Prefixes. You can still view the prefixes when you hover over the class that interests you.

    _images/rdf-class-hierarchy-diagram-no-prefix-classes.png
    • To zoom out of a particular class, click the Focus diagram icon.

    • To reload the data used to generate the diagram, click the Reload diagram icon. This is recommended when you have updated the data in your repository or when you are experiencing strange behavior such as a class being missing from the display.

    • To export the diagram as an .svg image, click the Export Diagram download icon.

  • You can also filter the hierarchy by graph when there is more than one named graph in your repository. To do this, expand the All graphs drop-down menu next to the toolbar options and select the graph you want to explore.

_images/rdf-class-hierarchy-filter-by-graph.png

Domain-range graph

To see all properties of a given class as well as their domain and range, double-click its class circle or the Domain-Range Graph button from the side panel. The RDF Domain-Range Graph view opens, letting you further explore the class connectedness by clicking the green object property class nodes.

_images/rdf-domain-range-graph-diagram.png
  • To administrate your graph view, use the toolbar options on the right side of the screen.

    _images/rdf-domain-range-graph-diagram-toolbar.png
    • To go back to your class in the RDF Class hierarchy, click the Back to Class hierarchy diagram button.

    • To export the diagram as an .svg image, click the Export Diagram download icon.

Class relationships

To explore the relationships between the classes, navigate to Explore ‣ Class relationships. This displays a complicated diagram, which by default shows only the top relationships. Each of them is a bundle of links between the individual instances of two classes. Each link is an RDF statement where the subject is an instance of one class, the object is an instance of another class, and the link is the predicate. Depending on the number of links between the instances of two classes, the bundle can be thicker or thinner and has the color of the class with more incoming links. These links can go in both directions. Note that contrary to the Class hierarchy, the Class relationships diagram is based on the real statements between classes and not on the ontology schema.

In the example below, we can see that “Character” is the class with the biggest number of links. It is very strongly connected to “Film” and “Species”, and most of the links are to “Character”.

_images/dependencies.png

To the left of this diagram, you can see a list of all classes ordered by the number of links they have, as well as an indicator of the direction of the links. Click it to see a list of the classes that this class links to, sorted by the number of links. The display includes the direction of the links.

_images/class-relationships-table.png

Use the add and remove icons to the right of each listed class name to control which classes are displayed in the diagram. You can remove all the classes with the X icon on the top right of the diagram. A green background behind a class name indicates that the class is present in the diagram. Above, we see that “Planet” has many more connections to “Character” than to “Species”.

_images/dependencies-add-class.png

For every pair of classes in the diagram, you can find the top predicates that connect them by clicking on the connection. The display will sort these by the number of statements using this predicate and instances of the classes.

_images/dependencies-predicates.png

Just like in the Class hierarchy view, you can also filter the class relationships by graph when there is more than one named graph in the repository. Expand the All graphs drop-down menu next to the toolbar options and select the graph you want to explore.

Note

All of these statistics are built on top of the whole repository, so when you have a lot of data, the building of the diagram may be fairly slow.

You can also use SPARQL queries to explore the class relationships of your data. For example, execute the following query from GraphDB’s SPARQL view:

PREFIX deps: <http://www.ontotext.com/plugins/dependencies#>

select ?typeSubj ?predicate ?typeObj ?count {
    _:b deps:listPredicates '' ;
        deps:fromClass ?typeSubj ;
        deps:toClass ?typeObj ;
        deps:predicate ?predicate ;
        deps:predicateCount ?count .

} order by DESC(?count) ?typeSubj ?predicate ?typeObj

This will return:

_images/class-relationships-sparql.png

Explore resources

Explore resources through the easy graph

Note

Before exploring resources from this view, make sure you have enabled the Autocomplete index for this repository from Setup ‣ Autocomplete.

Navigating to Explore ‣ Visual graph. Easy graph enables you to explore the graph of your data without using SPARQL. This displays a search input field where you can enter, using autocomplete, the IRI of a resource to use as a starting point for graph exploration.

Note

Any visual graph that a particular user creates will be available with all repositories that that user has access to.

_images/visual-graph-search.png

This displays a graph of the resource links, with all nodes of a given type having the same color. Hovering over a node displays all of its types. By default, the diagram displays the first 20 links to other resources, sorted by RDF rank if present. See the settings below to modify this limit and the types and predicates to hide or display.

_images/visual-graph-droid.png

A node’s size indicates its importance by RDF rank. Hover over a node of interest to open a menu with four options. Click the expand icon to see the links for the chosen node. (You can also expand a node by double-clicking it.)

_images/visual-graph-expand.png _images/visual-graph-expanded.png

Click a node to learn more about that resource.

_images/visual-graph-info.png

Note

The side panel includes the following:

  • labels (rdfs:label)

  • a short description (voc:desc)

  • RDF rank

Note that the information in the panel may vary depending on the data you are working with.

Clicking the node again hides the panel.

You can switch between nodes without closing the side panel. Click the new node about which you want to see more, and the side panel will automatically show the information about it.

Once a node is expanded, you can collapse it. This removes its links and their nodes except those that are also connected to other nodes, as shown in the example below. Collapsing “The Force Awakens” removes all nodes connected to it except “R2-D2” and “BB8”, because they are also linked to “Droid”, which is expanded.

_images/visual-graph-collapsed.png

If you are not interested in a node anymore, you can hide it by using the remove icon.

The focus icon is used to restart the graph with the node of interest. Use carefully, as it resets the state of the graph.

More global actions are available in the menu in the upper-right corner:

  • icon-gdb-arrow-up Go back to Visual graph home.

  • icon-gdb-search Search another resource.

  • icon-gdb-rotate-left icon-gdb-rotate-right To visually rotate your graph for convenience, use the arrows.

  • icon-gdb-pin Pin or unpin all nodes.

  • icon-gdb-save Save this as a named graph.

  • icon-gdb-settings Display the Graph settings dialog box, shown below.

_images/visual-graph-settings.png

The following settings are available:

  • Maximum links to show is the limit of links to use when you expand each node.

  • If you have labels in different languages, you can choose which labels to display with preference. The order is important in this case.

  • Include schema statements

  • Include inferred statements

  • Expand results over owl:sameAs

  • Show predicate labels is an option that you can disable for convenience when you are not interested in the predicates linking the nodes.

  • Preferred and Ignored types and predicates gives you greater control over what is included in the display of expanded nodes. If a preferred type is present, nodes of that type will be shown before all other types, like in the example below. Again, order matters when you have more than one preferred types.

Ignored types are used when you do not want to see instances of some types at all while exploring. The same is valid for predicates. Use full IRIs for types and predicates filters.

For example, add voc:film as a preferred predicate and tick the option to see only preferred predicates.

_images/add-preferred-predicate.png

Then click Save and see the change:

_images/visual-graph-preferred-predicate.png

Create your own visual graph

You can create your own custom visual graph by modifying the queries that fetch the graph data. To do this, navigate to Explore ‣ Visual Graph. In the Advanced graph section, click Create graph config.

_images/visGraphConfig.png

The configuration consists of five queries each stored in its own tab. Each tab includes sample queries to provide a model for your query. Note that some bindings are required.

  • Starting point — this is the initial state of your graph.

    • Search box: If you want this graph to offer a choice of start resources each time, start with a search box. This is similar to the initial state of the Easy graph.

    • Fixed resource: You may want to start exploration with the same resource each time. For example, select http://dbpedia.org/resource/Sofia from the autocomplete input as a start resource so that every time you open the graph you will see Sofia and its connections.

    • Graph query results: Visual graph can render a random SPARQL Graph Query result. Each result is a triple that is transformed to a link where the subject and object are shown as nodes and the predicate is a link between them.

  • Graph expansion: This is a CONSTRUCT query that determines which nodes and edges are added to the graph when the user expands an existing node. The ?node variable is required and will store the IRI of the expanded node. If empty, the Unfiltered object properties sample query will be used. Each triple from the result is visualized as an edge where the subject and object are nodes and the predicate is the link between them. If new nodes appear in the results, they are added to the graph.

  • Node basics: This SELECT query determines the basic information about a node. Some of that information affects the color and size of the node. This query is executed each time a node is added to the graph to present it correctly. The ?node variable is required and will store the IRI of the expanded node. It is a SELECT query and the following bindings are expected in the results:

    • ?type determines the color. If missing, all nodes will have the same color.

    • ?label determines the label of the node. If missing, the IRI’s local name will be used.

    • ?comment determines the description of the node. If missing, no description will be provided.

    • ?rank determines the size of the node, and must be a real number between 0 and 1. If missing, all nodes will have the same size.

  • Edge basics: This SELECT query sets the ?label binding that determines the text of the edge. If empty, the edge IRI’s local name is used.

  • Node extra: This SELECT query determines the extra properties shown for a node when the info icon is clicked. It should return two bindings: ?property and ?value. Results are then shown as a list in the sidebar.

If you leave a query empty, the first sample will be taken as a default. You can execute a query to see some of the results it will produce. Except for the samples, you will also see the queries from the other configurations in case you want to reuse some of them. The combination of all these options provides many ways for your custom visual graph to explore your data.

Save and share visual graphs

While exploring a graph, you can save a snapshot of the graph state with the Save icon in the top right to load it later. The graph configuration you are currently using is also saved, so when you load a saved graph, you can continue exploring with the same configuration.

You can share your saved graphs with other users. When security is ON in the Setup ‣ Users and Access menu, the system distinguishes between different users. The graphs that you choose to share are only editable by you.

_images/share-visual-graph.png

The graphs are located in Visual graph ‣ Saved graphs. Other users will be able to view them and copy their URLs by clicking the Get URL to graph icon. This link will also ask the user loading it whether they want GraphDB to automatically update the active repository to the same one as the saved graph.

_images/saved-graph.png

When Users and Access ‣ Free Access is ON, free access users will only see shared graphs and will not be able to save new graphs.

Embed visual graphs

GraphDB lets you embed your visual graph by adding the &embedded HTTP parameter that hides the Workbench menus (side panel, drop-down, and footer).

The following embedding options are available (substitute localhost and the 7200 port number as appropriate):

  • Start with a specific resource: http://localhost:7200/graphs-visualizations?uri=<encoded-iri>&embedded

  • Load a saved state of a specific expanded graph: http://localhost:7200/graphs-visualizations?saved=<saved-view-id>&embedded

  • Start with a custom graph configuration: http://localhost:7200/graphs-visualizations?config=<graph-config-id>&embedded

  • Start with graph query results: http://localhost:7200/graphs-visualizations?query=<encoded-sparql-query>&embedded

Note

When using embeddings, it’s best to run the Workbench in free access mode.

View and edit resources

View and add a resource

Important

Before using the View resource feature, make sure you have enabled the Autocomplete index from Setup ‣ Autocomplete.

To view a resource in the repository, go to the GraphDB home page and start typing in the Explore ‣ View resource field.

You can also use the Search RDF resource icon in the top right. This is visible in all Workbench screens.

_images/autocomplete_viewResource.png

Viewing resources provides an easy way to see triples where a given IRI is the subject, predicate, or object.

_images/view_resource_triples.png

Even when the resource is not in the database, you can still add it from the resource view. Type in the resource IRI and press Enter.

_images/create_new_resource.png _images/new_resource.png

Here, you can use the resource editor to create as many triples as you like. To add a triple, fill in the necessary fields and click on the orange tick on the right. The created triple appears, and the Predicate, Object, and Context fields are empty again for you to insert another triple if you want to do so. You can also edit or delete already created triples.

_images/new_resource_edit.png

To view the new statements in TriG format, click the View TriG button.

_images/view_resource_TriG.png

When ready, save the new resource to the repository.

Edit a resource

Once you use View resource to open a resource you can also edit it. Click the edit icon next to the resource namespace and add, change, or delete the properties of this resource.

_images/edit_existing_resource.png

Note

You cannot change or delete the inferred statements.