org.graphstream.stream.file
Class FileSourceGML
java.lang.Object
org.graphstream.stream.SourceBase
org.graphstream.stream.file.FileSourceParser
org.graphstream.stream.file.FileSourceGML
- All Implemented Interfaces:
- FileSource, Source
public class FileSourceGML
- extends FileSourceParser
A GML parser.
This parser should understand the whole GML syntax. It transforms any
unknown tag into an attribute. Depending on the location of the unknown
tag, the attribute is added to the graph, to nodes or to the edges.
The "graphics" attributes are, as far as possible, transformed into
"ui.style" attributes that are merged with the style sheet. The understood
graphics tags are "x", "y", "z", "w", "h", "d" for position and size,
"fill" for the background color (becomes "fill-color"), "outline" (becomes
"stroke-color"), "type" (becomes "shape", the known shapes being
the ones of the GraphStream CSS, plus the "ellipse" tag wich maps
to "circle" and the "rectangle" tag that maps to "box"), "outline_width" (becomes
"stroke-width", in pixels).
If edges have no "id" tag, the id is the concatenation of the source
and target node identifiers separated by a "_" character and a random
number.
You can declare nodes either with the full declaration:
node [ Id "foo" ]
Which is useful when adding attributes to it. Or you can use a lighter
declaration with:
node "foo"
You can also remove nodes and edges by using:
-node "foo"
del-node "foo"
-node [ Id "foo" ]
del-node [ Id "foo" ]
And the same for edges with "-edge" or "del-edge".
All the dynamic events of GraphStream are supported as an extension.
You can add or remove attributes to or from a node or edge using a
minus sign in front of the attribute name and following the attribute
name by [].
You can remove a node or edge using a minus sign in front of the
node and edge tags:
-node [ id "foo" ]
Or
-node "foo"
You can change the attributes of a node or edge using a plus sign
in front of the node and edge tags:
+node [ id "foo" someAttribute "added" -removedAttribute [] ]
Be careful, that files exported with the dynamic extensions will not
be compatible with most GML readers of other programs.
The standard extension for GML files is ".gml". If your file contains
dynamic additions, you can use the ".dgml" (Dynamic GML) extensions.
The parser will handle both dynamic and non dynamic files with the
extension ".gml".
Methods inherited from class org.graphstream.stream.SourceBase |
addAttributeSink, addElementSink, addSink, attributeSinks, clearAttributeSinks, clearElementSinks, clearSinks, elementSinks, removeAttributeSink, removeElementSink, removeSink, sendAttributeChangedEvent, sendAttributeChangedEvent, sendEdgeAdded, sendEdgeAdded, sendEdgeAttributeAdded, sendEdgeAttributeAdded, sendEdgeAttributeChanged, sendEdgeAttributeChanged, sendEdgeAttributeRemoved, sendEdgeAttributeRemoved, sendEdgeRemoved, sendEdgeRemoved, sendGraphAttributeAdded, sendGraphAttributeAdded, sendGraphAttributeChanged, sendGraphAttributeChanged, sendGraphAttributeRemoved, sendGraphAttributeRemoved, sendGraphCleared, sendGraphCleared, sendNodeAdded, sendNodeAdded, sendNodeAttributeAdded, sendNodeAttributeAdded, sendNodeAttributeChanged, sendNodeAttributeChanged, sendNodeAttributeRemoved, sendNodeAttributeRemoved, sendNodeRemoved, sendNodeRemoved, sendStepBegins, sendStepBegins |
FileSourceGML
public FileSourceGML()
nextStep
public boolean nextStep()
throws IOException
- Description copied from class:
FileSourceParser
- Since there is no step in DOT, this does the same action than
FileSourceParser.nextEvents()
.
- Specified by:
nextStep
in interface FileSource
- Overrides:
nextStep
in class FileSourceParser
- Returns:
- true if there are still events to read, false as soon as the file
is finished.
- Throws:
IOException
- If an I/O error occurs while reading.
getNewParserFactory
public ParserFactory getNewParserFactory()
- Description copied from class:
FileSourceParser
- Get a new parser factory.
- Specified by:
getNewParserFactory
in class FileSourceParser
- Returns:
- a parser factory
Copyright © 2012. All Rights Reserved.