[MOBY-guts] biomoby commit

Eddie Kawas kawas at pub.open-bio.org
Wed Jul 20 20:33:22 UTC 2005


kawas
Wed Jul 20 16:33:22 EDT 2005
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources
In directory pub.open-bio.org:/tmp/cvs-serv25760/org/biomoby/client/ui/graphical/servlet/jresources

Modified Files:
	RESOURCE.java 
Log Message:
Added the generation of the moby predicate vocabulary. If you run main, you can view the RDF document describing predicates. This implementation is only temporary. Eddie

moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources RESOURCE.java,1.7,1.8
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources/RESOURCE.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources/RESOURCE.java	2005/07/19 15:32:54	1.7
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources/RESOURCE.java	2005/07/20 20:33:22	1.8
@@ -17,7 +17,6 @@
 import javax.servlet.http.HttpServletResponse;
 
 import org.biomoby.client.CentralDigestImpl;
-import org.biomoby.client.rdf.vocabulary.MobyResources;
 import org.biomoby.client.rdf.vocabulary.Predicates;
 import org.biomoby.client.rdf.vocabulary.XMLTypes;
 import org.biomoby.registry.definitions.types.JNamespaces;
@@ -52,13 +51,18 @@
  */
 
 /**
- * @author Eddie Kawas <p>Created for <p>This class was created to ... <p>For
- *         questions, comments, or bugs <p>email me at edward.kawas at gmail.com
+ * 
+ * @author Eddie Kawas
+ * <p>This class was created to replace the old perl RESOURCES script. Using this
+ * class provides access to the RDF documents describing the object, service type, 
+ * services, namespace and predicate ontologies.
+ * <p>if you have any questions, please email me at ed.kawas at gmail.com
+ *
  */
 public class RESOURCE extends HttpServlet {
 
     /**
-     * 
+     *  
      */
     private static final long serialVersionUID = 1L;
 
@@ -141,21 +145,23 @@
     private static Properties properties = MobyProperties.PROPERTIES();;
 
     private static final String OBJ = "http://"
-            + properties.getProperty("resources_script_domain")  + "/RESOURCES/MOBY-S/Objects#";
+            + properties.getProperty("resources_script_domain")
+            + "/RESOURCES/MOBY-S/Objects#";
 
     private static final String SRV = "http://"
-            + properties.getProperty("resources_script_domain")  + "/RESOURCES/MOBY-S/Services#";
+            + properties.getProperty("resources_script_domain")
+            + "/RESOURCES/MOBY-S/Services#";
 
     private static final String NS = "http://"
-            + properties.getProperty("resources_script_domain") 
+            + properties.getProperty("resources_script_domain")
             + "/RESOURCES/MOBY-S/Namespaces#";
 
     private static final String MP = "http://"
-            + properties.getProperty("resources_script_domain") 
+            + properties.getProperty("resources_script_domain")
             + "/RESOURCES/MOBY-S/Predicates#";
 
     private static final String SI = "http://"
-            + properties.getProperty("resources_script_domain") 
+            + properties.getProperty("resources_script_domain")
             + "/RESOURCES/MOBY-S/ServiceInstances#";
 
     private static boolean RUN_MAIN = false;
@@ -166,7 +172,7 @@
      * @see javax.servlet.GenericServlet#init()
      */
     public final void init() throws ServletException {
-       // super.init();
+        // super.init();
     }
 
     protected final void doGet(HttpServletRequest request,
@@ -272,6 +278,17 @@
                     writer.setProperty("showXmlDeclaration", "true");
                     writer.write(model, out, null);
                     return;
+                } else if (ontology.equals("Predicates")) {
+                    //TODO - create the predicates RDF/XML document describing
+                    // the Predicates.
+
+                    response.setContentType("application/rdf+xml");
+                    response.setHeader("Content-Disposition",
+                            "attachment;filename=Namespaces");
+                    RDFWriter writer = model.getWriter("RDF/XML-ABBREV");
+                    writer.setProperty("showXmlDeclaration", "true");
+                    writer.write(model, out, null);
+                    return;
                 } else if (ontology.equals("FULL")) {
                     try {
                         model = getAll(model);
@@ -303,7 +320,10 @@
     }
 
     /**
-     * <b>PRE: </b> <p><b>POST: </b> <p>
+     * <b>PRE: </b>
+     * <p>
+     * <b>POST: </b>
+     * <p>
      * 
      * @param model
      * @return
@@ -313,6 +333,7 @@
         model = getObjects(model);
         model = getServices(model);
         model = getNamespaces(model);
+        //TODO - add the predicates to the model.
         try {
             model = getServiceInstances(model);
         } catch (ModelException e) {
@@ -323,7 +344,10 @@
     }
 
     /**
-     * <b>PRE: </b> <p><b>POST: </b> <p>
+     * <b>PRE: </b>
+     * <p>
+     * <b>POST: </b>
+     * <p>
      * 
      * @param model
      * @return
@@ -367,9 +391,13 @@
                     .getURL()));
             subject.addProperty(DC.identifier, model
                     .createTypedLiteral("urn:lsid:"
-                            + MobyProperties.SERVICE_INSTANCE_PROPERTIES().getProperty("lsid_authority") + ":"
-                            + MobyProperties.SERVICE_INSTANCE_PROPERTIES().getProperty("lsid_namespace") + ":" +services[i].getAuthority()
-                            + "," + services[i].getName()));
+                            + MobyProperties.SERVICE_INSTANCE_PROPERTIES()
+                                    .getProperty("lsid_authority")
+                            + ":"
+                            + MobyProperties.SERVICE_INSTANCE_PROPERTIES()
+                                    .getProperty("lsid_namespace") + ":"
+                            + services[i].getAuthority() + ","
+                            + services[i].getName()));
             subject.addProperty(Predicates.performs_task, model
                     .createResource(SRV + services[i].getType()));
             subject.addProperty(Predicates.SignatureURL, model
@@ -408,7 +436,7 @@
                                     }
                                     innerBag = model.createBag();
                                     innerBag.addProperty(RDF.type,
-                                            MobyResources.Collection);
+                                            Predicates.Collection);
                                     if (!((MobyPrimaryDataSet) primaryInputs[j])
                                             .getName().equals(""))
                                         innerBag
@@ -461,8 +489,7 @@
                                                     .getDefaultValue()));
                         _li.addProperty(Predicates.datatype, model
                                 .createTypedLiteral(data.getDataType()));
-                        _li.addProperty(RDF.type,
-                                MobyResources.SecondaryArticle);
+                        _li.addProperty(RDF.type, Predicates.Secondary);
                         if (data.getDataType().equals("Integer")) {
                             _li
                                     .addProperty(Predicates.min, model
@@ -514,7 +541,7 @@
                                         produceBag = model.createBag();
                                     innerBag = model.createBag();
                                     innerBag.addProperty(RDF.type,
-                                            MobyResources.Collection);
+                                            Predicates.Collection);
                                     if (!((MobyPrimaryDataSet) outputs[j])
                                             .getName().equals(""))
                                         innerBag
@@ -559,7 +586,7 @@
 
     private final Resource createSimpleDataItem(Model model,
             MobyPrimaryDataSimple simpleData, Resource _li) {
-        _li.addProperty(RDF.type, MobyResources.SimpleArticle);
+        _li.addProperty(RDF.type, Predicates.Simple);
         _li.addProperty(Predicates.object_type, model.createResource(OBJ
                 + simpleData.getDataType().getName()));
         if (!simpleData.getName().equals(""))
@@ -578,7 +605,10 @@
     }
 
     /**
-     * <b>PRE: </b> <p><b>POST: </b> <p>
+     * <b>PRE: </b>
+     * <p>
+     * <b>POST: </b>
+     * <p>
      * 
      * @param model
      * @return
@@ -615,7 +645,10 @@
     }
 
     /**
-     * <b>PRE: </b> <p><b>POST: </b> <p>
+     * <b>PRE: </b>
+     * <p>
+     * <b>POST: </b>
+     * <p>
      * 
      * @param model
      * @return
@@ -646,7 +679,10 @@
     }
 
     /**
-     * <b>PRE: </b> <p><b>POST: </b> <p>
+     * <b>PRE: </b>
+     * <p>
+     * <b>POST: </b>
+     * <p>
      * 
      * @param model
      * @throws MobyException
@@ -664,8 +700,10 @@
         // create the base object type "class"
         Resource subject = _addClassResource(model, OBJ, "Object",
                 "a base object class consisting of a namespace and an identifier");
-        model.add(model.createStatement(subject, DC.publisher, model.createLiteral("www.illuminae.com", "en")));
-        model.add(model.createStatement(subject, DC.creator, model.createLiteral("markw at illuminae.com", "en")));
+        model.add(model.createStatement(subject, DC.publisher, model
+                .createLiteral("www.illuminae.com", "en")));
+        model.add(model.createStatement(subject, DC.creator, model
+                .createLiteral("markw at illuminae.com", "en")));
         model.add(model.createStatement(subject, RDF.type, RDFS.Class));
         for (int x = 0; x < objects.length; x++) {
             String[] _line = objects[x].split("\t");
@@ -684,7 +722,7 @@
                 obj = obj.substring(0, obj.indexOf("("));
 
             Resource _subject = _addClassResource(model, OBJ, sub, def);
-            
+
             m = Pattern.compile(".*:isa$", Pattern.CASE_INSENSITIVE).matcher(
                     pred);
             if (m.matches()) {
@@ -720,12 +758,14 @@
         map.put("serviceInstances", SI);
         map.put("mobyNamespace", NS);
         map.put("mobyService", SRV);
-        map.put("moby", MobyResources.getURI());
         model.setNsPrefixes(map);
     }
 
     /**
-     * <b>PRE: </b> <p><b>POST: </b> <p>
+     * <b>PRE: </b>
+     * <p>
+     * <b>POST: </b>
+     * <p>
      * 
      * @param model
      * @param _resource
@@ -749,7 +789,10 @@
     }
 
     /**
-     * <b>PRE: </b> <p><b>POST: </b> <p>
+     * <b>PRE: </b>
+     * <p>
+     * <b>POST: </b>
+     * <p>
      * 
      * @param model
      * @param mp2
@@ -763,7 +806,10 @@
     }
 
     /**
-     * <b>PRE: </b> <p><b>POST: </b> <p>
+     * <b>PRE: </b>
+     * <p>
+     * <b>POST: </b>
+     * <p>
      * 
      * @param model
      * @param subject
@@ -784,7 +830,8 @@
         Pattern p = Pattern.compile("urn:lsid.*:(\\S+)$");
         Matcher m = p.matcher(thing);
         String label = (m.matches() ? m.group(1) : thing);
-        //TODO - add the ofType property if thing is String, Float, Integer, DataTime.
+        //TODO - add the ofType property if thing is String, Float, Integer,
+        // DataTime.
         Resource resource = model.createResource(ns + thing);
         addOfTypeProperty(model, resource, thing);
         model.add(model.createStatement(resource, RDF.type, RDFS.Class));
@@ -796,29 +843,33 @@
     }
 
     /**
-	 * @param model
-	 * @param resource
-	 * @param thing
-	 */
-	private void addOfTypeProperty(Model model, Resource resource, String name) {
-		// make sure that we declare the ns for the datatype
-		Map map = model.getNsPrefixMap();
-		if (!map.containsValue(XMLTypes.getURI())) {
-			map.put(XMLTypes.getPrefix(), XMLTypes.getURI());
-		}
-		model.setNsPrefixes(map);
-		if (name.equalsIgnoreCase("string")) {
-			model.add(model.createStatement(resource, Predicates.ofType, XMLTypes.XSD_STRING));
-		} else if (name.equalsIgnoreCase("integer")) {
-			model.add(model.createStatement(resource, Predicates.ofType, XMLTypes.XSD_INTEGER));
-		} else if (name.equalsIgnoreCase("float")) {
-			model.add(model.createStatement(resource, Predicates.ofType, XMLTypes.XSD_FLOAT));
-		} else if (name.equalsIgnoreCase("datatime")) {
-			model.add(model.createStatement(resource, Predicates.ofType, XMLTypes.XSD_DATE_TIME));
-		}
-	}
+     * @param model
+     * @param resource
+     * @param thing
+     */
+    private void addOfTypeProperty(Model model, Resource resource, String name) {
+        // make sure that we declare the ns for the datatype
+        Map map = model.getNsPrefixMap();
+        if (!map.containsValue(XMLTypes.getURI())) {
+            map.put(XMLTypes.getPrefix(), XMLTypes.getURI());
+        }
+        model.setNsPrefixes(map);
+        if (name.equalsIgnoreCase("string")) {
+            model.add(model.createStatement(resource, Predicates.ofType,
+                    XMLTypes.XSD_STRING));
+        } else if (name.equalsIgnoreCase("integer")) {
+            model.add(model.createStatement(resource, Predicates.ofType,
+                    XMLTypes.XSD_INTEGER));
+        } else if (name.equalsIgnoreCase("float")) {
+            model.add(model.createStatement(resource, Predicates.ofType,
+                    XMLTypes.XSD_FLOAT));
+        } else if (name.equalsIgnoreCase("datatime")) {
+            model.add(model.createStatement(resource, Predicates.ofType,
+                    XMLTypes.XSD_DATE_TIME));
+        }
+    }
 
-	private final String getTypes(String type) throws MobyException {
+    private final String getTypes(String type) throws MobyException {
         if (type.equalsIgnoreCase("objects")) {
             try {
                 return new JObjects().getObjects();
@@ -848,7 +899,7 @@
     }
 
     /*
-     * 
+     *  
      */
     private String getURL(String url) {
         StringBuffer sb = new StringBuffer();
@@ -858,7 +909,7 @@
                     .openStream()));
             String inputLine;
             while ((inputLine = in.readLine()) != null)
-                sb.append(inputLine+"\n");
+                sb.append(inputLine + "\n");
             in.close();
         } catch (Exception e) {
             e.printStackTrace();
@@ -930,6 +981,12 @@
         return out.getBuffer().toString();
     }
 
+    /**
+     * 
+     * @param str 
+     * @return an RDF document describing the ontology represented by str.
+     * @throws MobyException
+     */
     public final String getRESOURCES(String str) throws MobyException {
         String name = "";
         if (str.lastIndexOf("/") > 0) {
@@ -946,12 +1003,235 @@
             return getServiceInstances();
         } else if (name.equalsIgnoreCase("Namespaces")) {
             return getNamespaces();
+        } else if (name.equalsIgnoreCase("Predicates")) {
+            return getPredicates();
         }
+
         return "";
     }
 
+    private String getPredicates() {
+        StringBuffer buffer = new StringBuffer();
+        buffer.append(
+                "<rdf:RDF\r\n" + 
+        		"   xmlns:mobyPred=\"http://biomoby.org/RESOURCES/MOBY-S/Predicates#\"\r\n" + 
+        		"   xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\r\n" + 
+        		"   xmlns:xs=\"http://www.w3.org/2001/XMLSchema#\"\r\n" + 
+        		"   xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\"\r\n" + 
+        		"   xmlns:owl=\"http://www.w3.org/2002/07/owl#\"\r\n" + 
+        		"   xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\r\n");
+        // add the predicates here
+        buffer.append(createOntologyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+                "The BioMoby Predicates Vocabulary (mobyPred)",
+                "This is the RDF Schema for the BioMoby Predicate vocabulary defined in the mobyPred namespace."));
+        
+        buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#hasa",
+                "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+                "hasa","The subject contains exactly one object.",
+                "http://www.w3.org/2000/01/rdf-schema#Property",
+                "http://www.w3.org/2000/01/rdf-schema#Class"));
+        
+        buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#has",
+                "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+                "has","The subject contains one or more object.",
+                "http://www.w3.org/2000/01/rdf-schema#Property",
+                "http://www.w3.org/2000/01/rdf-schema#Class"));
+        
+        buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#articleName",
+                "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+                "articleName","The subject is known to be named object while in a relationship.",
+                "http://www.w3.org/2000/01/rdf-schema#Property",
+                "http://www.w3.org/2000/01/rdf-schema#Literal"));
+        
+        buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#namespace_type",
+                "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+                "namespace_type","The subject resource is applicable under the object namespace.",
+                "http://www.w3.org/2000/01/rdf-schema#Class",
+                "http://www.w3.org/2000/01/rdf-schema#Resource"));
+        
+        buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#object_type",
+                "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+                "object_type","The subject resource is a resource object.",
+                "http://www.w3.org/2000/01/rdf-schema#Class",
+                "http://www.w3.org/2000/01/rdf-schema#Resource"));
+        
+        buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#consumes",
+                "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+                "consumes","The subject container takes as input object.",
+                "http://www.w3.org/2000/01/rdf-schema#Class",
+                "http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag"));
+        
+        buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#produces",
+                "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+                "produces","The subject container produces as output object.",
+                "http://www.w3.org/2000/01/rdf-schema#Class",
+                "http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag"));
+        
+        buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#performs_task",
+                "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+                "performs_task","The subject performs the task of the object resource.",
+                "http://www.w3.org/2000/01/rdf-schema#Class",
+                "http://www.w3.org/2000/01/rdf-schema#Resource"));
+        
+        buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#default_value",
+                "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+                "default_value","The subject has a default value of object.",
+                "http://www.w3.org/2000/01/rdf-schema#Class",
+                "http://www.w3.org/2000/01/rdf-schema#Literal"));
+        
+        buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#min",
+                "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+                "min","The subject has a minimum value of object.",
+                "http://www.w3.org/2000/01/rdf-schema#Class",
+                "http://www.w3.org/2000/01/rdf-schema#Literal"));
+        
+        buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#max",
+                "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+                "max","The subject has a maximum value of object.",
+                "http://www.w3.org/2000/01/rdf-schema#Class",
+                "http://www.w3.org/2000/01/rdf-schema#Literal"));
+        
+        buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#enum",
+                "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+                "enum","The subject may assume the value of object.",
+                "http://www.w3.org/2000/01/rdf-schema#Class",
+                "http://www.w3.org/2000/01/rdf-schema#Literal"));
+        
+        buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#datatype",
+                "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+                "datatype","Idiomatic property used for structured values.",
+                "http://www.w3.org/2000/01/rdf-schema#Class",
+                "http://www.w3.org/2000/01/rdf-schema#Literal"));
+        
+        buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#signatureURL",
+                "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+                "signatureURL","Object is a URL that contains information on the subject.",
+                "http://www.w3.org/2000/01/rdf-schema#Class",
+                "http://www.w3.org/2000/01/rdf-schema#Literal"));
+        
+        buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#authoritative",
+                "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+                "authoritative","The object states whether the subject is authoritative.",
+                "http://www.w3.org/2000/01/rdf-schema#Class",
+                "http://www.w3.org/2000/01/rdf-schema#Literal"));
+        
+        buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#ofType",
+                "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+                "ofType","The subject is of primitive type object.",
+                "http://www.w3.org/2000/01/rdf-schema#Class",
+                "http://www.w3.org/2000/01/rdf-schema#Literal"));
+        
+        buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#sampleInputData",
+                "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+                "sampleInputData","Object is a sample of valid input that subject can handle.",
+                "http://www.w3.org/2000/01/rdf-schema#Property",
+                "http://www.w3.org/2000/01/rdf-schema#Literal"));
+        
+        buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#sampleOutputData",
+                "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+                "sampleOutputData","Object is a sample of valid output created by running the subject.",
+                "http://www.w3.org/2000/01/rdf-schema#Property",
+                "http://www.w3.org/2000/01/rdf-schema#Literal"));
+        
+        buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#approvedBy",
+                "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+                "approvedBy","The subject has been approved by object.",
+                "http://www.w3.org/2000/01/rdf-schema#Property",
+                "http://www.w3.org/2000/01/rdf-schema#Literal"));
+        
+        buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#Simple",
+                "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+                "Simple","A class representing a simple input or output.",
+                "http://www.w3.org/2000/01/rdf-schema#Class"));
+        
+        buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary",
+                "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+                "Secondary","A class representing a secondary input.",
+                "http://www.w3.org/2000/01/rdf-schema#Class"));
+        
+        buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#Collection",
+                "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+                "Collection","A container for objects representing Simples.",
+                "http://www.w3.org/2000/01/rdf-schema#Container"));
+        
+        buffer.append(createEscapedComment("Not sure about the next 3 classes. I dont think that they are actually used anywhere. They represent the articleName of simples, collections and secondaries."));
+        
+        buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#SimpleArticle",
+                "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+                "SimpleArticle","NOT SURE",
+                "http://www.w3.org/2000/01/rdf-schema#Container"));
+        
+        buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#CollectionArticle",
+                "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+                "CollectionArticle","NOT SURE",
+                "http://www.w3.org/2000/01/rdf-schema#Container"));
+        
+        buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#SecondaryArticle",
+                "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+                "SecondaryArticle","NOT SURE",
+                "http://www.w3.org/2000/01/rdf-schema#Container"));
+        
+        
+        // end the addition of predicates here
+        buffer.append(
+                "\r\n" + 
+        		"</rdf:RDF>");
+        return buffer.toString();
+    }
+
+    private String createPropertyBlock(String about, String definedBy,
+            String label, String comment, String domain, String range) {
+        String s = 
+            "\r\n<rdf:Property rdf:about=\"" + about + "\">\r\n" + 
+        	"  <rdfs:isDefinedBy rdf:resource=\"" + definedBy + "\"/>\r\n" + 
+        	"  <rdfs:label>" + label + "</rdfs:label>\r\n" + 
+        	"  <rdfs:comment>" + comment + "</rdfs:comment>\r\n" + 
+        	"  <rdfs:range rdf:resource=\"" + range + "\"/>\r\n" + 
+        	"  <rdfs:domain rdf:resource=\"" + domain + "\"/>\r\n" + 
+        	"</rdf:Property>\r\n";
+        return s;
+    }
+
+    private String createClassBlock(String about, String definedBy,
+            String label, String comment, String subClassOf) {
+        String s = 
+            "\r\n<rdfs:Class rdf:about=\""+ about +"\">\r\n" + 
+        	"  <rdfs:isDefinedBy rdf:resource=\""+ definedBy +"\"/>\r\n" + 
+        	"  <rdfs:label>"+ label +"</rdfs:label>\r\n" + 
+        	"  <rdfs:comment>"+ comment +"</rdfs:comment>\r\n" + 
+        	"  <rdfs:subClassOf rdf:resource=\""+ subClassOf +"\"/>\r\n" + 
+        	"</rdfs:Class>\r\n";
+        return s;
+    }
+
+    private String createDescriptionBlock(String about, String[] seeAlsos) {
+        if (seeAlsos == null)
+            return "\r\n<rdf:Description rdf:about=\""+ about +"\"/>";
+        StringBuffer sb = new StringBuffer();
+        sb.append("  <rdf:Description rdf:about=\""+ about +"\">\r\n");
+        for (int x = 0; x < seeAlsos.length; x++) {
+            sb.append("  <rdfs:seeAlso rdf:resource=\"" + seeAlsos[x] + "\"/>\r\n");
+        }
+        sb.append("</rdf:Description>\r\n");
+        return sb.toString();
+    }
+
+    private String createOntologyBlock(String about, String title,
+            String description) {
+        String s ="\r\n<owl:Ontology \r\n" + "     rdf:about=\"" + about
+                + "\">\r\n" + "  <dc:title>" + title + "</dc:title>\r\n"
+                + "  <dc:description>" + description + "</dc:description>\r\n"
+                + "</owl:Ontology>\r\n";
+        return s;
+    }
+
+    private String createEscapedComment(String comment) {
+        String s = "\r\n<!-- " + comment + " -->\r\n";
+        return s;
+    }
+
     public static void main(String[] args) throws MobyException {
-        System.out.println(new RESOURCE().getRESOURCES("Objects"));
+        System.out.println(new RESOURCE().getRESOURCES("Predicates"));
     }
 
-}
+}
\ No newline at end of file




More information about the MOBY-guts mailing list