PRBool ldapHasAssertion (RDFT rdf, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type, PRBool tv) { Assertion nextAs; if (!ldap2rdfInitedp) ldap2rdfInit(rdf); nextAs = ldaparg1(u); while (nextAs != null) { if (asEqual(nextAs, u, s, v, type) && (nextAs->tv == tv)) return true; nextAs = nextAs->next; } possiblyAccessldap(rdf, u, s, false); nextAs = ldaparg1(u); while (nextAs != null) { if (asEqual(nextAs, u, s, v, type) && (nextAs->tv == tv)) return true; nextAs = nextAs->next; } return false; }
int remoteStoreHasAssertion (RDFT mcf, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type, int tv) { Assertion nextAs; nextAs = u->rarg1; while (nextAs != null) { if (asEqual(mcf, nextAs, u, s, v, type)) return true; nextAs = nextAs->next; } return false; }
Assertion histAddParent (RDF_Resource child, RDF_Resource parent) { Assertion nextAs, prevAs, newAs; RDF_Resource s = gCoreVocab->RDF_parent; RDF_ValueType type = RDF_RESOURCE_TYPE; nextAs = prevAs = child->rarg1; while (nextAs != null) { if (asEqual(nextAs, child, s, parent, type)) return null; prevAs = nextAs; nextAs = nextAs->next; } newAs = makeNewAssertion(child, s, parent, type, 1); if (prevAs == null) { child->rarg1 = newAs; } else { prevAs->next = newAs; } nextAs = prevAs = parent->rarg2; if (nextAs == NULL) { parent->rarg2 = newAs; } else { PRBool added = 0; while (nextAs != null) { char* nid = resourceID(nextAs->u); if (strcmp( resourceID(child), resourceID(nextAs->u)) > 0) { if (prevAs == nextAs) { newAs->invNext = prevAs; parent->rarg2 = newAs; added = 1; break; } else { newAs->invNext = nextAs; prevAs->invNext = newAs; added = 1; break; } } prevAs = nextAs; nextAs = nextAs->invNext; } if (!added) prevAs->invNext = newAs; } sendNotifications2(gHistoryStore, RDF_ASSERT_NOTIFY, child, s, parent, type, 1); /* XXX have to mark the entire subtree XXX */ /* sendNotifications(gRemoteStore->rdf, RDF_ASSERT_NOTIFY, child, s, parent, type, 1); */ }
PRBool ESHasAssertion (RDFT rdf, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type, PRBool tv) { Assertion nextAs; if (!ESFTPRT(u)) return 0; nextAs = u->rarg1; while (nextAs != NULL) { if (asEqual(nextAs, u, s, v, type) && (nextAs->tv == tv)) { return(true); } nextAs = nextAs->next; } possiblyAccessES(rdf, u, s, false); return false; }
PRBool ESDBRemove (RDFT rdf, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type) { Assertion nextAs, prevAs, ans; PRBool found = false; nextAs = prevAs = u->rarg1; while (nextAs != null) { if (asEqual(nextAs, u, s, v, type)) { if (prevAs == null) { u->rarg1 = nextAs->next; } else { prevAs->next = nextAs->next; } found = true; ans = nextAs; break; } prevAs = nextAs; nextAs = nextAs->next; } if (found == false) return false; if (type == RDF_RESOURCE_TYPE) { nextAs = prevAs = ((RDF_Resource)v)->rarg2; while (nextAs != null) { if (nextAs == ans) { if (prevAs == nextAs) { ((RDF_Resource)v)->rarg2 = nextAs->invNext; } else { prevAs->invNext = nextAs->invNext; } } prevAs = nextAs; nextAs = nextAs->invNext; } } sendNotifications2(rdf, RDF_DELETE_NOTIFY, u, s, v, type, 1); return true; }
Assertion remoteStoreRemove (RDFT mcf, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type) { Assertion nextAs, prevAs, ans; int found = false; nextAs = prevAs = u->rarg1; while (nextAs != null) { if (asEqual(mcf, nextAs, u, s, v, type)) { if (prevAs == nextAs) { u->rarg1 = nextAs->next; } else { prevAs->next = nextAs->next; } found = true; ans = nextAs; break; } prevAs = nextAs; nextAs = nextAs->next; } if (found == false) return null; if (type == RDF_RESOURCE_TYPE) { nextAs = prevAs = ((RDF_Resource)v)->rarg2; while (nextAs != null) { if (nextAs == ans) { if (prevAs == nextAs) { ((RDF_Resource)v)->rarg2 = nextAs->invNext; } else { prevAs->invNext = nextAs->invNext; } } prevAs = nextAs; nextAs = nextAs->invNext; } } return ans; }
PRBool ESDBAdd (RDFT rdf, RDF_Resource u, RDF_Resource s, void* v, RDF_ValueType type) { Assertion nextAs, prevAs, newAs; if ((s == gCoreVocab->RDF_instanceOf) && (v == gWebData->RDF_Container)) { setContainerp(u, true); return 1; } nextAs = prevAs = u->rarg1; while (nextAs != null) { if (asEqual(nextAs, u, s, v, type)) return 1; prevAs = nextAs; nextAs = nextAs->next; } newAs = makeNewAssertion(u, s, v, type, 1); if (prevAs == null) { u->rarg1 = newAs; } else { prevAs->next = newAs; } if (type == RDF_RESOURCE_TYPE) { nextAs = prevAs = ((RDF_Resource)v)->rarg2; while (nextAs != null) { prevAs = nextAs; nextAs = nextAs->invNext; } if (prevAs == null) { ((RDF_Resource)v)->rarg2 = newAs; } else { prevAs->invNext = newAs; } } sendNotifications2(rdf, RDF_ASSERT_NOTIFY, u, s, v, type, 1); return true; }