Beispiel #1
0
PRBool
historyUnassert (RDFT hst,  RDF_Resource u, RDF_Resource s, void* v, 
		       RDF_ValueType type)
{
  if ((type == RDF_RESOURCE_TYPE) && (resourceType((RDF_Resource)v) == HISTORY_RT) &&
      (s == gCoreVocab->RDF_parent)) {
    RDF_Resource parents[5];
    int8 n = 0;
    Assertion as = u->rarg1;
	memset(parents, '\0', 5 * sizeof(RDF_Resource));
    while (as) {
      if ((as->type == RDF_RESOURCE_TYPE) && (as->s == gCoreVocab->RDF_parent) && 
	  (resourceType((RDF_Resource)as->value) == HISTORY_RT) && (n < 5)) {
	parents[n++] = (RDF_Resource)as->value;
      }
      as = as->next;
    }
    GH_DeleteHistoryItem ( resourceID(u));
    while (n > 0) {
		n = n - 1;
		if (parents[n]) {
		    Assertion nas = remoteStoreRemove (gRemoteStore, u, gCoreVocab->RDF_parent, 
			     parents[n], RDF_RESOURCE_TYPE);
			freeMem(nas);
		} 
    }
    return 1;
  }
  return 0;
}
Beispiel #2
0
void
es_GetUrlExitFunc (URL_Struct *urls, int status, MWContext *cx)
{
	RDF_Resource		parent = NULL, child = NULL, r;
	_esFEData		*feData;
	char			*newURL, *p;

	feData = (_esFEData *)urls->fe_data;
	if ((status >= 0) && (feData != NULL))
	{
		parent = RDF_GetResource(gNCDB, feData->parent, false);
		child = RDF_GetResource(gNCDB, feData->child, false);
		if ((parent != NULL) && (child != NULL))
		{
			switch(feData->method)
			{
				case	URL_POST_METHOD:
				if (((p = strrchr(resourceID(child), '/')) != NULL) && (*++p != '\0'))
				{
					if ((newURL = append2Strings(resourceID(parent), p)) != NULL)
					{
						if ((r = RDF_GetResource(gNCDB, newURL, 1)) != NULL)
						{
							setContainerp(r, containerp(child));
							setResourceType(r, resourceType(child));
						
							remoteStoreAdd(gRemoteStore, r,
								gCoreVocab->RDF_parent, parent,
								RDF_RESOURCE_TYPE, 1);
						}
						freeMem(newURL);
					}
				}
				break;

				case	URL_DELETE_METHOD:
				remoteStoreRemove(gRemoteStore, child,
					gCoreVocab->RDF_parent, parent,
					RDF_RESOURCE_TYPE);
				break;
			}
		}
	}
	else if (status < 0)
	{
		if ((cx != NULL) && (urls != NULL) && (urls->error_msg != NULL))
		{
			FE_Alert(cx, urls->error_msg);
		}
	}
	if (feData != NULL)
	{
		esFreeFEData(feData);
	}
        NET_FreeURLStruct (urls);
}
Beispiel #3
0
void
unloadRDFT (RDFT f)
{
  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;
}
Beispiel #4
0
void
deleteCurrentSitemaps (char *address)
{
  RDF_Resource          children[40];
  int16                n = 0;
  RDF_Cursor c = remoteStoreGetSlotValues(gRemoteStore, gNavCenter->RDF_Sitemaps, gCoreVocab->RDF_parent, 
				RDF_RESOURCE_TYPE,1, 1);
  RDF_Resource child;
  while (c && (child = remoteStoreNextValue(gRemoteStore, c))) {
    children[n++] = child;
  }
  remoteStoreDisposeCursor(gRemoteStore, c);
  n--;
  while (n > -1) {
    remoteStoreRemove(gRemoteStore, children[n--], 
		      gCoreVocab->RDF_parent, gNavCenter->RDF_Sitemaps, RDF_RESOURCE_TYPE);
  }
}
Beispiel #5
0
RDF_Resource
hostUnitOfURL (RDF r, RDF_Resource top, RDF_Resource nu, char* title)
{
  char host[100];
  char* url =  resourceID(nu);
  int16 s1, s2, s3;
  RDF_Resource hostResource, existing;
  if (strlen(url) > 100) return NULL;
  if (startsWith("file", url)) {
    return RDF_GetResource(NULL, "Local Files", 1);
  } else { 
    memset(host, '\0', 100);
    s1 = charSearch(':', url)+3;
    s2 = charSearch('/', &url[s1]);
    s3 = charSearch(':', &url[s1]);
    if (s2 == -1) s2 = strlen(url)-s1;
    if ((s3 != -1) && (s2 > s3)) s2 = s3;
    if (startsWith("www", &url[s1])) {s1 = s1+4; s2 = s2-4;}
    if (s2<1) return(NULL);
    memcpy((char*)host, &url[s1], s2);
    host[0] = toupper(host[0]);
    hostResource = RDF_GetResource(NULL, host, 1);
    setContainerp(hostResource, 1);
    setResourceType(hostResource, HISTORY_RT);
    existing = PL_HashTableLookup(hostHash, hostResource);
    if (existing != NULL) {
      if (existing == nu) {
	return existing;
      } else if (existing == top) {
	return hostResource;
      } else {
	remoteStoreRemove(gRemoteStore, existing, gCoreVocab->RDF_parent, top, RDF_RESOURCE_TYPE);
	histAddParent(existing, hostResource);
	histAddParent(hostResource, top);
	PL_HashTableAdd(hostHash, hostResource, top);
	return hostResource;
      }
    } else {
	PL_HashTableAdd(hostHash, hostResource, nu);
	histAddParent(nu, top);
	return nu;
    }
  }
}