本文整理汇总了C++中ObjRef::cmetaId方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjRef::cmetaId方法的具体用法?C++ ObjRef::cmetaId怎么用?C++ ObjRef::cmetaId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjRef
的用法示例。
在下文中一共展示了ObjRef::cmetaId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv)
{
try
{
std::wstring modelURL
(L"http://models.cellml.org/workspace/hodgkin_huxley_1952/@@rawfile/949cd4d3/hodgkin_huxley_1952.cellml");
// Create a CellML Bootstrap and a model loader.
ObjRef<iface::cellml_api::CellMLBootstrap> bootstrap(CreateCellMLBootstrap());
ObjRef<iface::cellml_api::DOMModelLoader> loader(bootstrap->modelLoader());
// Load a CellML model.
ObjRef<iface::cellml_api::Model> hhModel
(loader->loadFromURL(modelURL));
// Request a RDF/API capable RDF representation...
ObjRef<iface::cellml_api::RDFRepresentation> rr(hhModel->getRDFRepresentation(L"http://www.cellml.org/RDF/API"));
ObjRef<iface::rdf_api::RDFAPIRepresentation> rrHH(QueryInterface(rr));
// Retrieve the DataSource. Note: Changes to the data source are not pushed back
// to the model until the source attribute is set on the rrHH again.
ObjRef<iface::rdf_api::DataSource> dsHH(rrHH->source());
// Get the resource corresponding to the cmeta:id on the model. Note that
// cmetaId can return the empty string, which you should check for in
// production code, if there is no cmeta:id
ObjRef<iface::rdf_api::URIReference> hhModelRef
(dsHH->getURIReference(bootstrap->makeURLAbsolute(modelURL, L"#" + hhModel->cmetaId())));
#ifdef DUMP_ALL_TRIPLES_FIRST
{
ObjRef<iface::rdf_api::TripleSet> ts(dsHH->getAllTriples());
ObjRef<iface::rdf_api::TripleEnumerator> te(ts->enumerateTriples());
while (true)
{
ObjRef<iface::rdf_api::Triple> t(te->getNextTriple());
if (t == NULL)
break;
displayTriple(t);
}
}
#endif
ObjRef<iface::rdf_api::URIReference> pmid(dsHH->getURIReference(L"http://www.cellml.org/bqs/1.0#Pubmed_id"));
// Note: Calls like this could fail with an exception if there was no pubmed ID - production code should check.
ObjRef<iface::rdf_api::Triple> t(hhModelRef->getTripleOutOfByPredicate(pmid));
ObjRef<iface::rdf_api::Node> n(t->object());
ObjRef<iface::rdf_api::Literal> lPMID(QueryInterface(n));
if (lPMID != NULL) // It will be null if for some reason it isn't a literal...
std::wcout << L"Model pubmed ID: " << lPMID->lexicalForm() << std::endl;
ObjRef<iface::rdf_api::URIReference> bqsReference(dsHH->getURIReference(L"http://www.cellml.org/bqs/1.0#reference"));
ObjRef<iface::rdf_api::TripleSet> ts(hhModelRef->getTriplesOutOfByPredicate(bqsReference));
ObjRef<iface::rdf_api::TripleEnumerator> te(ts->enumerateTriples());
while (true)
{
t = te->getNextTriple();
if (t == NULL) break;
ObjRef<iface::rdf_api::Resource> r(QueryInterface(t->object()));
if (r == NULL) continue;
std::wcout << L"Found a resource description:" << std::endl;
try
{
t = r->getTripleOutOfByPredicate(pmid);
n = t->object();
lPMID = QueryInterface(n);
if (lPMID != NULL)
std::wcout << L" Reference pubmed ID: " << lPMID->lexicalForm() << std::endl;
}
catch(...) {}
// Look up the subject...
ObjRef<iface::rdf_api::URIReference> subject(dsHH->getURIReference(L"http://purl.org/dc/elements/1.1/subject"));
ts = r->getTriplesOutOfByPredicate(subject);
ObjRef<iface::rdf_api::TripleEnumerator> te2 = ts->enumerateTriples();
while (true)
{
t = te2->getNextTriple();
if (t == NULL)
break;
n = t->object();
r = QueryInterface(n);
if (r == NULL)
continue;
std::wcout << " Subject:" << std::endl;
ObjRef<iface::rdf_api::URIReference> subjectType(dsHH->getURIReference(L"http://www.cellml.org/bqs/1.0#subject_type"));
ts = r->getTriplesOutOfByPredicate(subjectType);
ObjRef<iface::rdf_api::TripleEnumerator> te3 = ts->enumerateTriples();
t = te3->getNextTriple();
if (t)
{
n = t->object();
ObjRef<iface::rdf_api::Literal> l(QueryInterface(n));
std::wcout << " Subject Type=" << l->lexicalForm() << std::endl;
}
ObjRef<iface::rdf_api::URIReference> value(dsHH->getURIReference(L"http://www.w3.org/1999/02/22-rdf-syntax-ns#value"));
ts = r->getTriplesOutOfByPredicate(value);
te3 = ts->enumerateTriples();
t = te3->getNextTriple();
//.........这里部分代码省略.........