[MOBY-dev] Using CentralDigestCachedImpl....

Paul Gordon gordonp at ucalgary.ca
Wed Dec 5 17:21:37 UTC 2007


Hi Andreas,

The concluision we reached a few weeks ago is that 
CentralDigestCachedImpl and org.biomoby.shared.data.* use different 
catching schemes,which I will reconcile once Martin has set up some unit 
tests for the CentralImpls.  Usually there is no  compelling reason to 
use both caches...if you are using org.biomoby.shared.data.* to create 
and past data instances, CentralDigestCachedImpl.CACHE_PART_DATATYPES 
doesn't really do anything for you, and vice versa.  If you are using
org.biomoby.shared.data.*, drop the updateCache() calls you had, and use 
instead:

Registry registry = new Registry("calgary", 
"http://moby.ucalgary.ca/moby/MOBY-Central.pl",  
"http://moby.ucalgary.ca/MOBY/Central");
RegistryCache.cacheOntologyFile(registry, 
Central.DATA_TYPES_RESOURCE_NAME, allowedAgeMillis);
MobyDataType.loadDataTypes(RegistryCache.getOntologyFile(registry, 
Central.DATA_TYPES_RESOURCE_NAME).toURI().toURL(), registry);

I just added the allowedAgeMillis parameter for convenience. You'll want 
to do a CVS update.  For MobyNamespace it's similar..

MobyNamespace.loadNamespaces(RegistryCache.getOntologyFile(registry, 
Central.NAMESPACES_RESOURCE_NAME).toURI().toURL(), registry);

Hopefully, we can reconcile the Central calls cache and this code soon, 
so you don't need to pick.  I could have also made a 
MobyNamespace.loadNamespaces(registry) method, but in keeping with the 
Law of Demeter, it's better for MobyNamespace and MobyDataType to not 
explicitly know about RegistryCache, hence the 
MobyNamespace.loadNamespaces(url, registry) signature.

Regards,

Paul

Andreas Groscurth wrote:
> Hi,
>
> sorry for reasking that - but has anyone an answer ?
>
> Thanks
> andreas
>
> On Monday 03 December 2007 09:45, Andreas Groscurth wrote:
>   
>> Hi,
>>
>> I'm using CentralDigestCachedImpl for caching the datatypes and namespaces
>> locally.
>>
>> CentralDigestCachedImpl cachedImpl = new
>> CentralDigestCachedImpl("http://moby.ucalgary.ca/moby/MOBY-Central.pl","htt
>> p://moby.ucalgary.ca/MOBY/Central", file.getAbsolutePath() );
>> cachedImpl.updateCache( CentralDigestCachedImpl.CACHE_PART_DATATYPES );
>> cachedImpl.updateCache( CentralDigestCachedImpl.CACHE_PART_NAMESPACES );
>>
>> This works fine and re-calls use the local cache.
>>
>> But when I create a new MobyDataObject, it starts again to fetch the
>> datatypes
>>
>> Fetching data type ontology from
>> http://moby.ucalgary.ca/RESOURCES/MOBY-S/Objects
>>
>> So how do I tell it, that its already has these information ? the
>> MobyDataObject can also have a Registry Object - so i guess that can help -
>> but how to I link my CachedCentral with a Registry object ?
>>
>> Or is this otherwise solveable ?
>>
>> thx
>> andreas
>> _______________________________________________
>> MOBY-dev mailing list
>> MOBY-dev at lists.open-bio.org
>> http://lists.open-bio.org/mailman/listinfo/moby-dev
>>     
>
>   



More information about the MOBY-dev mailing list