[MOBY-guts] biomoby commit

Eddie Kawas kawas at pub.open-bio.org
Tue May 31 18:11:08 UTC 2005


kawas
Tue May 31 14:11:08 EDT 2005
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder
In directory pub.open-bio.org:/tmp/cvs-serv6314/org/biomoby/client/rdf/builder

Modified Files:
	ServiceInstanceRDF.java RDFConfigure.java 
Log Message:
updated the code to use updated properties located in MobyProperties.java. Eddie

moby-live/Java/src/main/org/biomoby/client/rdf/builder ServiceInstanceRDF.java,1.2,1.3 RDFConfigure.java,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/ServiceInstanceRDF.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/ServiceInstanceRDF.java	2005/05/12 05:19:20	1.2
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/ServiceInstanceRDF.java	2005/05/31 18:11:07	1.3
@@ -40,10 +40,9 @@
  */
 
 /**
- * @author Eddie Kawas
- * <p>This class was created to present a way to retrieve a service instances' RDF using just a service name and authority.
- * <p>For questions, comments, or bugs
- * <p>email me at edward.kawas at gmail.com
+ * @author Eddie Kawas <p>This class was created to present a way to retrieve a
+ *         service instances' RDF using just a service name and authority. <p>For
+ *         questions, comments, or bugs <p>email me at edward.kawas at gmail.com
  */
 public class ServiceInstanceRDF {
 
@@ -60,26 +59,28 @@
             + System.getProperty("line.separator") + "</rdf:RDF>";
 
     /*
-     * load the properties file and set the properties 
+     * load the properties file and set the properties
      */
     private static Properties properties = MobyProperties.PROPERTIES();
 
     private static final String OBJ = "http://"
-            + properties.getProperty("domain") + "/RESOURCES/MOBY-S/Objects#";
+            + properties.getProperty("resources_script_domain")
+            + "/RESOURCES/MOBY-S/Objects#";
 
     private static final String SRV = "http://"
-            + properties.getProperty("domain") + "/RESOURCES/MOBY-S/Services#";
+            + properties.getProperty("resources_script_domain")
+            + "/RESOURCES/MOBY-S/Services#";
 
     private static final String NS = "http://"
-            + properties.getProperty("domain")
+            + properties.getProperty("resources_script_domain")
             + "/RESOURCES/MOBY-S/Namespaces#";
 
     private static final String MP = "http://"
-            + properties.getProperty("domain")
+            + properties.getProperty("resources_script_domain")
             + "/RESOURCES/MOBY-S/Predicates#";
 
     private static final String SI = "http://"
-            + properties.getProperty("domain")
+            + properties.getProperty("resources_script_domain")
             + "/RESOURCES/MOBY-S/ServiceInstances#";
 
     // the endpoint for the test server
@@ -88,15 +89,23 @@
     private final static String TEST_URI = properties.getProperty("test_uri");
 
     /**
-     *  
-     * <b>PRE:</b>name is either a valid name or null<p>
-     * <b>POST:</b>If authorURI is a valid authority, then a RDF containing all of the service instances will be returned.
-     * If authorURI and name are valid then a single RDF containing just the service instance identified by name is returned.<p>
-     * @param authorURI - the authority to query
-     * @param name - the name of the service instance if applicable or null.
-     * @param useTestMachine - if true then services are searched for on the test server, otherwise the production server is used.
-     * @return a string representing either all of services defined by authorURI, (if name is null) or a single service instances'
-     * rdf if name and authorURI are valid. If name and/or authorURI are invalid an empty rdf document is returned.
+     * 
+     * <b>PRE:</b>name is either a valid name or null<p> <b>POST:</b>If
+     * authorURI is a valid authority, then a RDF containing all of the service
+     * instances will be returned. If authorURI and name are valid then a single
+     * RDF containing just the service instance identified by name is returned.<p>
+     * 
+     * @param authorURI -
+     *            the authority to query
+     * @param name -
+     *            the name of the service instance if applicable or null.
+     * @param useTestMachine -
+     *            if true then services are searched for on the test server,
+     *            otherwise the production server is used.
+     * @return a string representing either all of services defined by
+     *         authorURI, (if name is null) or a single service instances' rdf
+     *         if name and authorURI are valid. If name and/or authorURI are
+     *         invalid an empty rdf document is returned.
      */
     public final static String findService(String authorURI, String name,
             boolean useTestMachine) {
@@ -109,19 +118,28 @@
 
     /**
      * 
-     * method that retrieves the RDF describing a specific service instance based on the parameters domain, serviceName, url and uri.
-     * <p><b>PRE:</b>None.
-     * <p><b>POST:</b>The RDF describing the service with parameters domain, serviceName, url and uri is created.
-     * @param domain - the authoring domain of the service instance in question.
-     * @param serviceName - the name of the service instance in question.
-     * @param url - the URL of the endpoint of the BioMoby registry that you would like to query. If null, the mobycentral registry is queried.
-     * @param uri - the URI of the BioMoby registry that you would like to query. If null, the mobycentral registry is queried.
-     * @return - the string representation of the RDF describing the service instance based on the parameters given.
+     * method that retrieves the RDF describing a specific service instance
+     * based on the parameters domain, serviceName, url and uri. <p><b>PRE:</b>None.
+     * <p><b>POST:</b>The RDF describing the service with parameters domain,
+     * serviceName, url and uri is created.
+     * 
+     * @param domain -
+     *            the authoring domain of the service instance in question.
+     * @param serviceName -
+     *            the name of the service instance in question.
+     * @param url -
+     *            the URL of the endpoint of the BioMoby registry that you would
+     *            like to query. If null, the mobycentral registry is queried.
+     * @param uri -
+     *            the URI of the BioMoby registry that you would like to query.
+     *            If null, the mobycentral registry is queried.
+     * @return - the string representation of the RDF describing the service
+     *         instance based on the parameters given.
      */
     public final static String findService(String domain, String serviceName,
             String url, String uri) {
         if (serviceName != null) {
-            //          variables needed
+            // variables needed
             MobyService service = null;
             MobyService[] services = null;
             Central central = null;
@@ -157,7 +175,8 @@
     }
 
     /*
-     * a method that retrieves all of the service instances based on an authoriy.
+     * a method that retrieves all of the service instances based on an
+     * authoriy.
      */
     private final static String getAllServices(String URI,
             boolean useTestMachine) {
@@ -239,20 +258,19 @@
     }
 
     /*
-     * method that actually creates the rdf based on one or more services contained in the array services
+     * method that actually creates the rdf based on one or more services
+     * contained in the array services
      */
     private final static String createRDF(MobyService[] services) {
         Model model = ModelFactory.createDefaultModel();
         // set up the prefixes/namespaces
         Map map = model.getNsPrefixMap();
         map.put("mobyPred", Predicates.getURI());
-        map.put("mobyObject", "http://biomoby.org/RESOURCES/MOBY-S/Objects#");
-        map.put("serviceInstances",
-                "http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#");
-        map.put("mobyNamespace",
-                "http://biomoby.org/RESOURCES/MOBY-S/Namespaces#");
-        map.put("mobyService", "http://biomoby.org/RESOURCES/MOBY-S/Services#");
-        map.put("moby", "http://biomoby.org/RESOURCES/MOBY-S/MOBYResources#");
+        map.put("mobyObject", OBJ);
+        map.put("serviceInstances", SI);
+        map.put("mobyNamespace", NS);
+        map.put("mobyService", SRV);
+        map.put("moby", MobyResources.getURI());
         model.setNsPrefixes(map);
 
         for (int i = 0; i < services.length; i++) {
@@ -340,7 +358,7 @@
                             }
                         }
                         if (innerBag != null && innerBag.size() > 0) {
-                            //TODO
+                            // TODO
                             consumeBag.add(innerBag);
                         }
 
@@ -443,7 +461,7 @@
                                 return null;
                             }
                         }
-                        if (innerBag != null /*&& innerBag.size() > 0*/) {
+                        if (innerBag != null /* && innerBag.size() > 0 */) {
                             produceBag.add(innerBag);
                         }
                     } else {
@@ -489,7 +507,7 @@
     }
 
     /*
-     * convenience method that creates a mobyPred:Simple 
+     * convenience method that creates a mobyPred:Simple
      */
     private final static Resource createSimpleDataItem(Model model,
             MobyPrimaryDataSimple simpleData, Resource _li) {
@@ -505,19 +523,24 @@
                 MobyNamespace mns = ns[k];
                 _li.addProperty(Predicates.namespace_type, model
                         .createResource(NS + mns.getName()));
-                //.addProperty(RDF.type, RDFS.Class));
+                // .addProperty(RDF.type, RDFS.Class));
             }
         }
         return _li;
     }
 
     /**
-     *  
-     * <b>PRE:</b>None<p>
-     * <b>POST:</b>If a service instance exists such that it has a name of name and an authoring URI of uri true is returned, otherwise false is returned.<p>
-     * @param uri - the authors uri
-     * @param name - the name of the service instance
-     * @return true if a service instance exists with authority uri, and name name, otherwise false is returned.
+     * 
+     * <b>PRE:</b>None<p> <b>POST:</b>If a service instance exists such that
+     * it has a name of name and an authoring URI of uri true is returned,
+     * otherwise false is returned.<p>
+     * 
+     * @param uri -
+     *            the authors uri
+     * @param name -
+     *            the name of the service instance
+     * @return true if a service instance exists with authority uri, and name
+     *         name, otherwise false is returned.
      */
     public final static boolean serviceInstanceExists(String uri, String name) {
         Central central = null;
@@ -542,15 +565,16 @@
     }
 
     /**
-     *  
+     * 
      * Usage: ServiceInstanceRDF <i>authorityURI</i> <i>[serviceName]</i><p>
      * <b>authorityURI:</b> is the authortitys' domain to query<p>
-     * <b>serviceName:</b>optional argument that identifies a specific service instance<p>
+     * <b>serviceName:</b>optional argument that identifies a specific service
+     * instance<p>
+     * 
      * @throws LSIDException
      */
     public final static void main(String[] args) throws LSIDException {
-        System.out.println("1:\n"
-                + findService("www.test.com", null, false));
+        System.out.println("1:\n" + findService("www.test.com", null, false));
     }
 }
 

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/RDFConfigure.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/RDFConfigure.java	2005/04/07 16:42:29	1.1
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/RDFConfigure.java	2005/05/31 18:11:07	1.2
@@ -46,15 +46,15 @@
     /*
      * Some constants for use in the rdfs
      */
