/** * This class shows how to encode the GEM Ontology in DAML. */ import com.hp.hpl.jena.daml.*; import com.hp.hpl.jena.daml.common.DAMLModelImpl; import com.hp.hpl.mesa.rdf.jena.model.*; import java.io.*; public class GEMOntology1 { String url="http://www.servogrid.org/schemas/GEMOntology"; String namespace=url+"#"; DAMLModel model; DAMLDatatype xsdString; public GEMOntology1() { model=new DAMLModelImpl(); DAMLOntology onto=model.createDAMLOntology(null); xsdString=model.createDAMLDatatype("http://www.w3c.org/2000/10/XMLSchema#string"); //Create a daml class DAMLClass GEMObject=model.createDAMLClass(namespace+"GEMObject"); DAMLClass GEMCode=model.createDAMLClass(namespace+"GEMCode"); GEMCode.prop_subClassOf().add(GEMObject); DAMLClass ApplCode= model.createDAMLClass(namespace+"ApplicationCode"); ApplCode.prop_subClassOf().add(GEMCode); DAMLClass VizCode= model.createDAMLClass(namespace+"VisualizationCode"); VizCode.prop_subClassOf().add(GEMCode); DAMLClass ComputeResources= model.createDAMLClass(namespace+"ComputeResources"); ComputeResources.prop_subClassOf().add(GEMObject); DAMLClass GEMData= model.createDAMLClass(namespace+"GEMData"); GEMData.prop_subClassOf().add(GEMObject); DAMLClass GEMDataFormat= model.createDAMLClass(namespace+"GEMDataFormat"); GEMDataFormat.prop_subClassOf().add(GEMDataFormat); DAMLObjectProperty installedOn= model.createDAMLObjectProperty(namespace+"installedOn"); installedOn.prop_range().add(ComputeResources); installedOn.prop_domain().add(GEMCode); DAMLObjectProperty hasCode= model.createDAMLObjectProperty(namespace+"hasCode"); hasCode.prop_domain().add(ComputeResources); hasCode.prop_range().add(GEMCode); DAMLObjectProperty hasData= model.createDAMLObjectProperty(namespace+"hasData"); hasData.prop_domain().add(ComputeResources); hasData.prop_range().add(GEMData); DAMLObjectProperty takesInputData= model.createDAMLObjectProperty(namespace+"takesInputData"); takesInputData.prop_domain().add(GEMCode); takesInputData.prop_range().add(GEMData); DAMLObjectProperty createsOutputData= model.createDAMLObjectProperty(namespace+"createsOutputData"); createsOutputData.prop_domain().add(GEMCode); createsOutputData.prop_range().add(GEMData); } public void dump(OutputStream out) throws RDFException { model.write(new PrintWriter(out),"RDF/XML-ABBREV",url); } public static void main(String[] args) throws Exception{ GEMOntology1 gd1=new GEMOntology1(); gd1.dump(System.out); } }