コード例 #1
0
ファイル: ontology.cpp プロジェクト: boradin/data
            Resource* Repository::obtainResource(const Concept& concept) const {
                Query query;
                query.setBase(QUrl("http://micra.com/COSMO/COSMO.owl#"));
                query.addPrefix("rdf", QUrl("http://www.w3.org/1999/02/22-rdf-syntax-ns#"));
                query.addPrefix("owl", QUrl("http://www.w3.org/2002/07/owl#"));

                QStringList variables;
                variables.append("x");
                query.addVariables("SELECT", variables);

                query.addTriple("?x", "owl:Class", "?res");
                query.addTriple("?res", "rdf:ID", concept);

                QueryResultIterator it = m_model->executeQuery(query.getContents());
                QList<BindingSet> bindingSets = it.allBindings();
                return new Resource(bindingSets[0]["x"], this);
            }