static Model readModel(String filename) { String fn = DIR + "/" + filename ; Model m = RDFDataMgr.loadModel(fn) ; return m ; } }
@Override public void run() { try { Model model = RDFDataMgr.loadModel(new File(inputMappingFile).toURI().toString(), Lang.TURTLE); OutputStream out = new FileOutputStream(outputMappingFile); RDFDataMgr.write(out, model, RDFFormat.TURTLE_PRETTY) ; } catch (FileNotFoundException e) { e.printStackTrace(); } } }
/** * Core function: Loads all test suites fro m the given resource * * @param baseFile * @return * @throws IOException */ public static List<Resource> loadTestSuites(String baseFile) throws IOException { Model testSuitesModel = RDFDataMgr.loadModel(baseFile); List<Resource> result = loadTestSuites(testSuitesModel, baseFile); return result; }
/** * Core function: Loads all test suites fro m the given resource * * @param baseFile * @return * @throws IOException */ public static List<Resource> loadTestSuites(String baseFile) throws IOException { Model testSuitesModel = RDFDataMgr.loadModel(baseFile); List<Resource> result = loadTestSuites(testSuitesModel, baseFile); return result; }
private static void loadThroughJena2(String in, String out) throws FileNotFoundException { Model model = RDFDataMgr.loadModel("file://"+in); System.out.println("ltj; size:"+model.size()); model.write(new FileOutputStream(out)); }
public static Model readAssemblerFile(String assemblerFile) { Model spec = null ; try { spec = RDFDataMgr.loadModel(assemblerFile) ; } catch (Exception ex) { throw new ARQException("Failed reading assembler description: "+ex.getMessage()) ; } spec.add(modelExtras) ; return spec ; }
public static void createInMemoryDataset(Set<URL> defaultGraph, Set<URL> namedGraphs){ inMemoryDataset = DatasetFactory.createMem(); Model dModel = ModelFactory.createDefaultModel(); for(URL f : defaultGraph){ dModel.add(RDFDataMgr.loadModel(f.toString())); } inMemoryDataset.setDefaultModel(dModel); for(URL f : namedGraphs){ inMemoryDataset.addNamedModel(f.toString(), RDFDataMgr.loadModel(f.toString())); } }
private Model getInfModel(String ttlPath, String ontoPath){ com.hp.hpl.jena.rdf.model.Model jenaModel = RDFDataMgr.loadModel(ttlPath); com.hp.hpl.jena.rdf.model.Model ontoModel = RDFDataMgr.loadModel(ontoPath); com.hp.hpl.jena.rdf.model.Model unionModel = ModelFactory.createUnion(jenaModel,ontoModel); Reasoner reasoner = ReasonerRegistry.getRDFSReasoner(); InfModel infModel = ModelFactory.createInfModel(reasoner, unionModel); Model model2go = new org.ontoware.rdf2go.impl.jena.ModelImplJena(infModel); model2go.open(); return model2go; }
private static Model loadModel(String uri) { return RDFDataMgr.loadModel(filename(uri)) ; }
public static List<Resource> loadTestSuitesSqcf(String baseFile) { Model testSuitesModel = RDFDataMgr.loadModel(baseFile, Lang.TURTLE); normalizeSqcfModel(testSuitesModel); List<Resource> result = testSuitesModel.listSubjectsWithProperty(SparqlQcVocab.hasTest).toList(); //enrichTestCasesWithLabels(testSuitesModel); return result; }
public static List<Resource> loadTestSuitesSqcf(String baseFile) { Model testSuitesModel = RDFDataMgr.loadModel(baseFile, Lang.TURTLE); normalizeSqcfModel(testSuitesModel); List<Resource> result = testSuitesModel.listSubjectsWithProperty(SparqlQcVocab.hasTest).toList(); //enrichTestCasesWithLabels(testSuitesModel); return result; }
private Model loadModelFromClasspathResource(String resource) throws Exception { final InputStream url = this.getClass().getResourceAsStream(resource); assertNotNull("Could not find resource on classpath: " + resource, url); return RDFDataMgr.loadModel(TestUtils.copyResourceToFile(testDir, resource)); }
@Test public void load_01() { RDFDataMgr.loadModel(filename("D.nt")) ; } @Test public void load_02() { RDFDataMgr.loadModel(filename("D.nt"), RDFLanguages.NTRIPLES) ; }
@Test public void load_02() { RDFDataMgr.loadModel(filename("D.nt"), RDFLanguages.NTRIPLES) ; } @Test public void load_03() { RDFDataMgr.loadModel(filename("D-nt"), RDFLanguages.NTRIPLES) ; }
@Test public void load_03() { RDFDataMgr.loadModel(filename("D-nt"), RDFLanguages.NTRIPLES) ; }
@Override protected void handleFrameworkStartedEvent(BundleContext context) { com.hp.hpl.jena.rdf.model.Model jenaServiceModel = RDFDataMgr.loadModel(SERVICE_MODEL_PATH); Model model2go = new org.ontoware.rdf2go.impl.jena.ModelImplJena(jenaServiceModel); model2go.open(); MessageWiring2Go msg = new MessageWiring2Go(getInfModel(MSG_MODEL_PATH, SVC_MSG_ONTOLOGY_MODEL_PATH)); msg.loadMsgServices(context); Test2Go test = new Test2Go(); Properties props = new Properties(); props.put("bundleContext", "http://www.w3.org/2002/07/owl#bundleContextSpec"); ManagedService ms = new OSGiComponent(context, new SimpleLifecycle(context, BundleContext.class), props); ms.start(); test.registerServiceManagerEntites(model2go); test.startSpecExtender(context, null, model2go); }
@Test public void bnode_cycles() { Model m = RDFDataMgr.loadModel("testing/DAWG-Final/construct/data-ident.ttl"); Assert.assertTrue(m.size() > 0); ByteArrayOutputStream output = new ByteArrayOutputStream(); RDFDataMgr.write(output, m, Lang.TURTLE); ByteArrayInputStream input = new ByteArrayInputStream(output.toByteArray()); Model m2 = ModelFactory.createDefaultModel(); RDFDataMgr.read(m2, input, Lang.TURTLE); Assert.assertTrue(m2.size() > 0); Assert.assertTrue(m.isIsomorphicWith(m2)); }
@Test public void graph_load_1() { String testDataFile = DIR+"data.ttl"; Model m0 = RDFDataMgr.loadModel(testDataFile); try ( RDFConnection conn = connection() ) { conn.load(testDataFile); Model m = conn.fetch(); assertTrue("Models not isomorphic", isomorphic(m0, m)); } }
@Test public void named_graph_load_1() { String testDataFile = DIR+"data.ttl"; Model m0 = RDFDataMgr.loadModel(testDataFile); try ( RDFConnection conn = connection() ) { conn.load(graphName, testDataFile); Model m = conn.fetch(graphName); assertTrue("Models not isomorphic", isomorphic(m0, m)); Model mDft = conn.fetch(); assertTrue(mDft.isEmpty()); } }