1 package org.snipsnap.serialization.rdf; 2 3 import java.util.*; 4 import com.hp.hpl.jena.daml.*; 5 import java.io.Writer ; 6 import com.hp.hpl.jena.daml.common.*; 7 import com.hp.hpl.mesa.rdf.jena.model.*; 8 9 import org.snipsnap.snip.Snip; 10 import org.snipsnap.serialization.rdf.vocabulary.*; 11 12 public class DAMLSerializer extends RDFSerializerBase { 13 14 public DAMLSerializer(int outputFormat) { 15 super(outputFormat); 16 } 17 18 protected Model createModel() { 19 return new DAMLModelImpl(); 20 } 21 22 protected void addSingleSnipToModel(Snip snip, Model m) throws RDFException { 23 DAMLModelImpl model = (DAMLModelImpl)m; 24 String snipName = snip.getName(); 25 String snipContent = snip.getContent(); 26 System.out.println("**** SnipDAMLSerializer is serializing snip \"" + snip.getName() + "\" (dummy) ... "); 27 DAMLClass snipClass = model.createDAMLClass(SNIP.getURI() + "snip"); 29 DAMLInstance snipInstance = model.createDAMLInstance(snipClass, _uriPrefix + '#' + snip.getName()); 30 DAMLObjectProperty prop = model.createDAMLObjectProperty(SNIP.getURI() + "name"); 31 snipInstance.addProperty(prop, snipName); 32 prop = model.createDAMLObjectProperty(SNIP.getURI() + "content"); 33 snipInstance.addProperty(prop, snipContent); 34 35 49 } 50 51 protected void writeModel(Model model, Writer writer) throws RDFException { 52 } 53 54 protected void recursiveFillModel(Snip snip, Model model, int depth) throws RDFException { 55 } 56 } 57 | Popular Tags |