/** * {@inheritDoc} */ @Override public boolean isEmpty() { return super.object.isEmpty(); }
@Override public boolean isEmpty() { return this.jenaModel.isEmpty(); }
public boolean isEmpty() { return model.isEmpty(); }
@Override public boolean isEmpty() { return m.isEmpty(); } };
private Content contentFromModel( Assembler a, Resource root, Model partial, Resource combined ) { return partial.isEmpty() ? Content.empty : (Content) a.open( completedClone( root, combined, partial ) ) ; }
/** Answer a Reasoner created according to the underlying factory, and then loaded with this Wrapper's rules (if the Reasoner is a RuleReasoner) and bound to this Wrapper's schemas (in an unspecified order). */ @Override public Reasoner create( Resource ignored ) { Reasoner result = factory.create( config ); return schemaUnion.isEmpty() ? result : result.bindSchema( schemaUnion ); }
@Override public Model loadModel(String uri) { RouterRestletSupport.log.info("loadModel '{}'", uri ); if (uri.startsWith( Container.LOCAL_PREFIX )) { String specFile = "file:///" + baseFilePathLocal + uri.substring(Container.LOCAL_PREFIX.length()); return EldaFileManager.get().loadModel( specFile ); } else if (uri.startsWith( TDBManager.PREFIX )) { String modelName = uri.substring( TDBManager.PREFIX.length() ); Model tdb = TDBManager.getTDBModelNamed( modelName ); RouterRestletSupport.log.info("get TDB model '{}'", modelName); if (tdb.isEmpty()) RouterRestletSupport.log.warn("the TDB model at '{}' is empty -- has it been initialised?", modelName); if (tdb.isEmpty()) throw new APIException( "the TDB model at " + modelName + " is empty -- has it been initialised?" ); return tdb; } else { return EldaFileManager.get().loadModel( uri ); } } }
public TDBSource( Resource endpoint ) { super( endpoint ); String endpointString = endpoint.getURI(); String name = endpointString.substring( TDBManager.PREFIX.length() ); this.endpoint = endpointString; this.sourceSet = TDBManager.getDataset(); if (name != null && !name.isEmpty()) { this.source = TDBManager.getTDBModelNamed(name); log.debug( "TDB with endpoint '{}' has model with {} triples" , endpointString, this.source.size() ); if (this.source.isEmpty()) EldaException.EmptyTDB( name ); } else { source = null; log.info("using TDB whole dataset"); } }
protected Content getContent( Assembler a, Resource root ) { final Resource newRoot = oneLevelClone( root ); final Model fragment = newRoot.getModel(); return fragment.isEmpty() ? Content.empty : (Content) a.open( a, completedClone( root, newRoot, fragment ) ); }
if (staticDataModel.isEmpty()) { staticDataModel.close(); return null;
if (config.isEmpty()) { config.close(); log.warn("Metadata RDF Mapping did not contain any triples!");
@Override public Model convert(Context context, DSpaceObject dso) throws SQLException, AuthorizeException { if (this.plugins.isEmpty()) { log.warn("No RDFConverterPlugins were loaded, cannot convert any data!"); return null; } Model model = ModelFactory.createDefaultModel(); for (ConverterPlugin plugin : this.plugins) { if (plugin.supports(dso.getType())) { Model convertedData = plugin.convert(context, dso); if (convertedData != null) { model.setNsPrefixes(convertedData); model.add(convertedData); convertedData.close(); } } } if (model.isEmpty()) { model.close(); return null; } else { return model; } } }
private void graphJ2R(String inResource, String outResource) throws Exception { final Model model1 = loadModelFromClasspathResource("/com/github/jsonldjava/jena/" + inResource); assertFalse("Failed to load input model from classpath: " + inResource, model1.isEmpty()); final Model model2 = loadModelFromClasspathResource("/com/github/jsonldjava/jena/" + outResource); assertFalse("Failed to load output model from classpath: " + outResource, model2.isEmpty()); assertTrue("Input graph " + inResource + " not isomorphic to output dataset" + outResource, model1.isIsomorphicWith(model2)); }
private void rtRJRg(String filename) throws Exception { final Model model = loadModelFromClasspathResource("/com/github/jsonldjava/jena/" + filename); // Write a JSON-LD final ByteArrayOutputStream out = new ByteArrayOutputStream(); RDFDataMgr.write(out, model, JSONLD); final ByteArrayInputStream r = new ByteArrayInputStream(out.toByteArray()); // Read as JSON-LD final Model model2 = ModelFactory.createDefaultModel(); RDFDataMgr.read(model2, r, null, JSONLD); assertFalse("JSON-LD model was empty", model2.isEmpty()); // Compare if (!model.isIsomorphicWith(model2)) { System.out.println("## ---- DIFFERENT"); } } }
/***********************************/ @Test public void testCreateResultsModel() { ResultsModel rm = new ResultsModel( Fixtures.mockResultSet( context, apiResultsModel, apiObjectModel, apiMetadataModel ) ); assertFalse( rm.getModel().isEmpty() ); assertFalse( rm.getDataset().getNamedModel( ResultsModel.RESULTS_METADATA_GRAPH ).isEmpty() ); assertFalse( rm.getDataset().getNamedModel( ResultsModel.RESULTS_OBJECT_GRAPH ).isEmpty() ); }
if (m.isEmpty()) { log.info("There were no public sub communities we could link to."); m.close();
if (m.isEmpty()) { m.close(); return null;
@Test public void query2() { Dataset ds = create() ; Model m = ds.getDefaultModel() ; load1(m) ; String qs = "CONSTRUCT {?s ?p ?o } WHERE { GRAPH <http://example/graph/> {?s ?p ?o}}" ; Query q = QueryFactory.create(qs) ; QueryExecution qExec = QueryExecutionFactory.create(q, ds) ; Model m2 = qExec.execConstruct() ; assertTrue(m2.isEmpty()) ; }
if (m.isEmpty()) { m.close(); return null;
@Test public void rollback() { Model model = SDBFactory.connectDefaultModel(store); assertTrue("Initially empty", model.isEmpty()); model.begin(); model.add(RDF.type, RDF.type, RDF.type); assertTrue("Uncommited triple can be seen", model.contains(RDF.type, RDF.type, RDF.type)); model.abort(); assertTrue("Nothing was added, the add aborted", model.isEmpty()); model.add(RDF.type, RDF.type, RDF.type); assertEquals("Model contains 1 triple", 1l, model.size()); model.begin(); model.remove(RDF.type, RDF.type, RDF.type); model.abort(); assertEquals("Model still contains 1 triple", 1l, model.size()); }