문제

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!

도움이 되었습니까?

해결책 2

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

다른 팁

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.

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top