Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type Subject = distinct string
- #A triple is made up of a Subject, predicate and object e.g. "Bob knows alice"
- register("is", string)
- register("knows", Subject)
- register("age", int64)
- tripleStore.add("Bob", "is", "male")
- tripleStore.add("Bob", "age", 64)
- tripleStore.add("Alice", "is", "female")
- tripleStore.add("Bob", "knows", "Alice")
- tripleStore.queryAll("Bob", "Knows") -> @["Alice"]
- tripleStore.query("Alice", "age") -> Optional#empty
- tripleStore.queryAll("Alice", "age") -> @[]
- #this shouldn't compile as hate has not been registered
- tripleStore.add("Bob", "Hates", "Alice")
Advertisement
Add Comment
Please, Sign In to add comment