Package 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".-
Nested Class Summary
Nested classes/interfaces inherited from class org.graphstream.stream.SourceBase
SourceBase.ElementType -
Constructor Summary
Constructors Constructor Description FileSourceGML() -
Method Summary
Modifier and Type Method Description ParserFactorygetNewParserFactory()Get a new parser factory.booleannextStep()Since there is no step in DOT, this does the same action thanFileSourceParser.nextEvents().Methods inherited from class org.graphstream.stream.file.FileSourceParser
begin, begin, begin, begin, end, nextEvents, readAll, readAll, readAll, readAllMethods 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, sendStepBeginsMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.graphstream.stream.Source
addAttributeSink, addElementSink, addSink, clearAttributeSinks, clearElementSinks, clearSinks, removeAttributeSink, removeElementSink, removeSink
-
Constructor Details
-
FileSourceGML
public FileSourceGML()
-
-
Method Details
-
nextStep
Description copied from class:FileSourceParserSince there is no step in DOT, this does the same action thanFileSourceParser.nextEvents().- Specified by:
nextStepin interfaceFileSource- Overrides:
nextStepin classFileSourceParser- 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
Description copied from class:FileSourceParserGet a new parser factory.- Specified by:
getNewParserFactoryin classFileSourceParser- Returns:
- a parser factory
-