braham alboshi braham alboshi - 1 year ago 206
C# Question

Read RDF/XML file in c#

i'm struggling with reading OWL file in c# and i want to solve this problem, because i'm new to the semantic web world
I have read about the dotnetrdf library which is used for reading OWL file in c# and
through their documentation I found example about the Hello world
my question here
when i put the code

IGraph g = new Graph();
IUriNode dotNetRDF = g.CreateUriNode(UriFactory.Create(""));
IUriNode says = g.CreateUriNode(UriFactory.Create(""));
ILiteralNode helloWorld = g.CreateLiteralNode("Hello World");
ILiteralNode bonjourMonde = g.CreateLiteralNode("Bonjour tout le Monde", "fr");

g.Assert(new Triple(dotNetRDF, says, helloWorld));
g.Assert(new Triple(dotNetRDF, says, bonjourMonde));
foreach (Triple t in g.Triples)

it give me the output like this , , Hello World , , Bonjour tout le Monde@fr

so how can i display the result without the URI, please any idea about this???

Answer Source

With Console.WriteLine(t.ToString()) a string representation of the Triple objects is printed to the console. If you want to access a specific member (have a look at then you can access directly. e.g.

foreach (Triple t in g.Triples)

Hope this helps.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download