From: Jostinah L. <89...@gm...> - 2012-11-20 21:59:46
|
Hello dotnetrdf, I have already create an owl file and i'm planning to integrate the owl file into C#. i use the code below: //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// IGraph g = new Graph(); g.LoadFromFile("exData\\PregnancyInducedHypertension.owl"); try { Object results = g.ExecuteQuery("SELECT ?NamedDisease WHERE { ?s a ?NamedDisease}"); if (results is SparqlResultSet) { //SELECT/ASK queries give a SparqlResultSet SparqlResultSet rset = (SparqlResultSet)results; foreach (SparqlResult r in rset) { textBox1.Text += r.ToString() + "\r\n"; } } else if (results is IGraph) { //CONSTRUCT/DESCRIBE queries give a IGraph IGraph resGraph = (IGraph)results; foreach (Triple t in resGraph.Triples) { textBox1.Text += t.ToString() + "\r\n"; } } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// When i query the owl file,i only get this result: ?NamedDisease = http://www.w3.org/2002/07/owl#Ontology ?NamedDisease = http://www.w3.org/2002/07/owl#ObjectProperty ?NamedDisease = http://www.w3.org/2002/07/owl#ObjectProperty ?NamedDisease = http://www.w3.org/2002/07/owl#ObjectProperty ?NamedDisease = http://www.w3.org/2002/07/owl#ObjectProperty ?NamedDisease = http://www.w3.org/2002/07/owl#ObjectProperty ?NamedDisease = http://www.w3.org/2002/07/owl#ObjectProperty ?NamedDisease = http://www.w3.org/2002/07/owl#ObjectProperty........... //////////////////////////////////////////////////////////////////////////////////////////////// What i want from the result is the value of the node.not address like that.how can i do that? When i change the a into rdf:type, it show error "The Namespace URI for the given Prefix 'rdf' is not known by the in-scope NamespaceMapper" I have already read the answer in Q&A,but i cannot understand what does it mean. Do i still have to use prefix as such PREFIX rdf:< http://www.w3.org/1999/02/22-rdf-syntax-ns#> Thanks. Jostinah |