NRDFReactor
Port RDFReactor project to .Net (written in C#)

 

 

Port RDFReactor project to .Net (written in C#)

[About NRDFReactor]:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

 

NRDFReactor views the RDF data model through object-oriented .NET/C# proxies and makes RDF easy for C# developers. It is somewhat of RDFReactor(in Java) in .NET/C#. However, It not only implements functions of RDFReactor, it adds some features based on RDFReactor.

 

[Features]::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

 

  • Think in objects, not statements  (RDFReactor)
  • Dynamic state (RDFReactor)
  • C# interfaces are generated automatically from an RDF    Schema/OWL  (RDFReactor)
  • Context class and related operations.
    • contexts often are used for managing data aggregation and recording provenance like in Redland, Jena etc.

[Download]:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


 Version Alpha0.9  NRDFReactor_Alpha_0.9.zip(source code)

 

[License]:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

 

NRDFReactor is released under the GNU Lesser General Public License, Version 2.1, Feb. 1999.

 

[Acknowledgements]:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

 

 

 sflogo-type1  rdfreactor-logo  

[Example]:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

 

Steps of jenerating C# classes:


   1.  Write or find an RDF Schema
   2.  Generate API


      CodeGenerator.generate("schema.rdf", "./src", "nrdfreactor.example","rdfs", true, true);

 

Example Generated APIs:

 

public class WfMSContext : NRDFReactorBase {
        public WfMSContext(Model model, System.Uri uri)
            : base(model, WfMSCONTEXT, uri){}
        public void AddActivityID(string actID) {
            Add(ACTIVITYID, actID);
        }
        public void AddCurUser(Person p) {
            Add(CURUSER, p);
        }
        public void AddPara1(string para) {
            Add(PARA1, para);
        }
        ?­?­
}

public class Person : NRDFReactorBase {
    public void AddPhone(int value) {
            Add(FOAFPHONE, value);
        }
        public void AddPhone(int value, Context cxt) {
            Add(FOAFPHONE, value, cxt);
        }
        public int GetPhone(){
            return (int)Get(FOAFPHONE);
        }
        public int GetPhone(Context cxt){
            return (int)Get(FOAFPHONE);
        }
        ?­?­
}

 

3. using NRDFReactor:


Model model = RDFTKWrapper.CreateDefaultModel();
WfMSContext  wfmscxt = new WfMSContext(m,"
http://zz.com/#WfMSContext");
Person p1 = new Person(m, "
http://xx.com/#person1",wfmscxt);
Person p2 = new Person(m, "
http://yy.com/#person2",wfmscxt);

p1.setNameInCxt("Joe");
p2.setNameInCxt("Jim");
p1.addKnowsInCxt(p2);
               
Person[] p1friends = p1.getAllKnowsInCxt();
for (int i = 0; i < p1friends.length; i++) {
  System.out.println(p1.getNameInCxt()+" knows "+p1friends[i].getNameInCxt() );
}

 

 

[Authors]:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

    * Guiling Wang ( jacquette.wang AT gmail.com)