@Override public Model union(Model model) { return inner.union(model); }
/** * Get all two types of RDF Metadata through GRDDL XSLT: * http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1415068_253892949 */ public Model getRDFMetadata() throws Exception { Model m = getInContentMetadata().union(this.getManifestRDFMetadata()); return m; }
@Override public void readDataset(Dataset dataset){ dataset.setDefaultModel(dataset.getDefaultModel().union(read())); }
@Override public void readDataset(Dataset dataset){ dataset.setDefaultModel(dataset.getDefaultModel().union(read())); }
/** * Get in-content metadata cache model * * @return The in-content metadata cache model * @throws Exception */ public Model getInContentMetadataFromCache() throws Exception { Model m = ModelFactory.createDefaultModel(); // find and merge the RDF triples cache from the OdfXMLFile files for (OdfXMLFile file : OdfXMLFile.values()) { for (Model m1 : this.getFileDom(file).getInContentMetadataCache().values()) { m = m.union(m1); } } return m; }
/** * Get in-content metadata model of bookmarks * * @return The in-content metadata model of bookmarks * @throws Exception */ public Model getBookmarkRDFMetadata() throws Exception { Model m = ModelFactory.createDefaultModel(); for (OdfXMLFile file : OdfXMLFile.values()) { OdfFileDom dom = getFileDom(file); m = m.union(dom.getBookmarkRDFMetadata()); } return m; } }
@Override public BiConsumer<Dataset, Dataset> accumulator() { return (d1, d2) -> { d1.getDefaultModel().add(d2.getDefaultModel()); d2.listNames().forEachRemaining(name -> { Model union = d1.getNamedModel(name).union(d2.getNamedModel(name)); d1.replaceNamedModel(name, union); }); }; } }
@Override public void read(String base, String contextName, InputStream is) { Model m = ModelFactory.createDefaultModel(); m.read(is, base, formatFromName(contextName)); dataset.addNamedModel(namedModelFromName(contextName), m); union = union.union(m); }
public void testFollowOwlImportsDeeply() { final Model m1 = model( "this hasMarker M1; _x owl:imports M2" ), m2 = model( "this hasMarker M2" ); Model m = model( "x ja:reasoner y; _x owl:imports M1" ); FileManager fm = new FixedFileManager() .add( "eh:/M1", m1 ).add( "eh:/M2", m2 ); Model result = new ImportManager().withImports( fm, m ); assertInstanceOf( MultiUnion.class, result.getGraph() ); assertIsoModels( m1.union(m2).union(m), result ); }
public void testFollowOwlImportsDeeply() { final Model m1 = model( "this hasMarker M1; _x owl:imports M2" ), m2 = model( "this hasMarker M2" ); Model m = model( "x ja:reasoner y; _x owl:imports M1" ); FileManager fm = new FixedFileManager() .add( "eh:/M1", m1 ).add( "eh:/M2", m2 ); Model result = new ImportManager().withImports( fm, m ); assertInstanceOf( MultiUnion.class, result.getGraph() ); assertIsoModels( m1.union(m2).union(m), result ); }
public void testCatchesCircularity() { final Model m1 = model( "this hasMarker Mx; _x owl:imports My" ), m2 = model( "this hasMarker My; _x owl:imports Mx" ); FileManager fm = new FixedFileManager() .add( "eh:/Mx", m1 ).add( "eh:/My", m2 ); Model result = new ImportManager().withImports( fm, m1 ); assertIsoModels( m1.union( m2 ), result ); }
public void testCatchesCircularity() { final Model m1 = model( "this hasMarker Mx; _x owl:imports My" ), m2 = model( "this hasMarker My; _x owl:imports Mx" ); FileManager fm = new FixedFileManager() .add( "eh:/Mx", m1 ).add( "eh:/My", m2 ); Model result = new ImportManager().withImports( fm, m1 ); assertIsoModels( m1.union( m2 ), result ); }
public void testFollowOwlImports() { final Model modelToLoad = model( "this hasMarker B5" ); Model m = model( "x ja:reasoner y; _x owl:imports eh:/loadMe" ); FileManager fm = new FixedFileManager().add( "eh:/loadMe", modelToLoad ); Model m2 = new ImportManager().withImports( fm, m ); assertInstanceOf( MultiUnion.class, m2.getGraph() ); assertIsoModels( modelToLoad.union( m ), m2 ); }
public void testImportMayBeLiteral() { final Model modelToLoad = model( "this hasMarker B5" ); Model m = model( "x ja:reasoner y; _x ja:imports 'eh:/loadMe'" ); FileManager fm = new FixedFileManager().add( "eh:/loadMe", modelToLoad ); Model m2 = new ImportManager().withImports( fm, m ); assertInstanceOf( MultiUnion.class, m2.getGraph() ); assertIsoModels( modelToLoad.union( m ), m2 ); }
public void testFollowOwlImports() { final Model modelToLoad = model( "this hasMarker B5" ); Model m = model( "x ja:reasoner y; _x owl:imports eh:/loadMe" ); FileManager fm = new FixedFileManager().add( "eh:/loadMe", modelToLoad ); Model m2 = new ImportManager().withImports( fm, m ); assertInstanceOf( MultiUnion.class, m2.getGraph() ); assertIsoModels( modelToLoad.union( m ), m2 ); }
public void testFollowJAImports() { final Model modelToLoad = model( "this hasMarker B5" ); Model m = model( "x ja:reasoner y; _x ja:imports eh:/loadMe" ); FileManager fm = new FixedFileManager().add( "eh:/loadMe", modelToLoad ); Model m2 = new ImportManager().withImports( fm, m ); assertInstanceOf( MultiUnion.class, m2.getGraph() ); assertIsoModels( modelToLoad.union( m ), m2 ); }
public void testImportMayBeLiteral() { final Model modelToLoad = model( "this hasMarker B5" ); Model m = model( "x ja:reasoner y; _x ja:imports 'eh:/loadMe'" ); FileManager fm = new FixedFileManager().add( "eh:/loadMe", modelToLoad ); Model m2 = new ImportManager().withImports( fm, m ); assertInstanceOf( MultiUnion.class, m2.getGraph() ); assertIsoModels( modelToLoad.union( m ), m2 ); }
public void testFollowJAImports() { final Model modelToLoad = model( "this hasMarker B5" ); Model m = model( "x ja:reasoner y; _x ja:imports eh:/loadMe" ); FileManager fm = new FixedFileManager().add( "eh:/loadMe", modelToLoad ); Model m2 = new ImportManager().withImports( fm, m ); assertInstanceOf( MultiUnion.class, m2.getGraph() ); assertIsoModels( modelToLoad.union( m ), m2 ); }
/** * Test problem with bindSchema not interacting properly with validation. */ public void testBindSchemaValidate() { Reasoner reasoner = ReasonerRegistry.getOWLReasoner(); Model schema = FileManager.get().loadModel("file:testing/reasoners/bugs/sbug.owl"); Model data = FileManager.get().loadModel("file:testing/reasoners/bugs/sbug.rdf"); // Union version InfModel infu = ModelFactory.createInfModel(reasoner, data.union(schema)); ValidityReport validity = infu.validate(); assertTrue( ! validity.isValid()); // debug print // for (Iterator i = validity.getReports(); i.hasNext(); ) { // System.out.println(" - " + i.next()); // } // bindSchema version InfModel inf = ModelFactory.createInfModel(reasoner.bindSchema(schema), data); validity = inf.validate(); assertTrue( ! validity.isValid()); }