/** * The method generates the OBDAModel from an * obda or ttl (r2rml) file * @param obdaURI - the file URI * @return the generated OBDAModel * @throws IOException * @throws InvalidMappingException */ public OBDAModel getObdaModel(URI obdaURI) throws IOException, InvalidMappingException { //create empty model OBDAModel obdaModel = fac.getOBDAModel(); // System.out.println(obdaURI.toString()); if (obdaURI.toString().endsWith(".obda")) { //read obda file ModelIOManager modelIO = new ModelIOManager(obdaModel); modelIO.load(new File(obdaURI)); } else if (obdaURI.toString().endsWith(".ttl")) { //read R2RML file R2RMLReader reader = null; try { reader = new R2RMLReader(new File(obdaURI)); obdaModel = reader.readModel(obdaURI); } catch (Exception e) { e.printStackTrace(); } } return obdaModel; }
public OBDAModel loadFromOBDAFile(String obdafile) throws IOException, InvalidPredicateDeclarationException, InvalidMappingException { OBDADataFactory fac = OBDADataFactoryImpl.getInstance(); OBDAModel obdaModel = fac.getOBDAModel(); ModelIOManager ioManager = new ModelIOManager(obdaModel); ioManager.load(obdafile); return obdaModel; }
OBDAModel obdaModel = fac.getOBDAModel(); ModelIOManager ioManager = new ModelIOManager(obdaModel); ioManager.load(inputFile);
@Override public Object clone() { OBDAModel clone = dfac.getOBDAModel(); for (OBDADataSource source : datasources.values()) { clone.addSource((OBDADataSource) source.clone()); for (ArrayList<OBDAMappingAxiom> mappingList : mappings.values()) { for (OBDAMappingAxiom mapping : mappingList) { try { clone.addMapping(source.getSourceID(), (OBDAMappingAxiom) mapping.clone(), false); } catch (DuplicateMappingException e) { // Does nothing } } } } return clone; }
OBDAModel obdaModel = fac.getOBDAModel(); ModelIOManager ioManager = new ModelIOManager(obdaModel); ioManager.load(obdafile);
private int loadOBDAModel(URI uri, boolean useFile, int commit, int batch) throws OBDAException { Iterator<Assertion> assertionIter = null; QuestMaterializer materializer = null; try { OBDAModel obdaModel = OBDADataFactoryImpl.getInstance().getOBDAModel(); ModelIOManager io = new ModelIOManager(obdaModel); io.load(uri.toString()); materializer = new QuestMaterializer(obdaModel, false); assertionIter = materializer.getAssertionIterator(); int result = st.insertData(assertionIter, /*useFile,*/ commit, batch); return result; } catch (Exception e) { throw new OBDAException(e); } finally { st.close(); try { if (assertionIter != null) materializer.disconnect(); } catch (Exception e) { log.error(e.getMessage()); throw new OBDAException(e.getMessage()); } } }
OBDAModel obdaModel = fac.getOBDAModel(); ModelIOManager ioManager = new ModelIOManager(obdaModel); ioManager.load(obdafile);