Changeset 84135d2 in ingen


Ignore:
Timestamp:
Oct 24, 2015, 10:59:05 AM (2 years ago)
Author:
David Robillard <d@…>
Branches:
groups, master, nodeless, parallel, parameters, sequencefix, tasks
Children:
ade7143
Parents:
1d92e1e
Message:

Fix loading recursive graphs in LV2

git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5776 a436a847-0d15-0410-975c-d299462d15a1

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ingen/Parser.hpp

    r1d92e1e r84135d2  
    6767        const Raul::URI&   type_uri);
    6868
     69    /** Parse a graph from RDF into a Interface (engine or client).
     70     *
     71     * @param path If this is a file path, then the graph is loaded from that
     72     * file.  If it is a directory, then the manifest.ttl from that directory
     73     * is used instead.  In either case, any rdfs:seeAlso files are loaded and
     74     * the graph parsed from the resulting combined model.
     75     *
     76     * @return whether or not load was successful.
     77     */
    6978    virtual bool parse_file(
    7079        World*                        world,
  • src/Parser.cpp

    r1d92e1e r84135d2  
    334334
    335335        parse_graph(world, target, model, base_uri,
    336                     subject, Resource::Graph::DEFAULT,
     336                    sub_node, Resource::Graph::DEFAULT,
    337337                    path.parent(), Raul::Symbol(path.symbol()));
    338338    } else {
     
    617617}
    618618
    619 /** Parse a graph from RDF into a Interface (engine or client).
    620  * @return whether or not load was successful.
    621  */
    622619bool
    623620Parser::parse_file(Ingen::World*                     world,
     
    650647    // Find graphs in manifest
    651648    const std::set<ResourceRecord> resources = find_resources(
    652         *world->rdf_world(),
    653         Glib::filename_to_uri(manifest_path),
    654         Raul::URI(INGEN__Graph));
     649        *world->rdf_world(), manifest_uri, Raul::URI(INGEN__Graph));
    655650
    656651    if (resources.empty()) {
     
    659654    }
    660655
    661     // Choose the first (only) graph (only one top-level graph per bundle)
    662     const std::string& uri = (*resources.begin()).uri;
    663     if ((file_path = (*resources.begin()).filename).empty()) {
    664         // No seeAlso file, use "manifest" (probably the graph file itself)
     656    /* Choose the graph to load.  If this is a manifest, then there should only be
     657       one, but if this is a graph file, subgraphs will be returned as well.
     658       In this case, choose the one with the file URI. */
     659    std::string uri;
     660    for (const ResourceRecord& r : resources) {
     661        if (r.uri == Glib::filename_to_uri(manifest_path)) {
     662            uri = r.uri;
     663            file_path = r.filename;
     664            break;
     665        }
     666    }
     667
     668    if (uri.empty()) {
     669        // Didn't find a graph with the same URI as the file, use the first
     670        uri       = (*resources.begin()).uri;
     671        file_path = (*resources.begin()).filename;
     672    }
     673
     674    if (file_path.empty()) {
     675        // No seeAlso file, use manifest (probably the graph file itself)
    665676        file_path = manifest_path;
    666677    }
Note: See TracChangeset for help on using the changeset viewer.