0
我創建了一個使用protege的本體論。現在我想編寫一個代碼來使用dotNetRDF遍歷本體。通過橫向的平均值,顯示所有類別中,我使用下面的代碼的子類等使用dotnetrdf遍歷一個本體論
,但它給異常**
空間URI爲給定的前綴「貓頭鷹」不是已知所述 在範圍內NamespaceMapper
OntologyGraph g = new OntologyGraph();
FileLoader.Load(g, "humanontordf.owl");
OntologyClass classOfClasses = g.CreateOntologyClass(g.CreateUriNode("owl:Class"));
//This iterates over the things that are a class
foreach (OntologyResource r in classOfClasses.Instances)
{
//Do what you want with the class
Console.WriteLine(r.ToString());
}
此代碼是上給出的答案基here(http://answers.semanticweb.com/questions/19984/dotnetrdf-list-all-ontology-classes)
任何人都可以讓我知道我在上面的代碼中缺少什麼?任何有關dotNetRDF教程的好網址?
添加提交https://bitbucket.org/dotnetrdf/dotnetrdf/commits/d87aeb97f5df63c78bfcbe3f32a920d0b06da492 – RobV
感謝您的回覆,但它沒有奏效。我使用Protege和RDF/XML生成了本體。 – mqpasta
之間我加了下面一行g.NamespaceMap.AddNamespace(「prefix」,new Uri(「http://www.qasimpasta.info/humanonto.owl#」)); – mqpasta