SimpleOntology implements Ontology { @Override public OutputStream asJsonLD(boolean skolemize) throws MobiOntologyException { return getOntologyOutputStream(skolemize, false, RDFFormat.JSONLD); } SimpleOntology(Model model, Repository cacheRepo, OntologyManager ontologyManager,
                          CatalogManager catalogManager, CatalogConfigProvider configProvider,
                          DatasetManager datasetManager, ImportsResolver importsResolver, SesameTransformer transformer,
                          BNodeService bNodeService, ValueFactory vf, ModelFactory mf);  SimpleOntology(String recordCommitKey, Model model, Repository cacheRepo, OntologyManager ontologyManager,
                          CatalogManager catalogManager, CatalogConfigProvider configProvider,
                          DatasetManager datasetManager, ImportsResolver importsResolver, SesameTransformer transformer,
                          BNodeService bNodeService, ValueFactory vf, ModelFactory mf);  SimpleOntology(String recordCommitKey, Repository cacheRepo, OntologyManager ontologyManager,
                          CatalogManager catalogManager, CatalogConfigProvider configProvider,
                          DatasetManager datasetManager, ImportsResolver importsResolver, SesameTransformer transformer,
                          BNodeService bNodeService, ValueFactory vf, ModelFactory mf); private  SimpleOntology(IRI datasetIRI, Model model, Repository cacheRepo, OntologyManager ontologyManager,
                           CatalogManager catalogManager, CatalogConfigProvider configProvider,
                           DatasetManager datasetManager, ImportsResolver importsResolver,
                           SesameTransformer transformer, BNodeService bNodeService, ValueFactory vf, ModelFactory mf); void setDifference(Difference difference); @Override Model asModel(ModelFactory factory); @Override OutputStream asTurtle(); @Override OutputStream asTurtle(OutputStream outputStream); @Override OutputStream asRdfXml(); @Override OutputStream asRdfXml(OutputStream outputStream); @Override OutputStream asOwlXml(); @Override OutputStream asOwlXml(OutputStream outputStream); @Override OutputStream asJsonLD(boolean skolemize); @Override OutputStream asJsonLD(boolean skolemize, OutputStream outputStream); @Override OntologyId getOntologyId(); @Override Set<IRI> getUnloadableImportIRIs(); @Override Set<Ontology> getImportsClosure(); @Override Set<IRI> getImportedOntologyIRIs(); @Override Set<Annotation> getOntologyAnnotations(); @Override Set<Annotation> getAllAnnotations(); @Override Set<AnnotationProperty> getAllAnnotationProperties(); @Override boolean containsClass(IRI iri); @Override Set<OClass> getAllClasses(); @Override Set<ObjectProperty> getAllClassObjectProperties(IRI iri); @Override Set<ObjectProperty> getAllNoDomainObjectProperties(); @Override Set<DataProperty> getAllClassDataProperties(IRI iri); @Override Set<DataProperty> getAllNoDomainDataProperties(); @Override Set<Datatype> getAllDatatypes(); @Override Set<ObjectProperty> getAllObjectProperties(); @Override Optional<ObjectProperty> getObjectProperty(IRI iri); @Override Set<Resource> getObjectPropertyRange(ObjectProperty objectProperty); @Override Set<DataProperty> getAllDataProperties(); @Override Optional<DataProperty> getDataProperty(IRI iri); @Override Set<Resource> getDataPropertyRange(DataProperty dataProperty); @Override Set<Individual> getAllIndividuals(); @Override Set<Individual> getIndividualsOfType(IRI classIRI); @Override Set<Individual> getIndividualsOfType(OClass clazz); @Override Hierarchy getSubClassesOf(ValueFactory vf, ModelFactory mf); @Override Set<IRI> getSubClassesFor(IRI iri); @Override Set<IRI> getSubPropertiesFor(IRI iri); @Override Hierarchy getSubDatatypePropertiesOf(ValueFactory vf, ModelFactory mf); @Override Hierarchy getSubAnnotationPropertiesOf(ValueFactory vf, ModelFactory mf); @Override Hierarchy getSubObjectPropertiesOf(ValueFactory vf, ModelFactory mf); @Override Hierarchy getClassesWithIndividuals(ValueFactory vf, ModelFactory mf); @Override TupleQueryResult getEntityUsages(Resource entity); @Override Model constructEntityUsages(Resource entity, ModelFactory modelFactory); @Override Hierarchy getConceptRelationships(ValueFactory vf, ModelFactory mf); @Override Hierarchy getConceptSchemeRelationships(ValueFactory vf, ModelFactory mf); @Override TupleQueryResult getSearchResults(String searchText, ValueFactory valueFactory); @Override TupleQueryResult getTupleQueryResults(String queryString, boolean includeImports); @Override Model getGraphQueryResults(String queryString, boolean includeImports, ModelFactory modelFactory); @Override boolean equals(Object obj); @Override int hashCode();  }
@Test public void asJsonldWithSkolemizeTest() throws Exception { SimpleBNodeService blankNodeService = spy(new SimpleBNodeService()); blankNodeService.setModelFactory(mf); blankNodeService.setValueFactory(vf); InputStream stream = this.getClass().getResourceAsStream("/list-ontology.ttl"); InputStream expected = this.getClass().getResourceAsStream("/list-ontology-skolemize.jsonld"); Ontology listOntology = new SimpleOntology(Models.createModel(stream, transformer), repo, ontologyManager, catalogManager, catalogConfigProvider, datasetManager, importsResolver, transformer, blankNodeService, vf, mf); String jsonld = listOntology.asJsonLD(true).toString(); assertEquals(removeWhitespace(replaceBlankNodeSuffix(IOUtils.toString(expected, Charset.defaultCharset()))), removeWhitespace(replaceBlankNodeSuffix(jsonld))); verify(blankNodeService, atLeast(1)).skolemize(any(com.mobi.rdf.api.Statement.class)); }
@Test public void asJsonldWithoutSkolemizeTest() throws Exception { SimpleBNodeService blankNodeService = spy(new SimpleBNodeService()); blankNodeService.setModelFactory(mf); blankNodeService.setValueFactory(vf); InputStream stream = this.getClass().getResourceAsStream("/list-ontology.ttl"); InputStream expected = this.getClass().getResourceAsStream("/list-ontology.jsonld"); Ontology listOntology = new SimpleOntology(Models.createModel(stream, transformer), repo, ontologyManager, catalogManager, catalogConfigProvider, datasetManager, importsResolver, transformer, blankNodeService, vf, mf); String jsonld = listOntology.asJsonLD(false).toString(); assertEquals(removeWhitespace(IOUtils.toString(expected, Charset.defaultCharset()).replaceAll("_:node[a-zA-Z0-9]+\"", "\"")), removeWhitespace(jsonld.replaceAll("_:node[a-zA-Z0-9]+\"", "\""))); verify(blankNodeService, times(0)).skolemize(any(com.mobi.rdf.api.Model.class)); }