All predicatesShow -- Interface to graphviz for RDF graphs

Graphviz is a general purpose graph vizualization library. Its home-page is This module translates an RDF graph represented as a list of rdf(S,P,O) into a .dot file.

- Jan Wielemaker
Source gviz_write_rdf(+Stream, +Graph, +Options) is det
Write the graph Triples to Stream in dot compatible format. Options:
Additional overall graphs attributes for dot. Each attribute is of the format Name(Value) and written as Name="Value". The term size(W,H) is accepted as well.
Truncate labels to Len characters. Default is 25. Use inf to print the full label.
Lang is the language used for the labels. See resource_label/4.
Smash networks connected by one of the given properties. Currently only [owl:sameAs].
How to handle bags. Values are
Show as normal nodes (i.e. handles as normal RDF)
merge(Shape, Max)
Put the members in a dot node using Shape. Only place the first Max members and add a note stating '... showing N of M' to indicate the actual number
If false (default true) do not put href atributes on edges.
If present, URLs of the graph are replaced with the result of call(Goal, URL0, URL)
Called to define the shape of a resource as call(Goal, URI, Shape). Shape is a list of Name(Value) terms. See shape/3.
Called to define the shape parameters for a bag (Table). called as call(Goal, Members, Shape) Shape is a list of Name(Value) terms.
Called to define the label of a resource as call(Goal, URI, Language, MaxLength, Label). Label is an atom.
If present, add target=Target to all attribute lists that have an href attribute.
Display the language of literal nodes, defaults to true.
Source write_graph_attributes(+List, +Out)[private]
Write attributes for the graph as a whole
Source combine_bags(+Graph, -Triples, -Bags, +Options) is det[private]
Seperate the bags from the graph. Triples represent the remaining graph (in which a bag is a single node) and Bags is an assoc BagID-Members storing the members of the bags.
Source bagid_property(+P, -I) is semidet[private]
True if P is of the format _:N, where N is a non-negative integer.
Source smash_graph(+GraphIn, -GraphOut, +Options)[private]
Smash networks of equivalent properties.
Source smash_on_property(+P, +GraphIn, -GraphOut)[private]
Merge owl:sameAs nodes, replacing the node with a bag.
Source gv_write_edges(+Graph, -Done, +Stream, +Options) is det[private]
Write the edges of an RDF graph in dot format. It invents a dot identifier for each node as it processes the nodes. The mapping from node to dot identifier is returned in the assoc Done.
Source gv_write_nodes(+Nodes:list(pair), +Stream, +Options)[private]
Write information about the nodes, defining the share and label of the node.
Source write_node_attributes(+RDF, +Stream, +Options) is det[private]
Write attributes for an RDF node. The node identifier matching the declared edges is alreadu written to Stream.
Source bag_label(+Members, +Max, -Label, +Options) is det[private]
Create an HTML description for describing a bag of objects.
Max- is the maximum # members to show. If there are more, a text "... showing N of M" is displayed.
Label- is a Prolog packed string with HTML text.
Source write_image_node(+ImgAttrs, +Attrs, +Stream, +Options) is det[private]
Render a node using an image. The image location is either an external URL or a local file specification using the notation icons(File), a term that must resolve in an image file using absolute_file_name/3. In the default setup, this means that the image must be in the directory web/icons of a package.
Source resource_label(+Resource, -Label:atom, +Options) is det[private]
Label is the textual label to show for Resource. Process the options
  • lang(+Lang)
  • max_label_length(+Len)
Source write_attributes(+Attributes:list, +Out:stream) is det[private]
Write attribute values. We define some special attributes:
Emit as label=<HTML>
Source filter_attributes(+AllAttrs, +Element, -ForElement, -Rest) is det[private]
Source gv_attr(?AttrName, ?Element, ?Type) is nondet[private]
Name and type-declarations for GraphViz attributes. Types are defined my must_be/2.
See also
Source cstring(+Codes)//[private]
Create a C-string. Normally dot appears to be using UTF-8 encoding. Would there be a safer way to transport non-ascii characters, such as \uXXXX?
Source bag_shape(+Members, -BagShape, +Options) is det[private]
Compute parameters for a bag of resources.
Source shape(+Resource, -Attributes, +Options) is det[private]
Shape is the shape of the node to use for Resource. Shapes can be modified in two ways:
  • through the option shape_hook(Closure), which must return a valid Attributes list for GraphViz
  • By addings sub-properties of graphviz:styleParameter to the class of the resource. The value of this property defines the attribute value, while the label defines the attribute-name.
Source cached_image_in_svg(+Request)[private]
HTTP handler to serve an image we have included in an SVG file.
To be done
- Should we restrict files served to files that are part of recently served SVG files?