// Path: bionetdb-core/src/main/java/org/opencb/bionetdb/core/models/network/Network.java
// public class Network extends Graph {
// 
//     private String id;
//     private String name;
//     private String description;
// 
//     private Map<String, Object> attributes;
// 
//     private long numNodes;
//     private long numRelations;
// 
//     public Network() {
//         this("", "", "");
//     }
// 
//     public Network(String id, String name, String description) {
//         super();
//         this.id = id;
//         this.name = name;
//         this.description = description;
// 
//         attributes = new HashMap<>();
//     }
// 
//     public void write(File file) throws FileNotFoundException, JsonProcessingException {
//         Network network = new Network(id, name, description);
//         network.setAttributes(attributes);
//         network.setNumNodes(nodes.size());
//         network.setNumRelations(relations.size());
// 
//         ObjectMapper mapper = new ObjectMapper();
//         mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
//         mapper.configure(MapperFeature.REQUIRE_SETTERS_FOR_GETTERS, true);
// 
//         PrintWriter pw = new PrintWriter(file);
// 
//         pw.println(mapper.writer().writeValueAsString(network));
//         for (Node node: nodes) {
//             pw.println(mapper.writer().writeValueAsString(node));
//         }
//         for (Relation relation: relations) {
//             pw.println(mapper.writer().writeValueAsString(relation));
//         }
// 
//         pw.close();
// 
// 
//     }
// 
// 
//     @Override
//     public String toString() {
//         final StringBuilder sb = new StringBuilder("Network{");
//         sb.append("id='").append(id).append('\'');
//         sb.append(", name='").append(name).append('\'');
//         sb.append(", description='").append(description).append('\'');
//         sb.append(", nodes=").append(nodes);
//         sb.append(", relations=").append(relations);
//         sb.append(", attributes=").append(attributes);
//         sb.append('}');
//         return sb.toString();
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     public Network setId(String id) {
//         this.id = id;
//         return this;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public Network setName(String name) {
//         this.name = name;
//         return this;
//     }
// 
//     public String getDescription() {
//         return description;
//     }
// 
//     public Network setDescription(String description) {
//         this.description = description;
//         return this;
//     }
// 
//     public Map<String, Object> getAttributes() {
//         return attributes;
//     }
// 
//     public Network setAttributes(Map<String, Object> attributes) {
//         this.attributes = attributes;
//         return this;
//     }
// 
//     public Network setNumNodes(long numNodes) {
//         this.numNodes = numNodes;
//         return this;
//     }
// 
//     public Network setNumRelations(long numRelations) {
//         this.numRelations = numRelations;
//         return this;
//     }
// }


import org.opencb.bionetdb.core.models.network.Network;
import java.io.IOException;
import java.nio.file.Path;
package org.opencb.bionetdb.core.io;

//import org.sbml.libsbml.*;
//import org.sbml.libsbml.Reaction;

//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.Collections;
//import java.util.List;
//import java.util.regex.Matcher;
//import java.util.regex.Pattern;


/**
 * Created by imedina on 12/08/15.
 */
public class SbmlParser {

    /**
     * The following static block is needed in order to load the
     * libSBML Java interface library when the application starts.
     */
    static {
        try {
            System.loadLibrary("sbmlj");
            // For extra safety, check that the jar file is in the classpath.
            Class.forName("org.sbml.libsbml.libsbml");
        } catch (UnsatisfiedLinkError e) {
            System.err.println("Error encountered while attempting to load libSBML:");
            System.err.println("Please check the value of your "
                    + (System.getProperty("os.name").startsWith("Mac OS")
                    ? "DYLD_LIBRARY_PATH" : "LD_LIBRARY_PATH")
                    + " environment variable and/or your"
                    + " 'java.library.path' system property (depending on"
                    + " which one you are using) to make sure it list the"
                    + " directories needed to find the "
                    + System.mapLibraryName("sbmlj") + " library file and"
                    + " libraries it depends upon (e.g., the XML parser).");
            System.exit(1);
        } catch (ClassNotFoundException e) {
            System.err.println("Error: unable to load the file 'libsbmlj.jar'."
                    + " It is likely that your -classpath command line "
                    + " setting or your CLASSPATH environment variable "
                    + " do not include the file 'libsbmlj.jar'.");
            e.printStackTrace();
            System.exit(1);
        } catch (SecurityException e) {
// Path: bionetdb-core/src/main/java/org/opencb/bionetdb/core/models/network/Network.java
// public class Network extends Graph {
// 
//     private String id;
//     private String name;
//     private String description;
// 
//     private Map<String, Object> attributes;
// 
//     private long numNodes;
//     private long numRelations;
// 
//     public Network() {
//         this("", "", "");
//     }
// 
//     public Network(String id, String name, String description) {
//         super();
//         this.id = id;
//         this.name = name;
//         this.description = description;
// 
//         attributes = new HashMap<>();
//     }
// 
//     public void write(File file) throws FileNotFoundException, JsonProcessingException {
//         Network network = new Network(id, name, description);
//         network.setAttributes(attributes);
//         network.setNumNodes(nodes.size());
//         network.setNumRelations(relations.size());
// 
//         ObjectMapper mapper = new ObjectMapper();
//         mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
//         mapper.configure(MapperFeature.REQUIRE_SETTERS_FOR_GETTERS, true);
// 
//         PrintWriter pw = new PrintWriter(file);
// 
//         pw.println(mapper.writer().writeValueAsString(network));
//         for (Node node: nodes) {
//             pw.println(mapper.writer().writeValueAsString(node));
//         }
//         for (Relation relation: relations) {
//             pw.println(mapper.writer().writeValueAsString(relation));
//         }
// 
//         pw.close();
// 
// 
//     }
// 
// 
//     @Override
//     public String toString() {
//         final StringBuilder sb = new StringBuilder("Network{");
//         sb.append("id='").append(id).append('\'');
//         sb.append(", name='").append(name).append('\'');
//         sb.append(", description='").append(description).append('\'');
//         sb.append(", nodes=").append(nodes);
//         sb.append(", relations=").append(relations);
//         sb.append(", attributes=").append(attributes);
//         sb.append('}');
//         return sb.toString();
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     public Network setId(String id) {
//         this.id = id;
//         return this;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public Network setName(String name) {
//         this.name = name;
//         return this;
//     }
// 
//     public String getDescription() {
//         return description;
//     }
// 
//     public Network setDescription(String description) {
//         this.description = description;
//         return this;
//     }
// 
//     public Map<String, Object> getAttributes() {
//         return attributes;
//     }
// 
//     public Network setAttributes(Map<String, Object> attributes) {
//         this.attributes = attributes;
//         return this;
//     }
// 
//     public Network setNumNodes(long numNodes) {
//         this.numNodes = numNodes;
//         return this;
//     }
// 
//     public Network setNumRelations(long numRelations) {
//         this.numRelations = numRelations;
//         return this;
//     }
// }


// Path: bionetdb-core/src/main/java/org/opencb/bionetdb/core/io/SbmlParser.java
import org.opencb.bionetdb.core.models.network.Network;
import java.io.IOException;
import java.nio.file.Path;

package org.opencb.bionetdb.core.io;

//import org.sbml.libsbml.*;
//import org.sbml.libsbml.Reaction;

//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.Collections;
//import java.util.List;
//import java.util.regex.Matcher;
//import java.util.regex.Pattern;


/**
 * Created by imedina on 12/08/15.
 */
public class SbmlParser {

    /**
     * The following static block is needed in order to load the
     * libSBML Java interface library when the application starts.
     */
    static {
        try {
            System.loadLibrary("sbmlj");
            // For extra safety, check that the jar file is in the classpath.
            Class.forName("org.sbml.libsbml.libsbml");
        } catch (UnsatisfiedLinkError e) {
            System.err.println("Error encountered while attempting to load libSBML:");
            System.err.println("Please check the value of your "
                    + (System.getProperty("os.name").startsWith("Mac OS")
                    ? "DYLD_LIBRARY_PATH" : "LD_LIBRARY_PATH")
                    + " environment variable and/or your"
                    + " 'java.library.path' system property (depending on"
                    + " which one you are using) to make sure it list the"
                    + " directories needed to find the "
                    + System.mapLibraryName("sbmlj") + " library file and"
                    + " libraries it depends upon (e.g., the XML parser).");
            System.exit(1);
        } catch (ClassNotFoundException e) {
            System.err.println("Error: unable to load the file 'libsbmlj.jar'."
                    + " It is likely that your -classpath command line "
                    + " setting or your CLASSPATH environment variable "
                    + " do not include the file 'libsbmlj.jar'.");
            e.printStackTrace();
            System.exit(1);
        } catch (SecurityException e) {
            System.err.println("Error encountered while attempting to load libSBML:");