First Demo Issues

Here is my schema:
WOQL.and(
WOQL.doctype(“Object”).label(“City or Person”)
.description(“An object is either a City, Person or Null”)
.property(“id”, “integer”).label(“Object Id”)
.property(“objet_type”, “string”).label(“Object Type”),
WOQL.doctype(“City”).label(“City”)
.property(“id”, “integer”).label(“City Id”)
.property(“object_id”, “integer”).label(“Object Id”),
WOQL.doctype(“Person”).label(“Person”)
.property(“id”, “integer”).label(“Person Id”)
.property(“object_id”, “integer”).label(“Object Id”),
WOQL.doctype(“City_Content”).label(“City_Content”)
.property(“id”, “integer”).label(“City Content Id”)
.property(“content_id”, “integer”).label(“Content Id”)
.property(“city_id”, “integer”).label(“City Id”)
.property(“name”, “string”).label(“City Name”),
WOQL.doctype(“Person_Content”).label(“Person Content”)
.property(“id”, “integer”).label(“Person Content Id”)
.property(“content_id”, “integer”).label(“Content Id”)
.property(“person_id”, “integer”).label(“Person Id”)
.property(“first_name”, “string”).label(“First Name”)
.property(“last_name”, “string”).label(“Last Name”)
.property(“age”, “integer”).label(“Person Age”)
.property(“city_id”, “integer”).label(“City Id”)
)

Adding Data Not Working:
WOQL.query(WOQL
.add_triple(‘doc:Object’, ‘type’, ‘scm:Object’)
.add_triple(‘doc:Object’, ‘id’, 0)
.add_triple(‘doc:Object’, ‘object_type’, null)
.add_triple(‘doc:Object’, ‘completed’, true)
.comment(‘Add an example data 0’)
)

Any suggestions?

You have a misspelling. The use of object type is also wrong as it should be a string datatype which does not contain null. We can easily represent the non-existence of an object type simply by not creating an edge there instead.

In addition the Object class is not a super-class of Person or City. which will lead to problems with the ‘id’ property. We should probably flag as an error at schema creation time.

1 Like