rdf_graphviz.pl -- Interface to graphviz for RDF graphs
Graphviz is a general purpose graph vizualization library. Its home-page
is http://www.graphviz.org/ This module translates an RDF graph
represented as a list of rdf(S,P,O)
into a .dot file.
- gviz_write_rdf(+Stream, +Graph, +Options) is det
- Write the graph Triples to Stream in
dot
compatible format. Options:- graph_attributes(+Attributes)
- 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. - max_label_length(+Len)
- Truncate labels to Len characters. Default is 25.
Use
inf
to print the full label. - lang(+Lang)
- Lang is the language used for the labels. See resource_label/4.
- smash(+Properties)
- Smash networks connected by one of the given properties. Currently only [owl:sameAs].
- bags(Bags)
- How to handle bags. Values are
- graph
- 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
- edge_links(+Boolean)
- If
false
(defaulttrue
) do not put href atributes on edges. - wrap_url(:Goal)
- If present, URLs of the graph are replaced with the
result of
call(Goal, URL0, URL)
- edge_hook(:Goal)
- Called to define the attributes for a link as
call(Goal, URI, Attributes, Options)
. Attributes is a list of Name(Value) terms. See edge_attributes/3. - shape_hook(:Goal)
- Called to define the shape of a resource as
call(Goal, URI, Shape, Options)
. Shape is a list of Name(Value) terms. See shape/3. - bag_shape_hook(:Goal)
- Called to define the shape parameters for a bag (Table).
called as
call(Goal, Members, Shape)
Shape is a list of Name(Value) terms. - label_hook(:Goal)
- Called to define the label of a resource as
call(Goal, URI, Language, MaxLength, Label)
. Label is an atom. - target(Target)
- If present, add target=Target to all attribute lists that
have an
href
attribute. - display_lang(+Boolean)
- Display the language of literal nodes, defaults to true.
- write_graph_attributes(+List, +Out)[private]
- Write attributes for the graph as a whole
- 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.
- bagid_property(+P, -I) is semidet[private]
- True if P is of the format
_:N
, where N is a non-negative integer. - smash_graph(+GraphIn, -GraphOut, +Options)[private]
- Smash networks of equivalent properties.
- smash_on_property(+P, +GraphIn, -GraphOut)[private]
- Merge owl:sameAs nodes, replacing the node with a bag.
- 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. - gv_write_nodes(+Nodes:list(pair), +Stream, +Options)[private]
- Write information about the nodes, defining the share and label of the node.
- 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.
- bag_label(+Members, +Max, -Label, +Options) is det[private]
- Create an HTML description for describing a bag of objects.
- 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 directoryweb/icons
of a package. - 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)
- write_attributes(+Attributes:list, +Out:stream) is det[private]
- Write attribute values. We define some special attributes:
- html(HTML)
- Emit as label=<HTML>
- filter_attributes(+AllAttrs, +Element, -ForElement, -Rest) is det[private]
- gv_attr(?AttrName, ?Element, ?Type) is nondet[private]
- Name and type-declarations for GraphViz attributes. Types are defined my must_be/2.
- 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? - bag_shape(+Members, -BagShape, +Options) is det[private]
- Compute parameters for a bag of resources.
- 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.
- through the option
- edge_attributes(+Triple, -Attributes, +Options) is det[private]
- cached_image_in_svg(+Request)[private]
- HTTP handler to serve an image we have included in an SVG file.