Creating Predicates: Part 2
Our full application schema will contain 12 predicates.
We've already shown you how to create person/fullName
and chat/messsage
. In order to create the other 10 predicates, we'll need to use additional predicate predicates:
_predicate/unique
- Is a predicate unique?true
orfalse
_predicate/multi
- Can a predicate include multiple objects (values)?true
orfalse
_predicate/restrictCollection
- If a predicate is of typeref
, we can restrict it so that the references only refer to one type of subject. The value for this should be the name of the collection, i.e."restrictCollection": "artist"
Application Schema Predicates
The following is the full list of predicates we still need to create.
Predicates that should be unique are marked with a '*'.
Predicates that are of type
ref
are marked with a '~'. See if you can figure out what collections those predicates should be referencing.Predicates that are
"multi": true
are marked with a '+'.
Person:
person/handle
*person/follows
~ , +person/favNums
+person/favArtists
~ , +
Chat:
chat/person
~chat/instant
chat/comments
~ , +
Comment:
comment/message
comment/person
~
Artist:
artist/name
*
Your job is to create the remaining 10 predicates. A few points:
- If a predicate is not unique, you don't have to list
"unique": false
. Predicates are not unique by default. - If a predicate is not 'multi', you don't have to list
"multi": false
. Predicates are not multi by default. true
andfalse
do not need to be surrounded by quotation marks. In most programming languages, and in FlureeQL,true
andfalse
are special keywords.- Remember, the types we are using are:
string
(text),int
(numbers),ref
(reference), andinstant
(time).
Create All 10 Predicates Above
Write a transaction to create the 10 predicates we need for our chat application schema.