Principal author:
Chimezie Ogbuji

Triclops Help

Table Of Contents

1 Scope, Contexts, and BNodes in 4Suite RDF

1.1 Querying Remote Graphs

1.2 Scopes and Contexts

1.3 BNodes

2 Result Formats

2.1 Raw Versa Datatypes

2.2 Triples and Literals

2.3 Navigable RDF Diagrams (SVG or Jpeg)

3 Namespace Collapsing

4 Triclops - Long Term


Triclops is an interactive, RDF querying interface which allows users to execute Versa queries on remote and local RDF graphs. The results can be viewed in a variety of formats, two of which provide a way to interactively navigate and constrain 'views' to resources in the correponding RDF graphs. These include:

1 Scope, Contexts, and BNodes in 4Suite RDF

4Suite RDF implements RDF graph contexts as scopes and assigns temporary identifiers to Blank Nodes. There are a few things to note about how this is done as it effects the use of Triclops.

1.1 Querying Remote Graphs

Triclops is capable of executing queries against remote RDF graphs identified by a URL. It first attempts to parse the graph as Notation 3 ,then as RDF/XML if unsuccessful.

The remote graph is identified by entering it's URL in the Remote RDF Graph field. If none is specified, Triclops executes the query against the repository (Metacognition's RDF graph, in this case)

1.2 Scopes and Contexts

4Suite RDF persists RDF statements as quads with an additional attribute (the scope) which provides a context for each statement. The scope attribute can be a string of any kind but if most often populated with an appropriate URI of the RDF document from which the statements were parsed

The 4Suite Repository has a specific URI scheme for its resources and when RDF documents are parsed into the repository, the absolute ftss URI of the document is used as the scope for all the extracted statements.

So, for example, all the statements expressed within the 4Suite Repository Ontology are added to the respository RDF model within the context: ftss:///ontologies/4SuiteRepository.owl

So, in order to execute a Versa query limited to only the statements associated with the 4Suite Repository Ontology, the Scope field needs to be populated with this ftss URI.

A useful extension function (not included in the set of core Versa functions) is scope. This function takes a single resource or a list of resources and returns the scopes (contexts) that every statement made about the given resource(s) belong to. This is ofcourse redundant if a scope was specified in the original query, since every resulting statement (and hence every resulting resource) will have the same scope. For example executing scope(dc:date) against the local RDF model results in:

  • ftss:///ontologies/foaf.rdfs
  • ftss:///ontologies/dc.rdfs
Which represent the two respository RDF documents in which statements about dc:date are made (both of which are ontologies).

1.3 BNodes

It's worth noting that 4Suite RDF assigns UIDs (with a common prefix so they can be distinguished from regular resources) to blank nodes. The assignment happens at the time the RDF graph is parsed so, attempting to traverse a graph or triple by clicking on a blank node (this functionality is described below) will not have the desired effect as the UID will no longer be valid for subsequently parsed graphs.

2 Result Formats

2.1 Raw Versa Datatypes

When Triclops results are returned as Raw Versa Datatypes, they are rendered as nested ordered HTML lists (for Versa each List) and unordered lists HTML lists (for each Versa Set). Resources are displayed in Notation 3 format (QNames or URIs surrounded by angle brackets) and literals are renderd as quoted strings.

2.2 Triples and Literals

When results are returned as Triples, Triclops extracts the literals and resources and renders them in a tabular format. The statements made about each resource are rendered in grouped fashion with checkboxes next to each statement part (subject,predicate,object).

Any statement part can be selected and fed back into subsequent queries. Versa provides a means for referencing variables (bound by the host language) within query expressions. Triclops emulates the binding of variables that correspond to Versa lists of all the subjects selected ($subjects), predicates selected ($predicates), objects selected ($objects), and literals ($literals) selected. Triclops does a string substitution in place whenever it encounters these variable references. It substitutes each variable reference with an explicit Versa list consisting of the parts referenced. For example:

  • Query (against http://metacognition.info/profile/webwho.xrdf): type(foaf:Person)

  • Check 'chimezie' of the corresponding foaf:nick statement

  • Enter a new query (against the same source): type(foaf:Person)|-foaf:nick->eq($objects)

  • After substitution: type(foaf:Person)|-foaf:nick->eq(list('chimezie'))

  • This results in the blank node that represents me, rendered in a tabled, Triple format.

Subjects and predicates are rendered as links, each of which invoke a query that returns all statements with the selected subject or all statements with the selected predicate.

In addition, objects of rdfs:seeAlso and rdfs:isDefinedBy are rendered as links which (when followed) redirect back to Triclops with the objects as the Remote Graph URI and all() as the query (which will result in all the resources being returned).

2.3 Navigable RDF Diagrams (SVG or Jpeg)

Triclops can also render results as SVG/JPEG diagrams (using Graphviz for this purpose). The diagrams rendered provide links for the resource nodes, which (when clicked) resubmit an appropriate Versa query (against the same source) for the resource clicked. In this way, RDF graphs (remote and local) can be navigated through visual interaction.

Triclops renders resources that are blank nodes, typed, and have labels in a specific way. blank bodes are labeled in Notation 3 fashion: [a foo:someClass], where foo:someClass is the rdf:type associated with the blank bode. All other resources are rendered as '.. label ..' if they have a label, or with the Resource URI or QName on top and <a foo:someClass> below (where foo:someClass is the rdf:type associated with the Resource).

3 Namespace Collapsing

Triclops uses a predefined set of namespace prefix to URI mappings to expand QName references in Versa query expressions as well as collapse resource URIs in result sets. Please contact the author if you have suggestions for additional namespace prefix mappings not already defined. Clicking the 'Namespace Mappings' button brings up a summary of the exising mapping(s)

4 Triclops - Long Term

4Suite's RDF/XML parsing support is outdated and has not caught up to the latest RDF/XML specification. I intend to use rdflib's RDFXMLParser instead. 4Suite uses Sean B. Palmer's n3p Notation 3 parser, which is quite adept at fast, compliant parsing of Notation 3 documents.

I envision Triclops setup as a REST service that returns a graphical representation (SVG or JPEG depending on the HTTP Request Header) of a remote RDF subgraph.

In addition, I also envision Triclops as an appropriate endpoint for documenting arbitrary RDF vocabular terms (in the context of their defining schema/ontology).

Finally, I hope to eventually include support for SPARQL queries in addition to Versa. This is very much dependent on an ongoing effort to write some common interfaces between 4Suite RDF and rdflib