You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/src/lib.rs
+122-3Lines changed: 122 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,93 @@
1
-
#[doc = include_str!("../../README.md")]
1
+
//! `ontoenv` is an environment manager for ontologies. It can be used as a Rust library to manage local and remote RDF ontologies and their dependencies.
2
+
//!
3
+
//! It recursively discovers and resolves `owl:imports` statements, and provides an API for querying the dependency graph and retrieving a unified "imports closure" of an ontology.
4
+
//!
5
+
//! The environment is backed by an `Oxigraph` store.
6
+
//!
7
+
//! # Usage
8
+
//!
9
+
//! Here is a basic example of how to use the `ontoenv` Rust library. This example will:
10
+
//! 1. Create a temporary directory.
11
+
//! 2. Write two simple ontologies to files in that directory, where one imports the other.
12
+
//! 3. Configure and initialize `ontoenv` to use this directory.
13
+
//! 4. Compute the dependency closure of one ontology to demonstrate that `ontoenv` correctly resolves and includes the imported ontology.
14
+
//!
15
+
//! ```rust
16
+
//! use ontoenv::config::Config;
17
+
//! use ontoenv::ToUriString;
18
+
//! use ontoenv::api::{OntoEnv, ResolveTarget};
19
+
//! use oxigraph::model::NamedNode;
20
+
//! use std::path::PathBuf;
21
+
//! use std::fs;
22
+
//! use std::io::Write;
23
+
//! use std::collections::HashSet;
24
+
//!
25
+
//! # fn main() -> anyhow::Result<()> {
26
+
//! // Set up a temporary directory for the example
27
+
//! let test_dir = PathBuf::from("target/doc_test_temp_readme");
28
+
//! if test_dir.exists() {
29
+
//! fs::remove_dir_all(&test_dir)?;
30
+
//! }
31
+
//! fs::create_dir_all(&test_dir)?;
32
+
//! let root = test_dir.canonicalize()?;
33
+
//!
34
+
//! // Create a dummy ontology file for ontology A
35
+
//! let ontology_a_path = root.join("ontology_a.ttl");
36
+
//! let mut file_a = fs::File::create(&ontology_a_path)?;
0 commit comments