This documentation covers the latest release of VIVO, version 1.10.x.
If you are able to help contribute to this documentation, please contact
sysadmin at duraspace dot org
Looking for another version? See all documentation.
Triple Pattern Fragments is a form of Linked Data Fragments (see References) for querying a triple store to retrieve a set of triples matching a specified pattern. The pattern is always of the form subject predicate object, where any or all of the elements of the pattern may be unspecified, that is, wildcards.
SPARQL and Linked Data Fragments, alternatives to Triple Pattern Fragments, are very powerful, and as a result, can generate queries that take a long time to run, slowing the server, and in some cases, making the server unavailable. This results in sites shutting down their access points for fear of losing availability to long-running queries. Triple Pattern Fragments solves this problem by allowing only one kind of query, the pattern. Pattern matching is indexed and very fast, insuring the servers remain available while handling queries.
For example the pattern <uri> * * finds all the triples which have the specified URI as a subject. The pattern * <uri> * finds all the triples with the specified predicate, and * * <uri> finds all the triples with the specified object.
Triple pattern fragments is a very fast, very simple means for querying a triple store. The triple pattern fragments API in VIVO puts little load on the server, providing a simple means for getting data from the triple store. The API has a web interface for manual use, can be used from the command line via curl, and can be used by programs. Each mode of usage is described below.
Triple Pattern Fragments, as delivered in VIVO, is an open API. This means that anyone, and any software can access the Triple Pattern Fragments endpoint of your VIVO without logging on, that is, without authorization. All the data in your full graph is accessible to the API and to those who use it. VIVO is built for data sharing, and the Triple Pattern Fragments API makes it very easy for your VIVO to share data with others. Please be sure your VIVO does not contain restricted data that should not be shared with others
VIVO uses the LinkedDataFragments Server, available on GitHub here: https://github.com/LinkedDataFragments/Server.Java
Manual query can be used to view triples, and to run SPARQL queries resolved as Triple Pattern Fragments. These methods are view data. To save data, use curl, or Programmatic Access.
To use TPF manually, visit the TPF endpoint of a VIVO, http://yourvivo/tpf/core, where "yourvivo" is the web address of the VIVO of interest. In the example below we use http://openvivo.org/tpf/core. You will see:
Notice that results are returned for the triple pattern fragment * * *. More than 5 million triples were returned, with the first hundred being displayed on the web page. Pressing "next" at the top of the list of triples will display the next hundred triples. Each of the rows in the display is a triple in the full graph. The TPF web page uses a display with simplifies the presentation of URI. Many of the URI are shortened, not with the use of prefixes, but merely by intelligently truncating the URI.
Each of the elements in each of the triples is a link. Clicking a link will issue a TPF query with the selected element as the specified value in a triple. For example, clicking on "Tokyo" in the example above, generates a TPF request of the form * * "Tokyo" – that is, find all the triples that have the text string "Tokyo" as an object. The result is shown below:
We see that OpenVIVO has 601 triples with "Tokyo" as an object. The displayed triples show Tokyo as a locality in an address. Putting double quotes around literal values is required. TPF supports the use of language tags to select literal values with specific language tags.
To specify a URI in a pattern, give the full URI (no prefix, no truncation) with no brackets. For example, to find all the triples with a subject of http://openvivo.org/a/orcid0000-0002-1304-8447, put the URI in the subject field and leave predicate field and the object field empty. See below:
199 triples are returned. Each has the specified subject. Data managers might note:
We see 102 triples are returned. Each indicates that the person is relatedBy to something else. We see some of the objects appear to be figshare related, others appear to be authorships, while still others non informative. Additional exploration might help us understand how the relatedBy assertions are used.
The Linked Data Fragments server can also resolve full SPARQL queries. The queries are decomposed into a series of TPF requests behind the scenes in the browser. The VIVO server sees only TPF requests. Each TPF request is handled quickly as previously described. To issue a SPARQL query using Triple Pattern Fragments, go to http://yourvivo/tpf where "yourvivo" is the web address of your VIVO. You will see a screen such as that below. Type in your query. You will need to provide the prefixes used in your query, as shown below. Press Execute, and the query is resolved a series of TPF queries. Results are presented dynamically.
To try this yourself, you can use the Linked Data Fragments Server of OpenVIVO, available here: http://openvivo.org/tpf
Note in the example that prefixes are supplied as part of the query. The Triple Pattern Fragments server has no knowledge of VIVO prefixes. These must be supplied with the query.
curl can be used to issue triple pattern fragment queries and return RDF/XML. For example:
returns 169 lines of RDF/XML, output truncated below
The following IRI patterns are valid for making TPF requests from curl or from software (see below).
Returns an RD/XML document containing the first 100 triples regarding the specified subject.
Headers can be used to specify the output format.
Which returns 166 triples as of this writing.