Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sergey Kozlovskiy
Schema
Commits
c280a88b
Commit
c280a88b
authored
4 years ago
by
Ruben Seggers
Browse files
Options
Download
Email Patches
Plain Diff
readme update
parent
56c0287b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+45
-21
README.md
with
45 additions
and
21 deletions
+45
-21
README.md
+
45
-
21
View file @
c280a88b
...
...
@@ -17,14 +17,15 @@ npm install
To run the explorer (web app):
`node explorer.js`
To test whether the schema contains inconsistencies:
`node test.js`
To export the schema for the pod:
`node export_schema_pod.js`
To export the schema for the ios application:
`node export_schema_ios_application.js`
To export the schema for the Pod:
`node export_schema_pod.js`
To export the schema for the iOS application:
`node export_schema_ios_application.js`
To export the schema for the Web application:
`node export_schema_web_application.js`
To export the schema for the Indexers:
`node export_schema_indexers.js`
## The schema
The schema consists of
3
parts:
*
Item
Hierarchy
The schema consists of
2
parts:
*
Type
Hierarchy
*
Edge & Property Hierarchy
*
Primitive Types
### Item Hierarchy
All the data points in Memri are called items, e.g. a Person, a Location or a Video. The top level item is called Item,
...
...
@@ -40,12 +41,12 @@ Items can have Edges and Properties, which are in the same hierarchy.
The Edge & Property hierarchy defines:
*
What types of Edges and Properties exist
*
What types Edges and Properties expect
.
*
What types Edges and Properties expect
*
How Edges and Properties are positioned in the hierarchy
#### Edges
Edges are connections to other items, for instance, there might be a '
f
at
her
' edge
betwee
n t
w
o
Persons. By default,
edges are one-to-many relations: An item can have any number of edges of an allowed edge type.
Edges are connections to other items, for instance, there might be a
n
'at
tends
' edge
from a Perso
n to
an Event. By
default,
edges are one-to-many relations: An item can have any number of edges of an allowed edge type.
#### Properties
Where edges connect to other items, properties connect directly to a value of a primitive type, for instance, an item
...
...
@@ -53,23 +54,46 @@ could have a 'name' property of type 'String'. Properties are always one-to-one
value for a property.
### Primitive types
The primitive types that are supported by the data model. All properties must have one of these types.
The primitive types that are supported by the data model are defined in
`TypeHierarchy/primitive`
. All properties must
expect one of these types.
## Changing the schema
The schema is stored as two directory trees for the two hierarchies, with a set of files to define their
characteristics.
The information of an Item is stored as follows:
*
The directory location defines it's position in the hierarchy
*
The directory name is the name of the Item type
*
`description.md`
contains the description of the Item
*
`*Color.txt`
defines the display of the colors
*
`properties`
defines the properties and edges the Item can have
The information of an is stored as follows:
*
The directory location defines its position in the hierarchy
*
The directory name, and the name of the json file it contains, is the name of the item
*
The json file specifies the actual item:
```
json
{
"description"
:
"A short description of the item."
,
"properties"
:
[
"someProperty"
],
"relations"
:
{
"someEdge"
:
{
"sequenced"
:
false
,
"singular"
:
false
}
},
"foregroundColor"
:
"#ffffff"
,
"backgroundColor"
:
"#3a5eb2"
}
```
The information of an edge or property is stored as follows:
*
The directory location defines its position in the hierarchy
*
The directory name, and the name of the json file it contains, is the name of the edge or property
*
The json file specifies the actual edge or property:
```
json
{
"description"
:
"A short description of the edge or property."
,
"type"
:
"ExpectedItemTypeOrPrimitive"
}
```
If you added an Item, Edge or Property, make sure to run
`node test.js`
to see whether there are inconsistencies. If
there aren't,
`node export_schema_pod.js`
creates a file for the Pod located at
`pod/res/autogenerated_schema.json`
;
`node export_schema_ios_application.js`
creates a file for the iOS application located at
`ios-application/memri/model/schema.swift`
. Lastly, rebuild both the Pod and iOS application and you have an updated
schema.
\ No newline at end of file
If you added an Item, Edge or Property, make sure to run
`node test.js`
to see whether there are inconsistencies.
If there aren't, use the
`node export_schema_X.js`
scripts to create the schemas for the projects you are working on,
and overwrite them in the corresponding projects and rebuild those. We plan to automate this process further in the
near future to improve the developer experience.
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets