Skip to content

Commit

Permalink
Rename 'ontology' arguments to 'onto' for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanoBilenchi committed Mar 20, 2024
1 parent 4d56461 commit 4615d95
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 33 deletions.
4 changes: 2 additions & 2 deletions include/cowl_istream.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,11 @@ cowl_ret cowl_istream_process_stream(CowlIStream *stream, UIStream *istream);
* Streams through the specified ontology.
*
* @param stream The ontology input stream.
* @param ontology The ontology.
* @param onto The ontology.
* @return Return code.
*/
COWL_API
cowl_ret cowl_istream_process_ontology(CowlIStream *stream, CowlOntology *ontology);
cowl_ret cowl_istream_process_ontology(CowlIStream *stream, CowlOntology *onto);

/// @}

Expand Down
20 changes: 10 additions & 10 deletions include/cowl_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,47 +220,47 @@ CowlOntology *cowl_manager_read_stream(CowlManager *manager, UIStream *stream);
* Writes the ontology to the file at the specified path.
*
* @param manager The manager.
* @param ontology The ontology.
* @param onto The ontology.
* @param path The file path.
* @return Return code.
*/
COWL_API
cowl_ret cowl_manager_write_path(CowlManager *manager, CowlOntology *ontology, UString path);
cowl_ret cowl_manager_write_path(CowlManager *manager, CowlOntology *onto, UString path);

/**
* Writes the ontology to the specified file.
*
* @param manager The manager.
* @param ontology The ontology.
* @param onto The ontology.
* @param file The output file.
* @return Return code.
*/
COWL_API
cowl_ret cowl_manager_write_file(CowlManager *manager, CowlOntology *ontology, FILE *file);
cowl_ret cowl_manager_write_file(CowlManager *manager, CowlOntology *onto, FILE *file);

/**
* Writes the ontology to the specified string buffer.
*
* @param manager The manager.
* @param ontology The ontology.
* @param onto The ontology.
* @param buf The string buffer.
* @return Return code.
*/
COWL_API
cowl_ret cowl_manager_write_strbuf(CowlManager *manager, CowlOntology *ontology, UStrBuf *buf);
cowl_ret cowl_manager_write_strbuf(CowlManager *manager, CowlOntology *onto, UStrBuf *buf);

/**
* Writes the ontology to the specified output stream.
*
* @param manager The manager.
* @param ontology The ontology.
* @param onto The ontology.
* @param stream The output stream.
* @return Return code.
*
* @note The stream is not released by the manager, you must do it yourself.
*/
COWL_API
cowl_ret cowl_manager_write_stream(CowlManager *manager, CowlOntology *ontology, UOStream *stream);
cowl_ret cowl_manager_write_stream(CowlManager *manager, CowlOntology *onto, UOStream *stream);

/**
* Returns an ontology input stream.
Expand All @@ -277,12 +277,12 @@ CowlIStream *cowl_manager_get_istream(CowlManager *manager, CowlIStreamHandlers
* Returns an ontology input stream that stores constructs in the specified ontology.
*
* @param manager The manager.
* @param ontology The ontology.
* @param onto The ontology.
* @return Ontology input stream.
*/
COWL_API
COWL_RETAINED
CowlIStream *cowl_manager_get_istream_to_ontology(CowlManager *manager, CowlOntology *ontology);
CowlIStream *cowl_manager_get_istream_to_ontology(CowlManager *manager, CowlOntology *onto);

/**
* Returns an ontology output stream.
Expand Down
4 changes: 2 additions & 2 deletions include/cowl_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ typedef struct CowlWriter {
* Pointer to a function that writes an ontology to an output stream.
*
* @param stream Output stream.
* @param ontology Ontology.
* @param onto Ontology.
* @return Return code.
*
* @note Should only be implemented by writers that either require the ontology object
* as a whole, or that can more efficiently encode the ontology if they
* have access to it. In all other cases, it is best left unimplemented.
*/
cowl_ret (*write_ontology)(UOStream *stream, CowlOntology *ontology);
cowl_ret (*write_ontology)(UOStream *stream, CowlOntology *onto);

