@Override public boolean isValid() { if (uri == null) { return false; } for (GDataConf dataFile : data) { if (!dataFile.isValid()) { return false; } } for (GAction action : actions) { if (!action.isValid()) { return false; } } return true; }
/** * Build the graph considering the given configuration. * * @param graphConf the graph configuration * @return the graph which as been build form the configuration * * @throws SLIB_Exception */ public static G load(GraphConf graphConf) throws SLIB_Exception { logger.info("Loading Graph " + graphConf.getUri()); G g = createGraph(graphConf.getUri()); return load(graphConf, g); }
@Override public void populate(GDataConf conf, G g) throws SLIB_Exception { logger.info("-------------------------------------"); logger.info("Loading Annotations using TSV loader."); logger.info("-------------------------------------"); this.g = g; loadConf(conf); loadTSV(conf.getLoc()); logger.info("TSV specification loaded."); logger.info("-------------------------------------"); }
public static void main(String[] args) throws SLIB_Exception { String dataloc = "/data/WordNet/WordNet-3.1/dict/"; // We create the graph URIFactory factory = URIFactoryMemory.getSingleton(); URI guri = factory.getURI("http://graph/wordnet/"); G wordnet = new GraphMemory(guri); // We load the data into the graph GraphLoader_Wordnet_Full loader = new GraphLoader_Wordnet_Full(); GDataConf dataNoun = new GDataConf(GFormat.WORDNET_DATA, dataloc + "data.noun"); GDataConf dataVerb = new GDataConf(GFormat.WORDNET_DATA, dataloc + "data.verb"); GDataConf dataAdj = new GDataConf(GFormat.WORDNET_DATA, dataloc + "data.adj"); GDataConf dataAdv = new GDataConf(GFormat.WORDNET_DATA, dataloc + "data.adv"); loader.populate(dataNoun, wordnet); loader.populate(dataVerb, wordnet); loader.populate(dataAdj, wordnet); loader.populate(dataAdv, wordnet); } }
@Override public void populate(GDataConf conf, G g) throws SLIB_Exception { String defaultNamespaceVal = (String) conf.getParameter("default-namespace"); if (defaultNamespaceVal == null) { defaultNamespace = g.getURI().getNamespace(); logger.info("OBO loader set default-namespace " + defaultNamespace); } else { defaultNamespace = defaultNamespaceVal; } init(g, conf.getLoc(), defaultNamespace); logger.info("-------------------------------------"); logger.info("Loading OBO specification from:" + filepath); logger.info("-------------------------------------"); loadOboSpec(); logger.info("OBO specification loaded."); logger.info("-------------------------------------"); }
/** * Impact the given graph considering the given configuration. The graph * will be populated by the data and actions will be performed on it if any * exist. * * * @param graphConf the graph configuration * @param g the graph * @return the graph which as been build form the configuration * * @throws SLIB_Exception */ public static G load(GraphConf graphConf, G g) throws SLIB_Exception { logger.info("-------------------------------------"); logger.info(" Loading DATA"); logger.info("-------------------------------------"); for (GDataConf dataConf : graphConf.getData()) { populate(dataConf, g); } URIFactory factory = URIFactoryMemory.getSingleton(); GraphActionExecutor.applyActions(factory, graphConf.getActions(), g); return g; }
private void loadConf(GDataConf conf) throws SLIB_Ex_Critic { GFormat format = conf.getFormat(); if (format == GFormat.RDF_XML) { buildRDFparser(RDFFormat.RDFXML); } else if (format == GFormat.NTRIPLES) { buildRDFparser(RDFFormat.NTRIPLES); } else if (format == GFormat.TURTLE) { buildRDFparser(RDFFormat.TURTLE); } else { throw new SLIB_Ex_Critic("Unsupported RDF format " + format); } }
public static void main(String[] args) throws Exception { URIFactoryMemory factory = URIFactoryMemory.getSingleton(); G graph = new GraphMemory(factory.getURI("http://mesh")); GraphLoader_MESH_XML loader = new GraphLoader_MESH_XML(); loader.populate(new GDataConf(GFormat.MESH_XML, "/data/mesh/desc2013.xml"), graph); URI dna_barcoding = factory.getURI("http://D058893"); System.out.println(graph); System.out.println(graph.containsVertex(dna_barcoding)); } }
@Override public void populate(GDataConf conf, G g) throws SLIB_Exception { logger.info("-------------------------------------"); logger.info("Loading CSV."); logger.info("-------------------------------------"); this.g = g; loadConf(conf); loadCSV(conf.getLoc()); logger.info("CSV specification loaded."); logger.info("-------------------------------------"); }
@Override public void populate(GDataConf conf, G g) throws SLIB_Exception { String defaultNamespaceVal = (String) conf.getParameter("default-namespace"); if (defaultNamespaceVal == null) { defaultNamespace = g.getURI().getNamespace(); logger.info("OBO loader set default-namespace " + defaultNamespace); } else { defaultNamespace = defaultNamespaceVal; } init(g, conf.getLoc(), defaultNamespace); logger.info("-------------------------------------"); logger.info("Loading OBO specification from:" + filepath); logger.info("-------------------------------------"); loadOboSpec(); logger.info("OBO specification loaded."); logger.info("-------------------------------------"); }
private void loadConf(GDataConf conf) throws SLIB_Ex_Critic { GFormat format = conf.getFormat(); if (format == GFormat.RDF_XML) { buildRDFparser(RDFFormat.RDFXML); } else if (format == GFormat.NTRIPLES) { buildRDFparser(RDFFormat.NTRIPLES); } else if (format == GFormat.TURTLE) { buildRDFparser(RDFFormat.TURTLE); } else { throw new SLIB_Ex_Critic("Unsupported RDF format " + format); } }
@Override public boolean isValid() { if (uri == null) { return false; } for (GDataConf dataFile : data) { if (!dataFile.isValid()) { return false; } } for (GAction action : actions) { if (!action.isValid()) { return false; } } return true; }
/** * Build the graph considering the given configuration. * * @param graphConf the graph configuration * @return the graph which as been build form the configuration * * @throws SLIB_Exception */ public static G load(GraphConf graphConf) throws SLIB_Exception { logger.info("Loading Graph " + graphConf.getUri()); G g = createGraph(graphConf.getUri()); return load(graphConf, g); }
public static void main(String[] args) throws Exception { URIFactoryMemory factory = URIFactoryMemory.getSingleton(); G graph = new GraphMemory(factory.getURI("http://mesh")); GraphLoader_MESH_XML loader = new GraphLoader_MESH_XML(); loader.populate(new GDataConf(GFormat.MESH_XML, "/data/mesh/desc2013.xml"), graph); URI dna_barcoding = factory.getURI("http://D058893"); System.out.println(graph); System.out.println(graph.containsVertex(dna_barcoding)); } }
@Override public void populate(GDataConf conf, G g) throws SLIB_Exception { logger.info("-------------------------------------"); logger.info("Loading Annotations using TSV loader."); logger.info("-------------------------------------"); this.g = g; loadConf(conf); loadTSV(conf.getLoc()); logger.info("TSV specification loaded."); logger.info("-------------------------------------"); }
@Override public void populate(GDataConf conf, G g) throws SLIB_Exception { logger.info("-------------------------------------"); logger.info("Loading CSV."); logger.info("-------------------------------------"); this.g = g; loadConf(conf); loadCSV(conf.getLoc()); logger.info("CSV specification loaded."); logger.info("-------------------------------------"); }
@Override public void populate(GDataConf conf, G g) throws SLIB_Exception { loadConf(conf); logger.info("-------------------------------------"); logger.info(" RDF Loader"); logger.info("-------------------------------------"); logger.info("Populate graph " + g.getURI() + " from " + conf.getLoc()); load(g, conf.getLoc()); logger.info("Graph " + g.getURI() + " populated by RDF data "); logger.info("-------------------------------------"); }
@Override public void populate(GDataConf conf, G g) throws SLIB_Exception { loadConf(conf); logger.info("-------------------------------------"); logger.info(" RDF Loader"); logger.info("-------------------------------------"); logger.info("Populate graph " + g.getURI() + " from " + conf.getLoc()); load(g, conf.getLoc()); logger.info("Graph " + g.getURI() + " populated by RDF data "); logger.info("-------------------------------------"); }
/** * Populate a given graph considering a configuration. * * @param dataConf the object defining the configuration of the data to load * @param g the graph to populate with the data * @return the graph which have been populated. The treatment is performed * in place, i.e. no extra graph is created and the reference to the graph * returned will be the same as the one passed in parameter. * * @throws SLIB_Exception if an error is encountered during loading. */ public static G populate(GDataConf dataConf, G g) throws SLIB_Exception { logger.debug("Populate " + g.getURI() + " based on " + dataConf.getLoc()); GraphLoader gLoader = getLoader(dataConf); gLoader.populate(dataConf, g); return g; }
/** * Populate a given graph considering a configuration. * * @param dataConf the object defining the configuration of the data to load * @param g the graph to populate with the data * @return the graph which have been populated. The treatment is performed * in place, i.e. no extra graph is created and the reference to the graph * returned will be the same as the one passed in parameter. * * @throws SLIB_Exception if an error is encountered during loading. */ public static G populate(GDataConf dataConf, G g) throws SLIB_Exception { logger.debug("Populate " + g.getURI() + " based on " + dataConf.getLoc()); GraphLoader gLoader = getLoader(dataConf); gLoader.populate(dataConf, g); return g; }