If I have two object types, Person, and University, linked in a many-to-many fashion in the Ontology, what is the behavior when objects are removed?
For example, let’s say Alice is linked to both University A and University B (undergrad and grad school), and Bob is linked to University A and University C.
If I delete Alice from the Ontology, e.g. in Typescript via <AliceObject>.delete();, what happens to the links between Alice and University A, and University B? Are the links automatically removed as well, or do they persist?
If one or both objects in a many-to-many link are already deleted from the Ontology, is there any way (in Typescript) to delete the ghost links?
Well, a many-to-many would need a join table. Usually these are backed by some pipeline or transform to continually update the relations or allow users to perform an action which would re-trigger the pipeline to re-build the join table.
If Alice is deleted from the Person object set then unless the pipeline scans for deleted objects it won’t necessarily drop the Alice<>University A row from the join table (this answers your last question in that you would need to specify this scan-and-drop in your pipeline logic). That said, the join table only serves as a filter for wherever the ontology API is invoked. So even if Alice is deleted but the link remains in the table, the resulting traversal will not return the Alice object since the filter will return an empty set.
Bear in mind you can specify and name various link types too. For example, one link is “undergrad” and another is “graduate”. Now, since a Person can attend multiple undergraduate universities it still doesn’t get us outside the many to many but might come in handy in a pinch!