/**
* Pointer to a function that writes an object to an output stream.
Expand Down
10 changes: 5 additions & 5 deletions src/cowl_istream.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,18 @@ static bool onto_stream_handle_axiom(void *ctx, CowlAny *axiom) {
return (*((cowl_ret *)c[0]) = handle->axiom(handle->ctx, axiom)) == COWL_OK;
}

cowl_ret cowl_istream_process_ontology(CowlIStream *stream, CowlOntology *ontology) {
cowl_ret cowl_istream_process_ontology(CowlIStream *stream, CowlOntology *onto) {
cowl_ret ret = COWL_OK;
CowlIStreamHandlers *handle = &stream->handlers;

if (handle->iri || handle->version) {
CowlOntologyId id = cowl_ontology_get_id(ontology);
CowlOntologyId id = cowl_ontology_get_id(onto);
if (handle->iri && (ret = handle->iri(handle->ctx, id.iri))) return ret;
if (handle->version && (ret = handle->version(handle->ctx, id.version))) return ret;
}

if (handle->annot) {
CowlVector *annotations = cowl_ontology_get_annot(ontology);
CowlVector *annotations = cowl_ontology_get_annot(onto);
cowl_vector_foreach (annotations, annot) {
if ((ret = handle->annot(handle->ctx, *annot.item))) return ret;
}
Expand All @@ -132,13 +132,13 @@ cowl_ret cowl_istream_process_ontology(CowlIStream *stream, CowlOntology *ontolo
if (handle->import) {
void *ctx[] = { &ret, handle };
CowlIterator iter = { ctx, onto_stream_handle_import };
if (!cowl_ontology_iterate_import_iris(ontology, &iter, false)) return ret;
if (!cowl_ontology_iterate_import_iris(onto, &iter, false)) return ret;
}

if (handle->axiom) {
void *ctx[] = { &ret, handle };
CowlIterator iter = { ctx, onto_stream_handle_axiom };
if (!cowl_ontology_iterate_axioms(ontology, &iter, false)) return ret;
if (!cowl_ontology_iterate_axioms(onto, &iter, false)) return ret;
}

return ret;
Expand Down
4 changes: 2 additions & 2 deletions src/cowl_istream_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ static cowl_ret store_axiom(void *ctx, CowlAnyAxiom *axiom) {
return cowl_ontology_add_axiom(ctx, axiom);
}

CowlIStreamHandlers cowl_istream_handlers_to_ontology(CowlOntology *ontology) {
CowlIStreamHandlers cowl_istream_handlers_to_ontology(CowlOntology *onto) {
return (CowlIStreamHandlers){
.ctx = ontology,
.ctx = onto,
.iri = store_iri,
.version = store_version,
.import = store_import,
Expand Down
22 changes: 11 additions & 11 deletions src/cowl_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,30 +116,30 @@ CowlOntology *cowl_manager_read_stream(CowlManager *manager, UIStream *istream)
return NULL;
}

cowl_ret cowl_manager_write_path(CowlManager *manager, CowlOntology *ontology, UString path) {
cowl_ret cowl_manager_write_path(CowlManager *manager, CowlOntology *onto, UString path) {
UOStream stream;
uostream_to_path(&stream, ustring_data(path));
cowl_ret ret = cowl_manager_write_stream_deinit(manager, ontology, &stream);
cowl_ret ret = cowl_manager_write_stream_deinit(manager, onto, &stream);
if (ret) cowl_handle_path_error(path, ustring_literal("failed to write ontology"), manager);
return ret;
}

cowl_ret cowl_manager_write_file(CowlManager *manager, CowlOntology *ontology, FILE *file) {
cowl_ret cowl_manager_write_file(CowlManager *manager, CowlOntology *onto, FILE *file) {
UOStream stream;
uostream_to_file(&stream, file);
return cowl_manager_write_stream_deinit(manager, ontology, &stream);
return cowl_manager_write_stream_deinit(manager, onto, &stream);
}

cowl_ret cowl_manager_write_strbuf(CowlManager *manager, CowlOntology *ontology, UStrBuf *buf) {
cowl_ret cowl_manager_write_strbuf(CowlManager *manager, CowlOntology *onto, UStrBuf *buf) {
UOStream stream;
uostream_to_strbuf(&stream, buf);
return cowl_manager_write_stream_deinit(manager, ontology, &stream);
return cowl_manager_write_stream_deinit(manager, onto, &stream);
}

cowl_ret cowl_manager_write_stream(CowlManager *manager, CowlOntology *ontology, UOStream *stream) {
cowl_ret cowl_manager_write_stream(CowlManager *manager, CowlOntology *onto, UOStream *stream) {
if (stream->state) return cowl_handle_stream_error(stream->state, manager);
CowlOStream *ostream = cowl_manager_get_ostream(manager, stream);
cowl_ret ret = cowl_ostream_write_ontology(ostream, ontology);
cowl_ret ret = cowl_ostream_write_ontology(ostream, onto);
cowl_release(ostream);
return ret;
}
Expand Down Expand Up @@ -173,16 +173,16 @@ static cowl_ret store_axiom(void *ctx, CowlAnyAxiom *axiom) {
return cowl_ontology_add_axiom(ctx, axiom);
}

CowlIStream *cowl_manager_get_istream_to_ontology(CowlManager *manager, CowlOntology *ontology) {
CowlIStream *cowl_manager_get_istream_to_ontology(CowlManager *manager, CowlOntology *onto) {
CowlIStreamHandlers handlers = {
.ctx = ontology,
.ctx = onto,
.iri = store_iri,
.version = store_version,
.import = store_import,
.annot = store_annot,
.axiom = store_axiom,
};
return cowl_istream(manager, ontology->st, handlers);
return cowl_istream(manager, onto->st, handlers);
}

CowlOStream *cowl_manager_get_ostream(CowlManager *manager, UOStream *stream) {
Expand Down
2 changes: 1 addition & 1 deletion src/cowl_ontology_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct CowlOntology {
};

CowlOntology *cowl_ontology(CowlManager *manager);
void cowl_ontology_free(CowlOntology *ontology);
void cowl_ontology_free(CowlOntology *onto);
cowl_ret cowl_ontology_finalize(CowlOntology *onto);
COWL_PURE bool cowl_ontology_equals(CowlOntology *lhs, CowlOntology *rhs);
COWL_PURE ulib_uint cowl_ontology_hash(CowlOntology *onto);
Expand Down

0 comments on commit 4615d95

Please sign in to comment.