মঙ্গলবার, ২৭ ডিসেম্বর, ২০১১

RDF Representation in Jena Ai

English: RDF graph for Eric Miller provided as...Image via jena.sourceforge
RDF N-triple can represent with RDF model. RDF is best thought of in the form of node and arc diagrams. A simple vcard might look like this in RDF:


Ellipse represents the Resources of the concept.
Arc represents the Properties of the concept.
Rectangle represents the literal/Resources of the concept.
Source Code:

package tutorial;
import com.hp.hpl.jena.rdf.model.*;
import com.hp.hpl.jena.vocabulary.*;
//Tutorial 1 creating a simple model
public class Tutorial01 extends Object {
    // some definitions
    static String personURI    = "http://somewhere/JohnSmith";
    static String fullName     = "John Smith";

    public static void main (String args[]) {
     
     // create an empty model
     Model model = ModelFactory.createDefaultModel();
     // create the resource
      Resource johnSmith = model.createResource(personURI);
       // add the property
       johnSmith.addProperty(VCARD.FN, fullName);
          model.write(System.out,"Turtle");    
      }
}


Enhanced by Zemanta

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন