diff options
author | David Robillard <d@drobilla.net> | 2015-04-01 04:21:18 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2015-04-01 04:21:18 +0000 |
commit | 85aaff2bf3420e7c4a1d4db3c093c589b0c25e78 (patch) | |
tree | 13d21f618fd689575d3e7ccf912e26f5cf0c2fbc /src/gui/RDFS.cpp | |
parent | c0da1cf368b7d43c9c886b81768b4a62a07fae3f (diff) | |
download | ingen-85aaff2bf3420e7c4a1d4db3c093c589b0c25e78.tar.gz ingen-85aaff2bf3420e7c4a1d4db3c093c589b0c25e78.tar.bz2 ingen-85aaff2bf3420e7c4a1d4db3c093c589b0c25e78.zip |
Support adding datatype properties.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5649 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui/RDFS.cpp')
-rw-r--r-- | src/gui/RDFS.cpp | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/src/gui/RDFS.cpp b/src/gui/RDFS.cpp index 458c0bc5..10367bc8 100644 --- a/src/gui/RDFS.cpp +++ b/src/gui/RDFS.cpp @@ -57,12 +57,9 @@ comment(World* world, const LilvNode* node) return comment; } -void -classes(World* world, URISet& types, bool super) +static void +closure(World* world, const LilvNode* pred, URISet& types, bool super) { - LilvNode* rdfs_subClassOf = lilv_new_uri( - world->lilv_world(), LILV_NS_RDFS "subClassOf"); - unsigned added = 0; do { added = 0; @@ -71,9 +68,9 @@ classes(World* world, URISet& types, bool super) LilvNode* type = lilv_new_uri(world->lilv_world(), t.c_str()); LilvNodes* matches = (super) ? lilv_world_find_nodes( - world->lilv_world(), type, rdfs_subClassOf, NULL) + world->lilv_world(), type, pred, NULL) : lilv_world_find_nodes( - world->lilv_world(), NULL, rdfs_subClassOf, type); + world->lilv_world(), NULL, pred, type); LILV_FOREACH(nodes, m, matches) { const LilvNode* klass_node = lilv_nodes_get(matches, m); if (lilv_node_is_uri(klass_node)) { @@ -89,10 +86,30 @@ classes(World* world, URISet& types, bool super) } types.insert(klasses.begin(), klasses.end()); } while (added > 0); +} + +void +classes(World* world, URISet& types, bool super) +{ + LilvNode* rdfs_subClassOf = lilv_new_uri( + world->lilv_world(), LILV_NS_RDFS "subClassOf"); + + closure(world, rdfs_subClassOf, types, super); lilv_node_free(rdfs_subClassOf); } +void +datatypes(World* world, URISet& types, bool super) +{ + LilvNode* owl_onDatatype = lilv_new_uri( + world->lilv_world(), LILV_NS_OWL "onDatatype"); + + closure(world, owl_onDatatype, types, super); + + lilv_node_free(owl_onDatatype); +} + URISet types(World* world, SPtr<const Client::ObjectModel> model) { @@ -139,6 +156,11 @@ properties(World* world, SPtr<const Client::ObjectModel> model) unsigned n_matching_domains = 0; LILV_FOREACH(nodes, d, domains) { const LilvNode* domain_node = lilv_nodes_get(domains, d); + if (!lilv_node_is_uri(domain_node)) { + // TODO: Blank node domains (e.g. unions) + continue; + } + const Raul::URI domain(lilv_node_as_uri(domain_node)); if (types.count(domain)) { ++n_matching_domains; |