Skip to content

Commit

Permalink
Add ontolgy class and props to populate step
Browse files Browse the repository at this point in the history
  • Loading branch information
Polleps committed Apr 30, 2024
1 parent 4f5734f commit 1b8fe99
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
roots: ['<rootDir>/src'],
testMatch: [
'**/__tests__/**/*.+(ts|tsx|js)',
Expand Down
2 changes: 1 addition & 1 deletion browser/lib/src/store.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('Store', () => {

it('fetches a resource', async () => {
const store = new Store({ serverUrl: 'https://atomicdata.dev' });
const resource = await store.getResourceAsync(
const resource = await store.getResource(
'https://atomicdata.dev/properties/createdAt',
);

Expand Down
57 changes: 57 additions & 0 deletions lib/defaults/ontologies.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[
{
"@id": "https://atomicdata.dev/class/ontology",
"https://atomicdata.dev/properties/description": "An ontology is a group of classes, properties and class instances that together describe a certain domain.",
"https://atomicdata.dev/properties/isA": [
"https://atomicdata.dev/classes/Class"
],
"https://atomicdata.dev/properties/parent": "https://atomicdata.dev/classes",
"https://atomicdata.dev/properties/recommends": [
"https://atomicdata.dev/properties/classes",
"https://atomicdata.dev/properties/properties",
"https://atomicdata.dev/properties/instances"
],
"https://atomicdata.dev/properties/requires": [
"https://atomicdata.dev/properties/description",
"https://atomicdata.dev/properties/shortname"
],
"https://atomicdata.dev/properties/shortname": "ontology"
},
{
"@id": "https://atomicdata.dev/properties/properties",
"https://atomicdata.dev/properties/classtype": "https://atomicdata.dev/classes/Property",
"https://atomicdata.dev/properties/datatype": "https://atomicdata.dev/datatypes/resourceArray",
"https://atomicdata.dev/properties/description": "A list of properties",
"https://atomicdata.dev/properties/parent": "https://atomicdata.dev/properties",
"https://atomicdata.dev/properties/shortname": "properties"
},
{
"@id": "https://atomicdata.dev/properties/classes",
"https://atomicdata.dev/properties/classtype": "https://atomicdata.dev/classes/Class",
"https://atomicdata.dev/properties/datatype": "https://atomicdata.dev/datatypes/resourceArray",
"https://atomicdata.dev/properties/description": "A list of classes",
"https://atomicdata.dev/properties/isA": [
"https://atomicdata.dev/classes/Property"
],
"https://atomicdata.dev/properties/parent": "https://atomicdata.dev/properties",
"https://atomicdata.dev/properties/shortname": "classes"
},
{
"@id": "https://atomicdata.dev/properties/instances",
"https://atomicdata.dev/properties/datatype": "https://atomicdata.dev/datatypes/resourceArray",
"https://atomicdata.dev/properties/description": "A list of class instances",
"https://atomicdata.dev/properties/parent": "https://atomicdata.dev/properties",
"https://atomicdata.dev/properties/shortname": "instances"
},
{
"@id": "https://atomicdata.dev/ontology/server/property/default-ontology",
"https://atomicdata.dev/properties/classtype": "https://atomicdata.dev/class/ontology",
"https://atomicdata.dev/properties/datatype": "https://atomicdata.dev/datatypes/atomicURL",
"https://atomicdata.dev/properties/description": "The ontology where all classes go by default",
"https://atomicdata.dev/properties/isA": [
"https://atomicdata.dev/classes/Property"
],
"https://atomicdata.dev/properties/parent": "https://atomicdata.dev/properties",
"https://atomicdata.dev/properties/shortname": "default-ontology"
}
]
6 changes: 6 additions & 0 deletions lib/src/populate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@ pub fn populate_default_store(store: &impl Storelike) -> AtomicResult<()> {
&ParseOpts::default(),
)
.map_err(|e| format!("Failed to import table.json: {e}"))?;
store
.import(
include_str!("../defaults/ontologies.json",),
&ParseOpts::default(),
)
.map_err(|e| format!("Failed to import ontologies.json: {e}"))?;
Ok(())
}

Expand Down

0 comments on commit 1b8fe99

Please sign in to comment.