-    final public static String URI_OBJECT = "http://" + properties.getProperty("domain") +"/RESOURCES/MOBY-S/Objects#";
+    final public static String URI_OBJECT = "http://" + properties.getProperty("resources_script_domain") +"/RESOURCES/MOBY-S/Objects#";
 
-    final public static String URI_SERVICE = "http://" + properties.getProperty("domain") +"/RESOURCES/MOBY-S/Services#";
+    final public static String URI_SERVICE = "http://" + properties.getProperty("resources_script_domain") +"/RESOURCES/MOBY-S/Services#";
 
-    final public static String URI_NAMESPACE = "http://" + properties.getProperty("domain") +"/RESOURCES/MOBY-S/Namespaces#";
+    final public static String URI_NAMESPACE = "http://" + properties.getProperty("resources_script_domain") +"/RESOURCES/MOBY-S/Namespaces#";
 
-    final public static String URI_PREDICATE = "http://" + properties.getProperty("domain") +"/RESOURCES/MOBY-S/Predicates#";
+    final public static String URI_PREDICATE = "http://" + properties.getProperty("resources_script_domain") +"/RESOURCES/MOBY-S/Predicates#";
 
-    final public static String URI_ServiceINSTANCE = "http://" + properties.getProperty("domain") +"/RESOURCES/MOBY-S/ServiceInstances#";
+    final public static String URI_ServiceINSTANCE = "http://" + properties.getProperty("resources_script_domain") +"/RESOURCES/MOBY-S/ServiceInstances#";
 
     private Model model = null;
 




More information about the MOBY-guts mailing list