Back to index

lightning-sunbird  0.9+nobinonly
Functions
remstore.c File Reference
#include "rdf-int.h"
#include "gs.h"

Go to the source code of this file.

Functions

int asEqual (RDFT r, Assertion as, RDF_Resource u, RDF_Resource s, void *v, RDF_ValueType type)
Assertion makeNewAssertion (RDFT r, RDF_Resource u, RDF_Resource s, void *v, RDF_ValueType type, int tv)
void addToAssertionList (RDFT f, Assertion as)
void freeAssertion (Assertion as)
Assertion remoteStoreAdd (RDFT mcf, RDF_Resource u, RDF_Resource s, void *v, RDF_ValueType type, int tv)
Assertion remoteStoreRemove (RDFT mcf, RDF_Resource u, RDF_Resource s, void *v, RDF_ValueType type)
int remoteStoreHasAssertion (RDFT mcf, RDF_Resource u, RDF_Resource s, void *v, RDF_ValueType type, int tv)
voidgetSlotValue (RDFT mcf, RDF_Resource u, RDF_Resource s, RDF_ValueType type, int inversep, int tv)
RDF_Cursor getSlotValues (RDFT mcf, RDF_Resource u, RDF_Resource s, RDF_ValueType type, int inversep, int tv)
voidnextValue (RDF_Cursor c)
void disposeCursor (RDF_Cursor c)
void unloadRDFT (RDFT f)

Function Documentation

Definition at line 69 of file remstore.c.

Here is the call graph for this function:

int asEqual ( RDFT  r,
Assertion  as,
RDF_Resource  u,
RDF_Resource  s,
void v,
RDF_ValueType  type 
)

Definition at line 41 of file remstore.c.

{
  return (((r == NULL) || (as->db == r)) && 
         (as->u == u) && 
         (as->s == s) && 
         (as->type == type) && 
         ((as->value == v) || 
          ((type == RDF_STRING_TYPE) && (strcmp((char*)v, (char*)as->value) == 0))));
}

Here is the caller graph for this function:

Definition at line 213 of file remstore.c.

{
  if (c) freeMem(c);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 81 of file remstore.c.

{
  if (as->type == RDF_STRING_TYPE) {
    freeMem(as->value);
  } 
  freeMem(as);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void* getSlotValue ( RDFT  mcf,
RDF_Resource  u,
RDF_Resource  s,
RDF_ValueType  type,
int  inversep,
int  tv 
)

Definition at line 164 of file remstore.c.

{
  Assertion nextAs;

  nextAs = (inversep ? u->rarg2 : u->rarg1);
  while (nextAs != null) {
    if (((nextAs->db == mcf) || (!mcf)) && (nextAs->s == s) 
        && (nextAs->type == type)) {
      return (inversep ? nextAs->u : nextAs->value);
    }
    nextAs = (inversep ? nextAs->invNext : nextAs->next);
  }
  return null;
}

Here is the caller graph for this function:

RDF_Cursor getSlotValues ( RDFT  mcf,
RDF_Resource  u,
RDF_Resource  s,
RDF_ValueType  type,
int  inversep,
int  tv 
)

Definition at line 180 of file remstore.c.

{
  Assertion as = (inversep ? u->rarg2 : u->rarg1);
  RDF_Cursor c;
  if (!as) return NULL;
  c = (RDF_Cursor)getMem(sizeof(RDF_CursorStruct));
  c->u = u;
  c->s = s;
  c->type = type;
  c->inversep = inversep;
  c->count = 0;
  c->db = mcf;
  c->pdata = as;
  c->queryType = GET_SLOT_VALUES; 
  return c;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Assertion makeNewAssertion ( RDFT  r,
RDF_Resource  u,
RDF_Resource  s,
void v,
RDF_ValueType  type,
int  tv 
)

Definition at line 55 of file remstore.c.

{
  Assertion newAs = (Assertion) fgetMem(sizeof(RDF_AssertionStruct));
  newAs->u = u;
  newAs->s = s;
  newAs->value = v;
  newAs->type = type;
  newAs->db = r;
  return newAs;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 198 of file remstore.c.

                         {
  if (!c) return null;
  while (c->pdata != null) {
    Assertion as = (Assertion) c->pdata;
    if (((as->db == c->db) || (!c->db)) && (as->s == c->s) &&  (c->type == as->type)) {
      c->value = (c->inversep ? as->u : as->value);
      c->pdata = (c->inversep ? as->invNext : as->next);
      return c->value;
    }
    c->pdata = (c->inversep ? as->invNext : as->next);
  }
  return null;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Assertion remoteStoreAdd ( RDFT  mcf,
RDF_Resource  u,
RDF_Resource  s,
void v,
RDF_ValueType  type,
int  tv 
)

Definition at line 91 of file remstore.c.

{
  Assertion  newAs = makeNewAssertion(mcf, u, s, v, type, tv);
  newAs->next = u->rarg1;
  u->rarg1 = newAs;

  if (type == RDF_RESOURCE_TYPE) {
    RDF_Resource iu = (RDF_Resource)v;
    newAs->invNext  = iu->rarg2;
    iu->rarg2       = newAs;
  }
  /*  if (type == RDF_STRING_TYPE)   RDFGS_AddSearchIndex(mcf, (char*) v, s, u); */
  
  return newAs;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int remoteStoreHasAssertion ( RDFT  mcf,
RDF_Resource  u,
RDF_Resource  s,
void v,
RDF_ValueType  type,
int  tv 
)

Definition at line 149 of file remstore.c.

{
  Assertion nextAs;
  
  nextAs = u->rarg1;
  while (nextAs != null) {
    if (asEqual(mcf, nextAs, u, s, v, type)) return true;
    nextAs = nextAs->next;
  }
  return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 110 of file remstore.c.

{
  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;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 220 of file remstore.c.

{
  int n = 0;
  while (n < f->assertionListCount) {
    Assertion as = *(f->assertionList + n);
    remoteStoreRemove(f, as->u, as->s, as->value, as->type);
    freeAssertion(as);
    *(f->assertionList + n) = NULL;
    n++;
  }
  f->assertionListCount = 0;
  f->assertionListSize = 0;
  freeMem(f->assertionList);
  f->assertionList = NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function: