Skip to content

Commit

Permalink
WIP Unable to search through atomicdata.dev resources locally #706
Browse files Browse the repository at this point in the history
  • Loading branch information
joepio committed Nov 22, 2023
1 parent 7fbd027 commit f924151
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
16 changes: 16 additions & 0 deletions lib/defaults/default_store.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
[
{
"@id": "https://atomicdata.dev",
"https://atomicdata.dev/properties/classtype": "https://atomicdata.dev/classes/Drive"
},
{
"@id": "https://atomicdata.dev/properties",
"https://atomicdata.dev/properties/parent": "https://atomicdata.dev"
},
{
"@id": "https://atomicdata.dev/classes",
"https://atomicdata.dev/properties/parent": "https://atomicdata.dev"
},
{
"@id": "https://atomicdata.dev/datatypes",
"https://atomicdata.dev/properties/parent": "https://atomicdata.dev"
},
{
"@id": "https://atomicdata.dev/properties/endpoint/parameters",
"https://atomicdata.dev/properties/classtype": "https://atomicdata.dev/classes/Property",
Expand Down
3 changes: 1 addition & 2 deletions lib/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ pub struct ParseOpts {
pub importer: Option<String>,
/// Who's rights will be checked when creating the imported resources.
/// Is only used when `save` is set to [SaveOpts::Commit].
/// If [None] is passed, all resources will be
pub for_agent: ForAgent,
/// Who will perform the importing. If set to none, all possible commits will be signed by the default agent.
/// Note that this Agent needs a private key to sign the commits.
Expand Down Expand Up @@ -61,7 +60,7 @@ impl std::default::Default for ParseOpts {
importer: None,
for_agent: ForAgent::Sudo,
overwrite_outside: true,
save: SaveOpts::Save,
save: SaveOpts::Commit,
}
}
}
Expand Down
23 changes: 10 additions & 13 deletions lib/src/populate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
//! These base models are required for having a functioning store.
//! Other populate methods help to set up an Atomic Server, by creating a basic file hierarcy and creating default collections.
use url::form_urlencoded::Parse;

use crate::{
datatype::DataType,
errors::AtomicResult,
parse::ParseOpts,
parse::{ParseOpts, SaveOpts},
schema::{Class, Property},
storelike::Query,
urls, Storelike, Value,
Expand Down Expand Up @@ -195,23 +197,18 @@ Note that, by default, all resources are `public`. You can edit this by opening

/// Imports the Atomic Data Core items (the entire atomicdata.dev Ontology / Vocabulary)
pub fn populate_default_store(store: &impl Storelike) -> AtomicResult<()> {
let parse_opts = ParseOpts {
// save: SaveOpts::Save,
..Default::default()
};
store
.import(
include_str!("../defaults/default_store.json"),
&ParseOpts::default(),
)
.import(include_str!("../defaults/default_store.json"), &parse_opts)
.map_err(|e| format!("Failed to import default_store.json: {e}"))?;
store
.import(
include_str!("../defaults/chatroom.json",),
&ParseOpts::default(),
)
.import(include_str!("../defaults/chatroom.json",), &parse_opts)
.map_err(|e| format!("Failed to import chatroom.json: {e}"))?;
store
.import(
include_str!("../defaults/table.json",),
&ParseOpts::default(),
)
.import(include_str!("../defaults/table.json",), &parse_opts)
.map_err(|e| format!("Failed to import table.json: {e}"))?;
Ok(())
}
Expand Down

0 comments on commit f924151

Please sign in to comment.