sstauross
sstauross

Reputation: 2680

SemWeb - Convert C# object into RDF triples

All i want is to convert a C# class instance into rdf triples using semweb, in order to fill my ontology with data. My class consists of both primitive properties and other classes and i have constructed an ontology with the same structure. e.g.

class Place{

string name;
Image  pic;

}

Is there any resource that could help?

Thanks in advance!

Upvotes: 0

Views: 878

Answers (3)

user1358444
user1358444

Reputation: 88

When I worked with rdf data I created 3 URI nodes
n1, n2, n3. Then,
Triple t = new Triple(n1, n2, n3);
IGraph g = new Graph();

g.Assert(t);
store.Add(g);

I hope this will help you.

Upvotes: 0

sstauross
sstauross

Reputation: 2680

The answer is to use C# reflection in order to investigate the properties and classes of the instance you want to convert and use the:

store.Add( new Statement( subject, predicate, object ) 

in order to write the triples you want as very well documented in the SemWeb Documentation

Upvotes: 0

RobV
RobV

Reputation: 28675

You do realize that SemWeb is abandon-ware and hasn't received a new release in almost 3 years right? If you really want to use SemWeb then take a look at LinqToRdf which is even more adandonware (last release 4 and a half years ago) but provides an ORM style layer to convert C# classes to and from RDF using attribute based annotations.

For some more recent and actively maintained alternatives see either BrightStarDB or RomanticWeb, BrightstarDB is the more mature solution in this space.

If you prefer to roll your own solution you could look at dotNetRDF (disclaimer - I develop this) which is the library used as the basis for BrightStarDB and RomanticWeb.

Upvotes: 3

Related Questions