Changeset 2090

Show
Ignore:
Timestamp:
06/03/09 17:20:19 (15 months ago)
Author:
drobilla
Message:

Centralize storage creation and only create SPO and OPS indices (TODO: Add API for user to select, predicate-variable queries will be slow this way).

Location:
trunk/slv2
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/slv2/src/plugin.c

    r2089 r2090  
    196196        if (!p->storage) { 
    197197                assert(!p->rdf); 
    198                 p->storage = librdf_new_storage(p->world->world, "trees", NULL, NULL); 
    199                 if (!p->storage) 
    200                         p->storage = librdf_new_storage(p->world->world, "memory", NULL, NULL); 
     198                p->storage = slv2_world_new_storage(p->world); 
    201199                p->rdf = librdf_new_model(p->world->world, p->storage, NULL); 
    202200        } 
  • trunk/slv2/src/slv2_internal.h

    r2089 r2090  
    166166slv2_world_load_file(SLV2World world, librdf_uri* file_uri); 
    167167 
     168librdf_storage* 
     169slv2_world_new_storage(SLV2World world); 
     170 
    168171 
    169172/* ********* Plugin UI ********* */ 
  • trunk/slv2/src/world.c

    r2086 r2090  
    4343        assert(world->world); 
    4444 
    45         world->storage = librdf_new_storage(world->world, "trees", NULL, NULL); 
    46         if (!world->storage) { 
    47                 SLV2_WARN("Warning: Unable to create \"trees\" RDF storage.\n" 
    48                                 "Performance can be improved by upgrading librdf.\n"); 
    49                 world->storage = librdf_new_storage(world->world, "hashes", NULL, 
    50                                 "hash-type='memory'"); 
    51         } 
    52  
     45        world->storage = slv2_world_new_storage(world); 
    5346        if (!world->storage) 
    5447                goto fail; 
     
    8982        /* keep on rockin' in the */ free(world); 
    9083        return NULL; 
     84} 
     85 
     86 
     87/* private */ 
     88librdf_storage* 
     89slv2_world_new_storage(SLV2World world) 
     90{ 
     91        static bool warned = false; 
     92        librdf_hash* options = librdf_new_hash_from_string(world->world, NULL, 
     93                        "index-spo='yes',index-ops='yes'"); 
     94        librdf_storage* ret = librdf_new_storage_with_options( 
     95                        world->world, "trees", NULL, options); 
     96        if (!ret) { 
     97                warned = true; 
     98                SLV2_WARN("Warning: Unable to create \"trees\" RDF storage.\n" 
     99                                "Performance can be improved by upgrading librdf.\n"); 
     100                ret = librdf_new_storage(world->world, "hashes", NULL, 
     101                                "hash-type='memory'"); 
     102        } 
     103 
     104        librdf_free_hash(options); 
     105        return ret; 
    91106} 
    92107 
     
    186201 
    187202        /* Parse the manifest into a temporary model */ 
    188         librdf_storage* manifest_storage = librdf_new_storage(world->world, "trees", NULL, NULL); 
    189         if (manifest_storage == NULL) 
    190                 manifest_storage = librdf_new_storage(world->world, "memory", NULL, NULL); 
     203        librdf_storage* manifest_storage = slv2_world_new_storage(world); 
    191204 
    192205        librdf_model* manifest_model = librdf_new_model(world->world, 
  • trunk/slv2/utils/lv2_inspect.c

    r2087 r2090  
    227227                SLV2Value name = slv2_results_get_binding_value(presets, 0); 
    228228                printf("\t         %s\n", slv2_value_as_string(name)); 
     229                slv2_value_free(name); 
    229230        } 
    230231        slv2_results_free(presets);