Visualize and explore¶
What’s in this document?
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 . 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.
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.
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:
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.
To administrate your data view, use the toolbar options on the right side of the screen.
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.
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
.svgimage, 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.
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.
Class relationships¶
To explore the relationships between the classes, navigate to . 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”.
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.
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”.
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.
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:
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 .
Navigating to . 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.
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.
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.)
Click a node to learn more about that resource.
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.
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:
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.
Then click Save and see the change:
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 . In the Advanced graph section, click Create graph config.
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
CONSTRUCTquery that determines which nodes and edges are added to the graph when the user expands an existing node. The?nodevariable 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
SELECTquery 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?nodevariable is required and will store the IRI of the expanded node. It is aSELECTquery and the following bindings are expected in the results:?typedetermines the color. If missing, all nodes will have the same color.?labeldetermines the label of the node. If missing, the IRI’s local name will be used.?commentdetermines the description of the node. If missing, no description will be provided.?rankdetermines 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
SELECTquery sets the?labelbinding that determines the text of the edge. If empty, the edge IRI’s local name is used.Node extra: This
SELECTquery determines the extra properties shown for a node when the info icon is clicked. It should return two bindings:?propertyand?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.
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>&embeddedLoad a saved state of a specific expanded graph:
http://localhost:7200/graphs-visualizations?saved=<saved-view-id>&embeddedStart with a custom graph configuration:
http://localhost:7200/graphs-visualizations?config=<graph-config-id>&embeddedStart 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 .
To view a resource in the repository, go to the GraphDB home page and start typing in the field.
You can also use the Search RDF resource icon in the top right. This is visible in all Workbench screens.
Viewing resources provides an easy way to see triples where a given IRI is the subject, predicate, or object.
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.
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.
To view the new statements in TriG format, click the View TriG button.
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.
Note
You cannot change or delete the inferred statements.


