Class GraphMLEventDrivenImporter

  • All Implemented Interfaces:

    public class GraphMLEventDrivenImporter
    extends BaseEventDrivenImporter<java.lang.String,​Triple<java.lang.String,​java.lang.String,​java.lang.Double>>
    implements EventDrivenImporter<java.lang.String,​Triple<java.lang.String,​java.lang.String,​java.lang.Double>>
    Imports a graph from a GraphML data source.

    For a description of the format see GraphML or the GraphML Primer.

    Below is small example of a graph in GraphML format.

     <?xml version="1.0" encoding="UTF-8"?>
     <graphml xmlns=""  
         xsi:schemaLocation=" ">
       <key id="d0" for="node""color" attr.type="string">
       <key id="d1" for="edge""weight" attr.type="double"/>
       <graph id="G" edgedefault="undirected">
         <node id="n0">
           <data key="d0">green</data>
         <node id="n1"/>
         <node id="n2">
           <data key="d0">blue</data>
         <node id="n3">
           <data key="d0">red</data>
         <node id="n4"/>
         <node id="n5">
           <data key="d0">turquoise</data>
         <edge id="e0" source="n0" target="n2">
           <data key="d1">1.0</data>
         <edge id="e1" source="n0" target="n1">
           <data key="d1">1.0</data>
         <edge id="e2" source="n1" target="n3">
           <data key="d1">2.0</data>
         <edge id="e3" source="n3" target="n2"/>
         <edge id="e4" source="n2" target="n4"/>
         <edge id="e5" source="n3" target="n5"/>
         <edge id="e6" source="n5" target="n4">
           <data key="d1">1.1</data>

    In case the corresponding edge key with"weight" is defined, the importer also reads edge weights. Otherwise edge weights are ignored.

    GraphML-Attributes Values are read as string key-value pairs and passed using vertex and edge attribute consumers.

    The importer by default validates the input using the 1.0 GraphML Schema. The user can (not recommended) disable the validation by calling setSchemaValidation(boolean).

    Dimitrios Michail
    • Constructor Detail

      • GraphMLEventDrivenImporter

        public GraphMLEventDrivenImporter()
        Constructs a new importer.
    • Method Detail

      • getEdgeWeightAttributeName

        public java.lang.String getEdgeWeightAttributeName()
        Get the attribute name for edge weights
        the attribute name
      • setEdgeWeightAttributeName

        public void setEdgeWeightAttributeName​(java.lang.String edgeWeightAttributeName)
        Set the attribute name to use for edge weights.
        edgeWeightAttributeName - the attribute name
      • isSchemaValidation

        public boolean isSchemaValidation()
        Whether the importer validates the input
        true if the importer validates the input
      • setSchemaValidation

        public void setSchemaValidation​(boolean schemaValidation)
        Set whether the importer should validate the input
        schemaValidation - value for schema validation
      • importInput

        public void importInput​( input)
        Description copied from interface: EventDrivenImporter
        Import a graph
        Specified by:
        importInput in interface EventDrivenImporter<java.lang.String,​Triple<java.lang.String,​java.lang.String,​java.lang.Double>>
        input - the input reader