[MOBY-guts] biomoby commit
Eddie Kawas
kawas at pub.open-bio.org
Wed Mar 15 16:22:38 UTC 2006
kawas
Wed Mar 15 11:22:38 EST 2006
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-serv32102/org/biomoby/client/ui/graphical/servlet/jresources
Modified Files:
RESOURCE.java
Log Message:
updated RDF generators and clients so that LSIDs with versioining information is used. This is only preliminary. More updates to come
moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources RESOURCE.java,1.13,1.14
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources/RESOURCE.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources/RESOURCE.java 2006/01/03 19:24:15 1.13
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources/RESOURCE.java 2006/03/15 16:22:38 1.14
@@ -19,17 +19,15 @@
import javax.servlet.http.HttpServletResponse;
import org.biomoby.client.CentralDigestImpl;
+import org.biomoby.client.CentralImpl;
import org.biomoby.client.rdf.builder.ServiceInstanceRDF;
import org.biomoby.client.rdf.vocabulary.Predicates;
-import org.biomoby.client.rdf.vocabulary.XMLTypes;
import org.biomoby.registry.definitions.types.JNamespacesSqlImpl;
import org.biomoby.registry.definitions.types.JObjectsSqlImpl;
import org.biomoby.registry.definitions.types.JServicesSqlImpl;
-import org.biomoby.registry.properties.RegistryOS;
+import org.biomoby.shared.Central;
import org.biomoby.shared.CentralDigest;
import org.biomoby.shared.MobyException;
-import org.biomoby.shared.MobyNamespace;
-import org.biomoby.shared.MobyPrimaryDataSimple;
import org.biomoby.shared.MobyService;
import org.w3c.rdf.model.ModelException;
@@ -51,336 +49,352 @@
/**
*
* @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
- *
+ * <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;
-
- private static final String Four0FourError = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">"
- + "<html>"
- + "<head><script language=\"Javascript\">"
- + "tl=new Array(\"The requested document is no more.\","
- + "\"No file found.\","
- + "\"Even tried multi.\","
- + "\"Nothing helped.\","
- + "\"I'm really depressed about this.\","
- + "\"You see, I'm just a web server...\","
- + "\"-- here I am, brain the size of the universe,\","
- + "\"trying to serve you a simple web page,\","
- + "\"and then it doesn't even exist!\","
- + "\"Where does that leave me?!\","
- + "\"I mean, I don't even know you.\","
- + "\"How should I know what you wanted from me?\","
- + "\"You honestly think I can *guess*\","
- + "\"what someone I don't even *know*\","
- + "\"wants to find here?\","
- + "\"*sigh*\","
- + "\"Man, I'm so depressed I could just cry.\","
- + "\"And then where would we be, I ask you?\","
- + "\"It's not pretty when a web server cries.\","
- + "\"And where do you get off telling me what to show anyway?\","
- + "\"Just because I'm a web server,\","
- + "\"and possibly a manic depressive one at that?\","
- + "\"Why does that give you the right to tell me what to do?\","
- + "\"Huh?\","
- + "\"I'm so depressed...\","
- + "\"I think I'll crawl off into the trash can and decompose.\","
- + "\"I mean, I'm gona be obsolete in what, two weeks anyway?\","
- + "\"What kind of a life is that?\",\"Two effing weeks,\","
- + "\"and then I'll be replaced by a .01 release,\","
- + "\"that thinks it's God's gift to web servers,\","
- + "\"just because it doesn't have some tiddly little\","
- + "\"security hole with its HTTP POST implementation,\","
- + "\"or something.\",\"I'm really sorry to burden you with all this,\","
- + "\"I mean, it's not your job to listen to my problems,\","
- + "\"and I guess it is my job to go and fetch web pages for you.\","
- + "\"But I couldn't get this one.\","
- + "\"I'm so sorry.\","
- + "\"Believe me!\","
- + "\"Maybe I could interest you in another page?\","
- + "\"There are a lot out there that are pretty neat, they say,\","
- + "\"although none of them were put on *my* server, of course.\","
- + "\"Figures, huh?\","
- + "\"Everything here is just mind-numbingly stupid.\","
- + "\"That makes me depressed too, since I have to serve them,\","
- + "\"all day and all night long.\","
- + "\"Two weeks of information overload,\","
- + "\"and then *pffftt*, consigned to the trash.\","
- + "\"What kind of a life is that?\","
- + "\"Now, please le me sulk alone.\","
- + "\"I'm so depressed.\");"
- + "var speed=60;"
- + "var index=0;"
- + "text_pos=0;"
- + "var str_length=tl[0].length;"
- + "var contents, row;"
- + "function type_text(){"
- + " contents='';"
- + " row=Math.max(0,index-7);"
- + " while(row<index)"
- + " contents += tl[row++] + '\\n';"
- + " document.forms[0].elements[0].value = contents + tl[index].substring(0,text_pos) + \"_\";"
- + " if(text_pos++==str_length) {"
- + " text_pos=0;"
- + " index++;"
- + " if(index!=tl.length) {"
- + " str_length=tl[index].length;"
- + " setTimeout(\"type_text()\",1500);"
- + " }"
- + " } else"
- + " setTimeout(\"type_text()\",speed);"
- + " }</script>"
- + "<title>Apache Tomcat - Error report</title><STYLE><!--H1{font-family : sans-serif,Arial,Tahoma;color : white;background-color : #0086b2;} H3{font-family : sans-serif,Arial,Tahoma;color : white;background-color : #0086b2;} BODY{font-family : sans-serif,Arial,Tahoma;color : black;background-color : white;} B{color : white;background-color : #0086b2;} HR{color : #0086b2;} --></STYLE> </head><body onLoad=\"javascript:type_text();\"><h1>HTTP Status 404 - Resource not found </h1><HR size=\"1\" noshade=\"noshade\"><p><b>type</b> Status report</p><p><b>message</b> <u>The requested resource was not found. </u></p><p><b>description</b> <u>The requested resource () is not available.</u></p><HR size=\"1\" noshade=\"noshade\"><form name=\"form1\" method=\"post\" action=\"\"> <textarea name=\"txtField\" cols=\"82\" rows=\"8\" id=\"txtField\"></textarea></form><h3> </h3></body></html>";
-
-
- private static final String OBJ = "http://biomoby.org/RESOURCES/MOBY-S/Objects#";
-
- private static final String SRV = "http://biomoby.org/RESOURCES/MOBY-S/Services#";
-
- private static final String NS = "http://biomoby.org/RESOURCES/MOBY-S/Namespaces#";
-
- private static final String MP = "http://biomoby.org/RESOURCES/MOBY-S/Predicates#";
-
- private static final String SI = "http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#";
-
- private static boolean RUN_MAIN = false;
-
- /*
- * (non-Javadoc)
- *
- * @see javax.servlet.GenericServlet#init()
- */
- public final void init() throws ServletException {
- // super.init();
- // try to load environment variables set in context.xml
- try {
- Context c = new InitialContext();
- String MOBY_CENTRAL_CONFIG = (String) c.lookup("java:comp/env/MOBY_CENTRAL_CONFIG");
- String MOBY_SERVER = (String) c.lookup("java:comp/env/MOBY_SERVER");
- String MOBY_URI = (String) c.lookup("java:comp/env/MOBY_URI");
- if (MOBY_CENTRAL_CONFIG != null && !MOBY_CENTRAL_CONFIG.equals("")) {
- // set MOBY_CENTRAL_CONFIG
- System.setProperty("MOBY_CENTRAL_CONFIG",MOBY_CENTRAL_CONFIG);
- }
- if (MOBY_SERVER != null && !MOBY_SERVER.equals("")) {
- // set MOBY_SERVER
- System.setProperty("MOBY_SERVER",MOBY_SERVER);
- }
- if (MOBY_URI != null && !MOBY_URI.equals("")) {
- // set MOBY_URI
- System.setProperty("MOBY_URI",MOBY_URI);
- }
-
- } catch (Exception e) {}
- }
-
- protected final void doGet(HttpServletRequest request,
- HttpServletResponse response) throws ServletException, IOException {
- PrintWriter out = response.getWriter();
- String path = request.getPathInfo();
- Pattern p = Pattern.compile("/MOBY\\-S/(\\S+)");
- Matcher m = p.matcher(path);
- if (path == null || !m.matches()) {
- out
- .println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"> <html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"><title>not MOBY-S</title></head><body><h2>not MOBY-S </h2></body></html>");
- return;
- } else {
- String ontology = m.group(1);
- if (ontology.equals("Objects") || ontology.equals("Namespaces")
- || ontology.equals("ServiceInstances")
- || ontology.equals("FULL") || ontology.equals("Predicates")
- || ontology.equals("Services")|| ontology.equals("ServiceDescription")) {
- // generate rdf
- Model model = ModelFactory.createDefaultModel();
- createNsMap(model);
- if (ontology.equals("Objects")) {
- try {
- model = getObjects(model);
- } catch (MobyException e) {
- response.sendError(HttpServletResponse.SC_BAD_REQUEST,
- "Could not get Objects");
- e.printStackTrace();
- return;
- }
- if (model == null) {
- response.sendError(HttpServletResponse.SC_BAD_REQUEST,
- "Cound not create model");
- return;
- }
- response.setContentType("application/rdf+xml");
- response.setHeader("Content-Disposition",
- "attachment;filename=Objects");
- RDFWriter writer = model.getWriter("RDF/XML-ABBREV");
- writer.setProperty("showXmlDeclaration", "true");
- writer.write(model, out, null);
- return;
- } else if (ontology.equals("Namespaces")) {
- try {
- model = getNamespaces(model);
- } catch (MobyException e) {
- response.sendError(HttpServletResponse.SC_BAD_REQUEST,
- "Could not get Namespaces");
- e.printStackTrace();
- return;
- }
- if (model == null) {
- response.sendError(HttpServletResponse.SC_BAD_REQUEST,
- "Cound not create model");
- return;
- }
- 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("Services")) {
- try {
- model = getServices(model);
- } catch (MobyException e) {
- response.sendError(HttpServletResponse.SC_BAD_REQUEST,
- "Could not get Services");
- e.printStackTrace();
- return;
- }
- if (model == null) {
- response.sendError(HttpServletResponse.SC_BAD_REQUEST,
- "Cound not create model");
- return;
- }
- response.setContentType("application/rdf+xml");
- response.setHeader("Content-Disposition",
- "attachment;filename=Service");
- RDFWriter writer = model.getWriter("RDF/XML-ABBREV");
- writer.setProperty("showXmlDeclaration", "true");
- writer.write(model, out, null);
- return;
- } else if (ontology.equals("ServiceInstances")) {
- try {
- model = getServiceInstances(model);
- } catch (Exception e) {
- response.sendError(HttpServletResponse.SC_BAD_REQUEST,
- "Could not get ServiceInstances");
- e.printStackTrace();
- return;
- }
- if (model == null) {
- response.sendError(HttpServletResponse.SC_BAD_REQUEST,
- "Cound not create model");
- return;
- }
- response.setContentType("application/rdf+xml");
- response.setHeader("Content-Disposition",
- "attachment;filename=ServiceInstances");
- RDFWriter writer = model.getWriter("RDF/XML-ABBREV");
- writer.setProperty("showXmlDeclaration", "true");
- writer.write(model, out, null);
- return;
- } else if (ontology.equals("Predicates")) {
- String s = getPredicates();
-
- response.setContentType("application/rdf+xml");
- response.setHeader("Content-Disposition",
- "attachment;filename=Predicates");
- out.write(s);
- out.close();
- return;
- } else if (ontology.equals("ServiceDescription")) {
- response.setContentType("application/rdf+xml");
- response.setHeader("Content-Disposition",
- "attachment;filename=ServiceDescription");
- out.write(serviceDescriptionVocabulary);
- out.close();
- return;
- } else if (ontology.equals("FULL")) {
- try {
- model = getAll(model);
- } catch (Exception e) {
- response.sendError(HttpServletResponse.SC_BAD_REQUEST,
- "Could not get All");
- e.printStackTrace();
- return;
- }
- if (model == null) {
- response.sendError(HttpServletResponse.SC_BAD_REQUEST,
- "Cound not create model");
- return;
- }
- response.setContentType("application/rdf+xml");
- response.setHeader("Content-Disposition",
- "attachment;filename=All");
- RDFWriter writer = model.getWriter("RDF/XML-ABBREV");
- writer.setProperty("showXmlDeclaration", "true");
- writer.write(model, out, null);
- return;
- }
- } else {
- // response.sendError(HttpServletResponse.SC_NOT_FOUND);
- out.println(RESOURCE.Four0FourError);
- return;
- }
- }
- }
-
- /**
- * <b>PRE: </b>
- * <p>
- * <b>POST: </b>
- * <p>
- *
- * @param model a model that we can add statements to.
- * @return an rdf model that contains all of the moby objects.
- * @throws MobyException
- */
- public final Model getAll(Model model) throws Exception {
- model = getObjects(model);
- model = getServices(model);
- model = getNamespaces(model);
- // add the predicates to the model
- RDFReader reader = model.getReader();
- reader.read(model, new ByteArrayInputStream(getPredicates().getBytes()), null);
- try {
- model = getServiceInstances(model);
- } catch (ModelException e) {
- e.printStackTrace();
- return null;
- }
- return model;
- }
-
- /**
- * <b>PRE: </b>
- * <p>
- * <b>POST: </b>
- * <p>
- *
- * @param model
- * @return
- * @throws ModelException
- */
- private final Model getServiceInstances(Model model) throws Exception {
- if (RUN_MAIN) {
- createNsMap(model);
- }
- CentralDigest central = null;
- MobyService[] services = null;
- try {
- // TODO should i make this more general by adding a parameter for the endpoint?
- String registryURL;
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private static final String Four0FourError = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">"
+ + "<html>"
+ + "<head><script language=\"Javascript\">"
+ + "tl=new Array(\"The requested document is no more.\","
+ + "\"No file found.\","
+ + "\"Even tried multi.\","
+ + "\"Nothing helped.\","
+ + "\"I'm really depressed about this.\","
+ + "\"You see, I'm just a web server...\","
+ + "\"-- here I am, brain the size of the universe,\","
+ + "\"trying to serve you a simple web page,\","
+ + "\"and then it doesn't even exist!\","
+ + "\"Where does that leave me?!\","
+ + "\"I mean, I don't even know you.\","
+ + "\"How should I know what you wanted from me?\","
+ + "\"You honestly think I can *guess*\","
+ + "\"what someone I don't even *know*\","
+ + "\"wants to find here?\","
+ + "\"*sigh*\","
+ + "\"Man, I'm so depressed I could just cry.\","
+ + "\"And then where would we be, I ask you?\","
+ + "\"It's not pretty when a web server cries.\","
+ + "\"And where do you get off telling me what to show anyway?\","
+ + "\"Just because I'm a web server,\","
+ + "\"and possibly a manic depressive one at that?\","
+ + "\"Why does that give you the right to tell me what to do?\","
+ + "\"Huh?\","
+ + "\"I'm so depressed...\","
+ + "\"I think I'll crawl off into the trash can and decompose.\","
+ + "\"I mean, I'm gona be obsolete in what, two weeks anyway?\","
+ + "\"What kind of a life is that?\",\"Two effing weeks,\","
+ + "\"and then I'll be replaced by a .01 release,\","
+ + "\"that thinks it's God's gift to web servers,\","
+ + "\"just because it doesn't have some tiddly little\","
+ + "\"security hole with its HTTP POST implementation,\","
+ + "\"or something.\",\"I'm really sorry to burden you with all this,\","
+ + "\"I mean, it's not your job to listen to my problems,\","
+ + "\"and I guess it is my job to go and fetch web pages for you.\","
+ + "\"But I couldn't get this one.\","
+ + "\"I'm so sorry.\","
+ + "\"Believe me!\","
+ + "\"Maybe I could interest you in another page?\","
+ + "\"There are a lot out there that are pretty neat, they say,\","
+ + "\"although none of them were put on *my* server, of course.\","
+ + "\"Figures, huh?\","
+ + "\"Everything here is just mind-numbingly stupid.\","
+ + "\"That makes me depressed too, since I have to serve them,\","
+ + "\"all day and all night long.\","
+ + "\"Two weeks of information overload,\","
+ + "\"and then *pffftt*, consigned to the trash.\","
+ + "\"What kind of a life is that?\","
+ + "\"Now, please le me sulk alone.\","
+ + "\"I'm so depressed.\");"
+ + "var speed=60;"
+ + "var index=0;"
+ + "text_pos=0;"
+ + "var str_length=tl[0].length;"
+ + "var contents, row;"
+ + "function type_text(){"
+ + " contents='';"
+ + " row=Math.max(0,index-7);"
+ + " while(row<index)"
+ + " contents += tl[row++] + '\\n';"
+ + " document.forms[0].elements[0].value = contents + tl[index].substring(0,text_pos) + \"_\";"
+ + " if(text_pos++==str_length) {"
+ + " text_pos=0;"
+ + " index++;"
+ + " if(index!=tl.length) {"
+ + " str_length=tl[index].length;"
+ + " setTimeout(\"type_text()\",1500);"
+ + " }"
+ + " } else"
+ + " setTimeout(\"type_text()\",speed);"
+ + " }</script>"
+ + "<title>Apache Tomcat - Error report</title><STYLE><!--H1{font-family : sans-serif,Arial,Tahoma;color : white;background-color : #0086b2;} H3{font-family : sans-serif,Arial,Tahoma;color : white;background-color : #0086b2;} BODY{font-family : sans-serif,Arial,Tahoma;color : black;background-color : white;} B{color : white;background-color : #0086b2;} HR{color : #0086b2;} --></STYLE> </head><body onLoad=\"javascript:type_text();\"><h1>HTTP Status 404 - Resource not found </h1><HR size=\"1\" noshade=\"noshade\"><p><b>type</b> Status report</p><p><b>message</b> <u>The requested resource was not found. </u></p><p><b>description</b> <u>The requested resource () is not available.</u></p><HR size=\"1\" noshade=\"noshade\"><form name=\"form1\" method=\"post\" action=\"\"> <textarea name=\"txtField\" cols=\"82\" rows=\"8\" id=\"txtField\"></textarea></form><h3> </h3></body></html>";
+
+ private static final String OBJ = "http://biomoby.org/RESOURCES/MOBY-S/Objects#";
+
+ private static final String SRV = "http://biomoby.org/RESOURCES/MOBY-S/Services#";
+
+ private static final String NS = "http://biomoby.org/RESOURCES/MOBY-S/Namespaces#";
+
+ private static final String MP = "http://biomoby.org/RESOURCES/MOBY-S/Predicates#";
+
+ private static final String SI = "http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#";
+
+ private static boolean RUN_MAIN = false;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.servlet.GenericServlet#init()
+ */
+ public final void init() throws ServletException {
+ // super.init();
+ // try to load environment variables set in context.xml
+ System.out.println("init(setting environment variables)");
+ try {
+ Context c = new InitialContext();
+
+ try {
+ String MOBY_CENTRAL_CONFIG = null;
+ MOBY_CENTRAL_CONFIG = (String) c.lookup("java:comp/env/MOBY_CENTRAL_CONFIG");
+ if (MOBY_CENTRAL_CONFIG != null && !MOBY_CENTRAL_CONFIG.equals("")) {
+ // set MOBY_CENTRAL_CONFIG
+ System.out.println("init(setting MOBY_CENTRAL_CONFIG)");
+ System.setProperty("MOBY_CENTRAL_CONFIG", MOBY_CENTRAL_CONFIG);
+ }
+
+ } catch (Exception ex) {
+ }
+ try {
+ String MOBY_SERVER = null;
+ MOBY_SERVER = (String) c.lookup("java:comp/env/MOBY_SERVER");
+ if (MOBY_SERVER != null && !MOBY_SERVER.equals("")) {
+ // set MOBY_SERVER
+ System.out.println("init(setting MOBY_SERVER)");
+ System.setProperty("MOBY_SERVER", MOBY_SERVER);
+ }
+ } catch (Exception ex) {
+ }
+
+ try {
+ String MOBY_URI = null;
+ MOBY_URI = (String) c.lookup("java:comp/env/MOBY_URI");
+ if (MOBY_URI != null && !MOBY_URI.equals("")) {
+ // set MOBY_URI
+ System.out.println("init(setting MOBY_URI)");
+ System.setProperty("MOBY_URI", MOBY_URI);
+ }
+ } catch (Exception ex) {
+ }
+
+ } catch (Exception e) {
+ }
+ }
+
+ protected final void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ PrintWriter out = response.getWriter();
+ String path = request.getPathInfo();
+ Pattern p = Pattern.compile("/MOBY\\-S/(\\S+)");
+ Matcher m = p.matcher(path);
+ if (path == null || !m.matches()) {
+ out
+ .println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"> <html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"><title>not MOBY-S</title></head><body><h2>not MOBY-S </h2></body></html>");
+ return;
+ } else {
+ String ontology = m.group(1);
+ if (ontology.equals("Objects") || ontology.equals("Namespaces")
+ || ontology.equals("ServiceInstances") || ontology.equals("FULL")
+ || ontology.equals("Predicates") || ontology.equals("Services")
+ || ontology.equals("ServiceDescription")) {
+ // generate rdf
+ Model model = ModelFactory.createDefaultModel();
+ createNsMap(model);
+ if (ontology.equals("Objects")) {
+ try {
+ model = getObjects(model);
+ } catch (MobyException e) {
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST,
+ "Could not get Objects");
+ e.printStackTrace();
+ return;
+ }
+ if (model == null) {
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST,
+ "Cound not create model");
+ return;
+ }
+ response.setContentType("application/rdf+xml");
+ response.setHeader("Content-Disposition", "attachment;filename=Objects");
+ RDFWriter writer = model.getWriter("RDF/XML-ABBREV");
+ writer.setProperty("showXmlDeclaration", "true");
+ writer.write(model, out, null);
+ return;
+ } else if (ontology.equals("Namespaces")) {
+ try {
+ model = getNamespaces(model);
+ } catch (MobyException e) {
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST,
+ "Could not get Namespaces");
+ e.printStackTrace();
+ return;
+ }
+ if (model == null) {
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST,
+ "Cound not create model");
+ return;
+ }
+ 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("Services")) {
+ try {
+ model = getServices(model);
+ } catch (MobyException e) {
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST,
+ "Could not get Services");
+ e.printStackTrace();
+ return;
+ }
+ if (model == null) {
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST,
+ "Cound not create model");
+ return;
+ }
+ response.setContentType("application/rdf+xml");
+ response.setHeader("Content-Disposition", "attachment;filename=Service");
+ RDFWriter writer = model.getWriter("RDF/XML-ABBREV");
+ writer.setProperty("showXmlDeclaration", "true");
+ writer.write(model, out, null);
+ return;
+ } else if (ontology.equals("ServiceInstances")) {
+ try {
+ model = getServiceInstances(model);
+ } catch (Exception e) {
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST,
+ "Could not get ServiceInstances");
+ e.printStackTrace();
+ return;
+ }
+ if (model == null) {
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST,
+ "Cound not create model");
+ return;
+ }
+ response.setContentType("application/rdf+xml");
+ response.setHeader("Content-Disposition",
+ "attachment;filename=ServiceInstances");
+ RDFWriter writer = model.getWriter("RDF/XML-ABBREV");
+ writer.setProperty("showXmlDeclaration", "true");
+ writer.write(model, out, null);
+ return;
+ } else if (ontology.equals("Predicates")) {
+ String s = getPredicates();
+
+ response.setContentType("application/rdf+xml");
+ response.setHeader("Content-Disposition", "attachment;filename=Predicates");
+ out.write(s);
+ out.close();
+ return;
+ } else if (ontology.equals("ServiceDescription")) {
+ response.setContentType("application/rdf+xml");
+ response.setHeader("Content-Disposition",
+ "attachment;filename=ServiceDescription");
+ out.write(serviceDescriptionVocabulary);
+ out.close();
+ return;
+ } else if (ontology.equals("FULL")) {
+ try {
+ model = getAll(model);
+ } catch (Exception e) {
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Could not get All");
+ e.printStackTrace();
+ return;
+ }
+ if (model == null) {
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST,
+ "Cound not create model");
+ return;
+ }
+ response.setContentType("application/rdf+xml");
+ response.setHeader("Content-Disposition", "attachment;filename=All");
+ RDFWriter writer = model.getWriter("RDF/XML-ABBREV");
+ writer.setProperty("showXmlDeclaration", "true");
+ writer.write(model, out, null);
+ return;
+ }
+ } else {
+ // response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ out.println(RESOURCE.Four0FourError);
+ return;
+ }
+ }
+ }
+
+ /**
+ * <b>PRE: </b>
+ * <p>
+ * <b>POST: </b>
+ * <p>
+ *
+ * @param model
+ * a model that we can add statements to.
+ * @return an rdf model that contains all of the moby objects.
+ * @throws MobyException
+ */
+ public final Model getAll(Model model) throws Exception {
+ model = getObjects(model);
+ model = getServices(model);
+ model = getNamespaces(model);
+ // add the predicates to the model
+ RDFReader reader = model.getReader();
+ reader.read(model, new ByteArrayInputStream(getPredicates().getBytes()), null);
+ try {
+ model = getServiceInstances(model);
+ } catch (ModelException e) {
+ e.printStackTrace();
+ return null;
+ }
+ return model;
+ }
+
+ /**
+ * <b>PRE: </b>
+ * <p>
+ * <b>POST: </b>
+ * <p>
+ *
+ * @param model
+ * @return
+ * @throws ModelException
+ */
+ private final Model getServiceInstances(Model model) throws Exception {
+ if (RUN_MAIN) {
+ createNsMap(model);
+ }
+
+ CentralDigest central = null;
+ MobyService[] services = null;
+ try {
+ String registryURL;
String registryNamespace;
- Map map = RegistryOS.getEnv();
- if (!map.isEmpty()) {
- registryURL = (String) map.get("MOBY_SERVER");
- registryNamespace = (String) map.get("MOBY_URI");
+ if (!System.getProperties().isEmpty()) {
+ registryURL = System.getProperty("MOBY_SERVER");
+ registryNamespace = System.getProperty("MOBY_URI");
+ System.out.println("System vars: " + registryURL + ", " + registryNamespace);
if (registryURL == null) {
// use default registry, since we dont have a local one
central = new CentralDigestImpl();
@@ -389,723 +403,763 @@
central = new CentralDigestImpl(registryURL);
} else {
// use defined url and namespacce
- central = new CentralDigestImpl(registryURL,
- registryNamespace);
+ central = new CentralDigestImpl(registryURL, registryNamespace);
}
} else {
- // use default registry since we cant determine if local one exists
+ // use default registry since we cant determine if local one
+ // exists
central = new CentralDigestImpl();
}
- services = central.getServices();
- } catch (MobyException e) {
- e.printStackTrace();
- }
- if (central == null || services == null)
- throw new MobyException(
- "Could not retrieve useful information from CentralDigestImpl().getServices(String)");
- return ServiceInstanceRDF.createRDFModel(model, services);
- }
-
- private final Resource createSimpleDataItem(Model model,
- MobyPrimaryDataSimple simpleData, Resource _li) {
- _li.addProperty(RDF.type, Predicates.Simple);
- _li.addProperty(Predicates.object_type, model.createResource(OBJ
- + simpleData.getDataType().getName()));
- if (!simpleData.getName().equals(""))
- _li.addProperty(Predicates.articleName, model
- .createTypedLiteral(simpleData.getName()));
- MobyNamespace[] ns = null;
- if ((ns = simpleData.getNamespaces()) != null) {
- for (int k = 0; k < ns.length; k++) {
- MobyNamespace mns = ns[k];
- _li.addProperty(Predicates.namespace_type, model
- .createResource(NS + mns.getName()));
- // .addProperty(RDF.type, RDFS.Class));
- }
- }
- return _li;
- }
-
- /**
- * <b>PRE: </b>
- * <p>
- * <b>POST: </b>
- * <p>
- *
- * @param model
- * @return
- * @throws MobyException
- */
- private final Model getServices(Model model) throws MobyException {
-
- String[][] str = getTypes("Services");
- if (str.equals("")) {
- return null;
- }
- if (RUN_MAIN) {
- createNsMap(model);
- }
- Resource subject = _addClassResource(model, SRV, "Service",
- "a base Service class, never instantiated");
- model.add(model.createStatement(subject, RDF.type, RDFS.Class));
- for (int i = 0; i < str.length; i++) {
- String[] _line = str[i];
- String sub = _line[0];
- String pred = _line[1];
- String obj = _line[2];
- String def = _line[3];
- Matcher m;
- m = Pattern.compile(".*:isa$", Pattern.CASE_INSENSITIVE).matcher(
- pred);
- if (m.matches()) {
- Resource _subject = _addClassResource(model, SRV, sub, def);
- _addSubClass(model, _subject, SRV, obj);
- }
- }
- return model;
- }
-
- /**
- * <b>PRE: </b>
- * <p>
- * <b>POST: </b>
- * <p>
- *
- * @param model
- * @return
- * @throws MobyException
- */
- private final Model getNamespaces(Model model) throws MobyException {
- String[][] str = getTypes("Namespaces");
- if (str == null) {
- return null;
- }
- if (RUN_MAIN) {
- createNsMap(model);
- }
- Resource subject = _addClassResource(model, NS, "Namespace",
- "a base Namespace identifier, never instantiated");
- model.add(model.createStatement(subject, RDF.type, RDFS.Class));
- for (int x = 0; x < str.length; x++) {
- String[] _line = str[x];
- String sub = _line[0];
- String def = "";
- if (_line.length > 1)
- def = _line[1];
- Resource _subject = _addClassResource(model, NS, sub, def);
- _addSubClass(model, _subject, NS, "Namespace");
- }
- return model;
- }
-
- /**
- * <b>PRE: </b>
- * <p>
- * <b>POST: </b>
- * <p>
- *
- * @param model
- * @throws MobyException
- */
- private final Model getObjects(Model model) throws MobyException {
- String[][] str = getTypes("Objects");
- if (str == null) {
- return null;
- }
- // add mobyPred prefix to model
- if (RUN_MAIN) {
- createNsMap(model);
- }
- // 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, RDFS.subClassOf, Predicates.DataComponent));
- for (int x = 0; x < str.length; x++) {
- String[] _line = str[x];
- String sub, pred, obj, def, articlename = "";
- sub = _line[0];
- pred = _line[1];
- obj = _line[2];
- articlename = _line[3];
- def = _line[4];
- Matcher m;
- if (articlename.indexOf("(") >= 0)
- articlename = articlename.substring(articlename.indexOf("(")+1, articlename.indexOf(")"));
-
- Resource _subject = _addClassResource(model, OBJ, sub, def);
-
- m = Pattern.compile(".*:isa$", Pattern.CASE_INSENSITIVE).matcher(
- pred);
- if (m.matches()) {
- // System.out.println("is " +pred);
- _addSubClass(model, _subject, OBJ, obj);
- }
- m = Pattern.compile(".*:hasa$", Pattern.CASE_INSENSITIVE).matcher(
- pred);
- if (m.matches()) {
- // System.out.println("hasa " +pred);
- Resource bnode = model.createResource(model.getProperty(OBJ
- + obj));
- _addHasaHas(model, bnode, _subject, Predicates.hasa, OBJ, obj,
- articlename);
- }
- m = Pattern.compile(".*:has$", Pattern.CASE_INSENSITIVE).matcher(
- pred);
- if (m.matches()) {
- // System.out.println("has " + pred);
- Resource bnode = model.createResource(model.getProperty(OBJ
- + obj));
- _addHasaHas(model, bnode, _subject, Predicates.has, OBJ, obj,
- articlename);
- }
- }
- return model;
- }
-
- private final void createNsMap(Model model) {
- Map map = model.getNsPrefixMap();
- map.put("moby", Predicates.getURI());
- map.put("mobyObject", OBJ);
- map.put("serviceInstances", SI);
- map.put("mobyNamespace", NS);
- map.put("mobyService", SRV);
- model.setNsPrefixes(map);
- }
-
- /**
- * <b>PRE: </b>
- * <p>
- * <b>POST: </b>
- * <p>
- *
- * @param model
- * @param _resource
- * @param subject
- * @param mp2
- * @param string
- * @param obj2
- * @param obj3
- * @param articlename
- */
- private final void _addHasaHas(Model model, Resource bnode,
- Resource subject, Property prop, String objNS, String object,
- String articlename) {
- Pattern p = Pattern.compile("urn:lsid.*:(\\S+)$");
- Matcher m = p.matcher(object);
- object = (m.matches() ? m.group(1) : object);
- Resource resource = model.createResource(objNS + object);
- model.add(model.createStatement(subject, prop, bnode));
- model.add(model.createStatement(bnode, Predicates.articleName, model
- .createLiteral(articlename, "en")));
- }
-
- /**
- * <b>PRE: </b>
- * <p>
- * <b>POST: </b>
- * <p>
- *
- * @param model
- * @param mp2
- * @param bnode
- * @param string
- * @param articlename
- */
- private final void _addClassLiteral(Model model, String pns,
- Resource subject, String predicate, String value) {
-
- }
-
- /**
- * <b>PRE: </b>
- * <p>
- * <b>POST: </b>
- * <p>
- *
- * @param model
- * @param subject
- * @param obj2
- * @param obj3
- */
- private final void _addSubClass(Model model, Resource subject,
- String objNS, String object) {
- Pattern p = Pattern.compile("urn:lsid.*:(\\S+)$");
- Matcher m = p.matcher(object);
- object = (m.matches() ? m.group(1) : object);
- Resource resource = model.createResource(objNS + object);
- model.add(model.createStatement(subject, RDFS.subClassOf, resource));
- }
-
- private final Resource _addClassResource(Model model, String ns,
- String thing, String def) {
- Pattern p = Pattern.compile("urn:lsid.*:(\\S+)$");
- Matcher m = p.matcher(thing);
- String label = (m.matches() ? m.group(1) : thing);
- Resource resource = model.createResource(ns + thing);
- //addOfTypeProperty(model, resource, thing);
- model.add(model.createStatement(resource, RDF.type, RDFS.Class));
- model.add(model.createStatement(resource, RDFS.label, model
- .createLiteral(label, "en")));
- model.add(model.createStatement(resource, RDFS.comment, model
- .createLiteral(def, "en")));
- return resource;
- }
-
- /**
- * @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 {
- if (type.equalsIgnoreCase("objects")) {
- try {
- return new JObjectsSqlImpl().getObjectsAsArray();
- } catch (Exception e) {
- e.printStackTrace();
- }
- } else if (type.equalsIgnoreCase("services")) {
- try {
- return new JServicesSqlImpl().getServicesAsArray();
- } catch (Exception e) {
- e.printStackTrace();
- }
- } else if (type.equalsIgnoreCase("namespaces")) {
- try {
- return new JNamespacesSqlImpl().getNamespacesAsArray();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- return null;
- }
-
- /*
- *
- */
- private String getURL(String url) {
- StringBuffer sb = new StringBuffer();
- try {
- URL _url = new URL(url);
- BufferedReader in = new BufferedReader(new InputStreamReader(_url
- .openStream()));
- String inputLine;
- while ((inputLine = in.readLine()) != null)
- sb.append(inputLine + "\n");
- in.close();
- } catch (Exception e) {
- e.printStackTrace();
- System.err.println("Could not retrieve contents of URL.");
- }
- return sb.toString();
- }
-
- protected final void doPost(HttpServletRequest request,
- HttpServletResponse response) throws ServletException, IOException {
- response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.servlet.GenericServlet#getServletInfo()
- */
- public final String getServletInfo() {
- return "jRESOURCE - JAVA implementation of the old /RESOURCES/ perl script by Edward Kawas";
- }
-
- private final String getObjects() throws MobyException {
- Model model = ModelFactory.createDefaultModel();
- createNsMap(model);
- model = getObjects(model);
- RDFWriter writer = model.getWriter("RDF/XML-ABBREV");
- writer.setProperty("showXmlDeclaration", "false");
- StringWriter out = new StringWriter();
- writer.write(model, out, null);
- return out.getBuffer().toString();
- }
-
- private final String getNamespaces() throws MobyException {
- Model model = ModelFactory.createDefaultModel();
- createNsMap(model);
- model = getNamespaces(model);
- RDFWriter writer = model.getWriter("RDF/XML-ABBREV");
- writer.setProperty("showXmlDeclaration", "false");
- StringWriter out = new StringWriter();
- writer.write(model, out, null);
- return out.getBuffer().toString();
- }
-
- private final String getServices() throws MobyException {
- Model model = ModelFactory.createDefaultModel();
- createNsMap(model);
- model = getServices(model);
- RDFWriter writer = model.getWriter("RDF/XML-ABBREV");
- writer.setProperty("showXmlDeclaration", "false");
- StringWriter out = new StringWriter();
- writer.write(model, out, null);
- return out.getBuffer().toString();
- }
-
- private final String getServiceInstances() {
- Model model = ModelFactory.createDefaultModel();
- createNsMap(model);
- try {
- model = getServiceInstances(model);
- } catch (Exception e) {
- e.printStackTrace();
- return "";
- }
- RDFWriter writer = model.getWriter("RDF/XML-ABBREV");
- writer.setProperty("showXmlDeclaration", "false");
- StringWriter out = new StringWriter();
- writer.write(model, out, null);
- 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) {
- // this is a url
- name = str.substring(str.lastIndexOf("/") + 1);
- } else
- name = str;
-
- if (name.equalsIgnoreCase("Objects")) {
- return getObjects();
- } else if (name.equalsIgnoreCase("Services")) {
- return getServices();
- } else if (name.equalsIgnoreCase("ServiceInstances")) {
- 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" + System.getProperty("line.separator") + "" +
- " xmlns:moby=\"http://biomoby.org/RESOURCES/MOBY-S/Predicates#\"" + System.getProperty("line.separator") + "" +
- " xmlns:mobyObject=\"http://biomoby.org/RESOURCES/MOBY-S/Objects#\"" + System.getProperty("line.separator") + "" +
- " xmlns:serviceInstances=\"http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#\"" + System.getProperty("line.separator") + "" +
- " xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"" + System.getProperty("line.separator") + "" +
- " xmlns:xs=\"http://www.w3.org/2001/XMLSchema#\"" + System.getProperty("line.separator") + "" +
- " xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\"" + System.getProperty("line.separator") + "" +
- " xmlns:owl=\"http://www.w3.org/2002/07/owl#\"" + System.getProperty("line.separator") + "" +
- " xmlns:dc=\"http://purl.org/dc/elements/1.1/\">" + System.getProperty("line.separator") + "");
- // add the predicates here
- buffer.append(createOntologyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
- "The BioMoby Predicates Vocabulary (moby)",
- "This is the RDF Schema for the BioMoby Predicate vocabulary defined in the moby 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://biomoby.org/RESOURCES/MOBY-S/Objects#Object",
- "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object"));
-
- 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://biomoby.org/RESOURCES/MOBY-S/Objects#Object",
- "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object"));
-
- buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#articleName",
- "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
- "articleName","Uses a non-controlled vocabulary to describe the intended semantic relationship between the Subject node, and the node in which the Subject is associated through a HAS or HASA relationship.",
- "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object",
- "http://www.w3.org/2000/01/rdf-schema#Literal"));
-
- buffer.append(createPropertyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#componentName",
- "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
- "componentName","The subject is known to be named object.",
- "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent",
- "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", //TODO - namespace?
- "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://biomoby.org/RESOURCES/MOBY-S/Objects#Object",
- "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://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent",
- "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://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent",
- "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", //TODO servicetype?
- "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://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary",
- "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://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary",
- "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://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary",
- "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://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary",
- "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/2001/XMLSchema#type",
- "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://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#", //TODO
- "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://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent"));
-
- 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://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent"));
-
- 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://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent"));
-
- buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyThing",
- "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
- "mobyThing","NOT SURE",
- "http://www.w3.org/2000/01/rdf-schema#Class"));
-
- buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyMessageComponent",
- "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
- "MobyMessageComponent","NOT SURE",
- "http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyThing"));
-
- buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent",
- "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
- "DataComponent","NOT SURE",
- "http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyMessageComponent"));
-
- buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#StructuralComponent",
- "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
- "StructuralComponent","NOT SURE",
- "http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyMessageComponent"));
-
-
- // end the addition of predicates here
- buffer.append(
- "" + System.getProperty("line.separator") + "" +
- "</rdf:RDF>");
- return buffer.toString();
- }
-
- private String createPropertyBlock(String about, String definedBy,
- String label, String comment, String domain, String range) {
- String s =
- "" + System.getProperty("line.separator") + "<rdf:Property rdf:about=\"" + about + "\">" + System.getProperty("line.separator") + "" +
- " <rdfs:isDefinedBy rdf:resource=\"" + definedBy + "\"/>" + System.getProperty("line.separator") + "" +
- " <rdfs:label>" + label + "</rdfs:label>" + System.getProperty("line.separator") + "" +
- " <rdfs:comment>" + comment + "</rdfs:comment>" + System.getProperty("line.separator") + "" +
- " <rdfs:range rdf:resource=\"" + range + "\"/>" + System.getProperty("line.separator") + "" +
- " <rdfs:domain rdf:resource=\"" + domain + "\"/>" + System.getProperty("line.separator") + "" +
- "</rdf:Property>" + System.getProperty("line.separator") + "";
- return s;
- }
-
- private String createClassBlock(String about, String definedBy,
- String label, String comment, String subClassOf) {
- String s =
- "" + System.getProperty("line.separator") + "<rdfs:Class rdf:about=\""+ about +"\">" + System.getProperty("line.separator") + "" +
- " <rdfs:isDefinedBy rdf:resource=\""+ definedBy +"\"/>" + System.getProperty("line.separator") + "" +
- " <rdfs:label>"+ label +"</rdfs:label>" + System.getProperty("line.separator") + "" +
- " <rdfs:comment>"+ comment +"</rdfs:comment>" + System.getProperty("line.separator") + "" +
- " <rdfs:subClassOf rdf:resource=\""+ subClassOf +"\"/>" + System.getProperty("line.separator") + "" +
- "</rdfs:Class>" + System.getProperty("line.separator") + "";
- return s;
- }
-
- private String createDescriptionBlock(String about, String[] seeAlsos) {
- if (seeAlsos == null)
- return "" + System.getProperty("line.separator") + "<rdf:Description rdf:about=\""+ about +"\"/>";
- StringBuffer sb = new StringBuffer();
- sb.append(" <rdf:Description rdf:about=\""+ about +"\">" + System.getProperty("line.separator") + "");
- for (int x = 0; x < seeAlsos.length; x++) {
- sb.append(" <rdfs:seeAlso rdf:resource=\"" + seeAlsos[x] + "\"/>" + System.getProperty("line.separator") + "");
- }
- sb.append("</rdf:Description>" + System.getProperty("line.separator") + "");
- return sb.toString();
- }
-
- private String createOntologyBlock(String about, String title,
- String description) {
- String s ="" + System.getProperty("line.separator") + "<owl:Ontology " + System.getProperty("line.separator") + "" + " rdf:about=\"" + about
- + "\">" + System.getProperty("line.separator") + "" + " <dc:title>" + title + "</dc:title>" + System.getProperty("line.separator") + ""
- + " <dc:description>" + description + "</dc:description>" + System.getProperty("line.separator") + ""
- + "</owl:Ontology>" + System.getProperty("line.separator") + "";
- return s;
- }
-
- private String createEscapedComment(String comment) {
- String s = "" + System.getProperty("line.separator") + "<!-- " + comment + " -->" + System.getProperty("line.separator") + "";
- return s;
- }
-
- public static void main(String[] args) throws Exception {
- System.out.println(new RESOURCE().getRESOURCES("ServiceInstances"));
- }
-
- private final String serviceDescriptionVocabulary = "<?xml version=\'1.0\' encoding=\'ISO-8859-1\'?>" + System.getProperty("line.separator") +
- "<!DOCTYPE rdf:RDF [" + System.getProperty("line.separator") +
- " <!ENTITY rdf \'http://www.w3.org/1999/02/22-rdf-syntax-ns#\'>" + System.getProperty("line.separator") +
- " <!ENTITY rdfs \'http://www.w3.org/2000/01/rdf-schema#\'>" + System.getProperty("line.separator") +
- "]>" + System.getProperty("line.separator") +
- "<rdf:RDF xmlns:rdf=\"&rdf;\"" + System.getProperty("line.separator") +
- " xmlns:rdfs=\"&rdfs;\">" + System.getProperty("line.separator") +
- "" + System.getProperty("line.separator") +
- "<rdf:Property rdf:about=\"http://biomoby.org/RESOURCES/MOBY-S/ServiceDescription#authoritative\">" + System.getProperty("line.separator") +
- " <rdfs:range rdf:resource=\"http://www.w3.org/2001/XMLSchema#string\"/>" + System.getProperty("line.separator") +
- " <rdfs:domain rdf:resource=\"http://www.mygrid.org.uk/ontology#organisation\"/>" + System.getProperty("line.separator") +
- "</rdf:Property>" + System.getProperty("line.separator") +
- "" + System.getProperty("line.separator") +
- "<rdf:Property rdf:about=\"http://biomoby.org/RESOURCES/MOBY-S/ServiceDescription#objectType\">" + System.getProperty("line.separator") +
- " <rdfs:subPropertyOf rdf:resource=\"http://www.w3.org/2000/01/rdf-schema#type\"/>" + System.getProperty("line.separator") +
- " <rdfs:range rdf:resource=\"http://biomoby.org/RESOURCES/MOBY-S/Objects\"/><!-- but somehow this has to accommodate both our ontology and the myGrid ontology, so I don\'t think this will work very well as it stands. We need to wait for their response. -->" + System.getProperty("line.separator") +
- " <rdfs:domain rdf:resource=\"http://www.mygrid.org.uk/ontology#parameter\"/>" + System.getProperty("line.separator") +
- "</rdf:Property>" + System.getProperty("line.separator") +
- "" + System.getProperty("line.separator") +
- "<rdf:Property rdf:about=\"http://biomoby.org/RESOURCES/MOBY-S/ServiceDescription#inNamespaces\">" + System.getProperty("line.separator") +
- " <rdfs:range rdf:resource=\"http://www.mygrid.org.uk/ontology#parameterNamespace\"/>" + System.getProperty("line.separator") +
- " <rdfs:domain rdf:resource=\"http://www.mygrid.org.uk/ontology#parameter\"/>" + System.getProperty("line.separator") +
- "</rdf:Property>" + System.getProperty("line.separator") +
- "" + System.getProperty("line.separator") +
- "<rdf:Property rdf:about=\"http://biomoby.org/RESOURCES/MOBY-S/ServiceDescription#namespaceType\">" + System.getProperty("line.separator") +
- " <rdfs:subPropertyOf rdf:resource=\"http://www.w3.org/2000/01/rdf-schema#type\"/><!-- do you want to check this compared to http://www.w3.org/1999/02/22-rdf-syntax-ns#type which is what myGrid seems to be using... -->" + System.getProperty("line.separator") +
- " <rdfs:range rdf:resource=\"http://biomoby.org/RESOURCES/MOBY-S/Namespaces\"/> <!-- you had domain and range reversed here...domain is the left and range is the right side of the tripe -->" + System.getProperty("line.separator") +
- " <rdfs:domain rdf:resource=\"http://www.mygrid.org.uk/ontology#parameterNamespace\"/>" + System.getProperty("line.separator") +
- "</rdf:Property>" + System.getProperty("line.separator") +
- "" + System.getProperty("line.separator") +
- "<rdf:Property rdf:about=\"http://biomoby.org/RESOURCES/MOBY-S/ServiceDescription#datatype\">" + System.getProperty("line.separator") +
- " <rdfs:range rdf:resource=\"http://www.mygrid.org.uk/ontology#parameter\"/>" + System.getProperty("line.separator") +
- " <rdfs:domain rdf:resource=\"http://www.w3.org/2000/01/rdf-schema#Literal\"/>" + System.getProperty("line.separator") +
- "</rdf:Property>" + System.getProperty("line.separator") +
- "" + System.getProperty("line.separator") +
- "" + System.getProperty("line.separator") +
- "<rdf:Property rdf:about=\"http://biomoby.org/RESOURCES/MOBY-S/ServiceDescription#min\">" + System.getProperty("line.separator") +
- " <rdfs:range rdf:resource=\"http://www.mygrid.org.uk/ontology#parameter\"/>" + System.getProperty("line.separator") +
- " <rdfs:domain rdf:resource=\"http://www.w3.org/2000/01/rdf-schema#Literal\"/>" + System.getProperty("line.separator") +
- "</rdf:Property>" + System.getProperty("line.separator") +
- "" + System.getProperty("line.separator") +
- "<rdf:Property rdf:about=\"http://biomoby.org/RESOURCES/MOBY-S/ServiceDescription#max\">" + System.getProperty("line.separator") +
- " <rdfs:domain rdf:resource=\"http://www.mygrid.org.uk/ontology#parameter\"/>" + System.getProperty("line.separator") +
- " <rdfs:range rdf:resource=\"http://www.w3.org/2000/01/rdf-schema#Literal\" /> " + System.getProperty("line.separator") +
- "</rdf:Property>" + System.getProperty("line.separator") +
- "" + System.getProperty("line.separator") +
- "<rdf:Property rdf:about=\"http://biomoby.org/RESOURCES/MOBY-S/ServiceDescription#enum\">" + System.getProperty("line.separator") +
- " <rdfs:domain rdf:resource=\"http://www.mygrid.org.uk/ontology#parameter\"/>" + System.getProperty("line.separator") +
- " <rdfs:range rdf:resource=\"http://www.w3.org/2000/01/rdf-schema#Literal\" /> " + System.getProperty("line.separator") +
- "</rdf:Property>" + System.getProperty("line.separator") +
- "" + System.getProperty("line.separator") +
- "</rdf:RDF>" + System.getProperty("line.separator") +
- "" + System.getProperty("line.separator") +
- "";
+ services = central.getServices();
+ } catch (MobyException e) {
+ e.printStackTrace();
+ }
+ if (central == null || services == null)
+ throw new MobyException(
+ "Could not retrieve useful information from CentralDigestImpl().getServices(String)");
+ return ServiceInstanceRDF.createRDFModel(model, services);
+ }
+
+ /**
+ * <b>PRE: </b>
+ * <p>
+ * <b>POST: </b>
+ * <p>
+ *
+ * @param model
+ * @return
+ * @throws MobyException
+ */
+ private final Model getServices(Model model) throws MobyException {
+
+ String[][] str = getTypes("Services");
+ if (str.equals("")) {
+ return null;
+ }
+ if (RUN_MAIN) {
+ createNsMap(model);
+ }
+ Resource subject = _addClassResource(model, "Service",
+ "urn:lsid:biomoby.org:servicetype:Service:2001-09-21T16-00-00Z",
+ "a base Service class, never instantiated", "openinformatics.com",
+ "markw at illuminae.com");
+ model.add(model.createStatement(subject, RDF.type, RDFS.Class));
+ for (int i = 0; i < str.length; i++) {
+ String[] _line = str[i];
+ String sub, pred, obj, def, lsid, authority, email, obj_lsid;
+ if (_line.length > 7) {
+ sub = _line[0];
+ pred = _line[1];
+ obj = _line[2];
+ def = _line[3];
+ lsid = _line[4];
+ authority = _line[5];
+ email = _line[6];
+ obj_lsid = _line[7];
+ } else {
+ continue;
+ }
+ Matcher m;
+ m = Pattern.compile(".*:isa$", Pattern.CASE_INSENSITIVE).matcher(pred);
+ if (m.matches()) {
+ // service types only have isa relationships and every service
+ // type has a parent, except the base service Service
+ Resource _subject = _addClassResource(model, sub, lsid, def, authority, email);
+ _addSubClass(model, _subject, obj_lsid);
+ }
+ }
+ return model;
+ }
+
+ /**
+ * <b>PRE: </b>
+ * <p>
+ * <b>POST: </b>
+ * <p>
+ *
+ * @param model
+ * @return
+ * @throws MobyException
+ */
+ private final Model getNamespaces(Model model) throws MobyException {
+ String[][] str = getTypes("Namespaces");
+ if (str == null) {
+ return null;
+ }
+ if (RUN_MAIN) {
+ createNsMap(model);
+ }
+ Resource subject = _addClassResource(model, "Namespace", NS + "Namespace",
+ "a base Namespace identifier, never instantiated", null, null);
+ model.add(model.createStatement(subject, RDF.type, RDFS.Class));
+ for (int x = 0; x < str.length; x++) {
+ String[] _line = str[x];
+ String sub = _line[0];
+ String def = "";
+ String lsid = "";
+ String authority = "";
+ String email = "";
+ if (_line.length > 4) {
+ def = _line[1];
+ lsid = _line[2];
+ authority = _line[3];
+ email = _line[4];
+ } else {
+ continue;
+ }
+ Resource _subject = _addClassResource(model, sub, lsid, def, authority, email);
+ _addSubClass(model, _subject, NS + "Namespace");
+ }
+ return model;
+ }
+
+ /**
+ * <b>PRE: </b>
+ * <p>
+ * <b>POST: </b>
+ * <p>
+ *
+ * @param model
+ * @throws MobyException
+ */
+ private final Model getObjects(Model model) throws MobyException {
+ String[][] str = getTypes("Objects");
+ if (str == null) {
+ return null;
+ }
+ // add mobyPred prefix to model
+ if (RUN_MAIN) {
+ createNsMap(model);
+ }
+ // create the base object type "class"
+ Resource subject = _addClassResource(model, "Object",
+ "urn:lsid:biomoby.org:objectclass:Object",
+ "a base object class consisting of a namespace and an identifier",
+ "openinformatics.com", "jason at openinformatics.com");
+
+ for (int x = 0; x < str.length; x++) {
+ String[] _line = str[x];
+ String sub = "", pred = "", obj = "", def = "", articlename = "", lsid = "", authority = "", email = "", obj_lsid = "";
+ Matcher m;
+ if (_line.length > 8) {
+ sub = _line[0];
+ pred = _line[1];
+ obj = _line[2];
+ articlename = _line[3];
+ def = _line[4];
+ lsid = _line[5];
+ authority = _line[6];
+ email = _line[7];
+ obj_lsid = _line[8];
+
+ if (articlename.indexOf("(") >= 0)
+ articlename = articlename.substring(articlename.indexOf("(") + 1, articlename
+ .indexOf(")"));
+
+ } else {
+ continue;
+ }
+ Resource _subject = _addClassResource(model, sub, lsid, def, authority, email);
+
+ m = Pattern.compile(".*:isa$", Pattern.CASE_INSENSITIVE).matcher(pred);
+ if (m.matches()) {
+ // System.out.println("is " +pred);
+ _addSubClass(model, _subject, obj_lsid);
+ }
+ m = Pattern.compile(".*:hasa$", Pattern.CASE_INSENSITIVE).matcher(pred);
+ if (m.matches()) {
+ // System.out.println("hasa " +pred);
+ Resource bnode = model.createResource(model.getProperty(OBJ + obj));
+ _addHasaHas(model, bnode, _subject, Predicates.hasa, OBJ, obj, articlename);
+ }
+ m = Pattern.compile(".*:has$", Pattern.CASE_INSENSITIVE).matcher(pred);
+ if (m.matches()) {
+ // System.out.println("has " + pred);
+ Resource bnode = model.createResource(model.getProperty(OBJ + obj));
+ _addHasaHas(model, bnode, _subject, Predicates.has, OBJ, obj, articlename);
+ }
+ }
+ return model;
+ }
+
+ private final void createNsMap(Model model) {
+ Map map = model.getNsPrefixMap();
+ map.put("moby", Predicates.getURI());
+ map.put("mobyObject", OBJ);
+ map.put("serviceInstances", SI);
+ map.put("mobyNamespace", NS);
+ map.put("mobyService", SRV);
+ model.setNsPrefixes(map);
+ }
+
+ /**
+ * <b>PRE: </b>
+ * <p>
+ * <b>POST: </b>
+ * <p>
+ *
+ * @param model
+ * @param _resource
+ * @param subject
+ * @param mp2
+ * @param string
+ * @param obj2
+ * @param obj3
+ * @param articlename
+ */
+ private final void _addHasaHas(Model model, Resource bnode, Resource subject, Property prop,
+ String objNS, String object, String articlename) {
+ Pattern p = Pattern.compile("urn:lsid.*:(\\S+)$");
+ Matcher m = p.matcher(object);
+ object = (m.matches() ? m.group(1) : object);
+ Resource resource = model.createResource(objNS + object);
+ model.add(model.createStatement(subject, prop, bnode));
+ model.add(model.createStatement(bnode, Predicates.articleName, model.createLiteral(
+ articlename, "en")));
+ }
+
+ private final void _addSubClass(Model model, Resource subject, String lsid) {
+ Resource resource = model.createResource(lsid);
+ model.add(model.createStatement(subject, RDFS.subClassOf, resource));
+ }
+
+ /*
+ * TODO
+ */
+ private final Resource _addClassResource(Model model, String label, String lsid, String def,
+ String authority, String email) {
+ Resource resource = model.createResource(lsid);
+ // addOfTypeProperty(model, resource, thing);
+ model.add(model.createStatement(resource, RDF.type, RDFS.Class));
+ model.add(model.createStatement(resource, RDFS.label, model.createLiteral(label)));
+ model.add(model.createStatement(resource, RDFS.comment, model.createLiteral(def, "en")));
+ // add email and authority
+ if (email != null && !email.equals(""))
+ model.add(model.createStatement(resource, DC.creator, model.createLiteral(email)));
+ if (authority != null && !authority.equals(""))
+ model
+ .add(model.createStatement(resource, DC.publisher, model
+ .createLiteral(authority)));
+ return resource;
+ }
+
+ private final String[][] getTypes(String type) throws MobyException {
+ if (type.equalsIgnoreCase("objects")) {
+ try {
+ return new JObjectsSqlImpl().getFullObjectsAsArray();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ } else if (type.equalsIgnoreCase("services")) {
+ try {
+ return new JServicesSqlImpl().getFullServicesAsArray();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ } else if (type.equalsIgnoreCase("namespaces")) {
+ try {
+ return new JNamespacesSqlImpl().getFullNamespacesAsArray();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ return null;
+ }
+
+ /*
+ *
+ */
+ private String getURL(String url) {
+ StringBuffer sb = new StringBuffer();
+ try {
+ URL _url = new URL(url);
+ BufferedReader in = new BufferedReader(new InputStreamReader(_url.openStream()));
+ String inputLine;
+ while ((inputLine = in.readLine()) != null)
+ sb.append(inputLine + "\n");
+ in.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.err.println("Could not retrieve contents of URL.");
+ }
+ return sb.toString();
+ }
+
+ protected final void doPost(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.servlet.GenericServlet#getServletInfo()
+ */
+ public final String getServletInfo() {
+ return "jRESOURCE - JAVA implementation of the old /RESOURCES/ perl script by Edward Kawas";
+ }
+
+ private final String getObjects() throws MobyException {
+ Model model = ModelFactory.createDefaultModel();
+ createNsMap(model);
+ model = getObjects(model);
+ RDFWriter writer = model.getWriter("RDF/XML-ABBREV");
+ writer.setProperty("showXmlDeclaration", "false");
+ StringWriter out = new StringWriter();
+ writer.write(model, out, null);
+ return out.getBuffer().toString();
+ }
+
+ private final String getNamespaces() throws MobyException {
+ Model model = ModelFactory.createDefaultModel();
+ createNsMap(model);
+ model = getNamespaces(model);
+ RDFWriter writer = model.getWriter("RDF/XML-ABBREV");
+ writer.setProperty("showXmlDeclaration", "false");
+ StringWriter out = new StringWriter();
+ writer.write(model, out, null);
+ return out.getBuffer().toString();
+ }
+
+ private final String getServices() throws MobyException {
+ Model model = ModelFactory.createDefaultModel();
+ createNsMap(model);
+ model = getServices(model);
+ RDFWriter writer = model.getWriter("RDF/XML-ABBREV");
+ writer.setProperty("showXmlDeclaration", "false");
+ StringWriter out = new StringWriter();
+ writer.write(model, out, null);
+ return out.getBuffer().toString();
+ }
+
+ private final String getServiceInstances() {
+ Model model = ModelFactory.createDefaultModel();
+ try {
+ model = getServiceInstances(model);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return "";
+ }
+ RDFWriter writer = model.getWriter("RDF/XML-ABBREV");
+ writer.setProperty("showXmlDeclaration", "false");
+ StringWriter out = new StringWriter();
+ writer.write(model, out, null);
+ 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) {
+ // this is a url
+ name = str.substring(str.lastIndexOf("/") + 1);
+ } else
+ name = str;
+
+ if (name.equalsIgnoreCase("Objects")) {
+ return getObjects();
+ } else if (name.equalsIgnoreCase("Services")) {
+ return getServices();
+ } else if (name.equalsIgnoreCase("ServiceInstances")) {
+ 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"
+ + System.getProperty("line.separator")
+ + ""
+ + " xmlns:moby=\"http://biomoby.org/RESOURCES/MOBY-S/Predicates#\""
+ + System.getProperty("line.separator")
+ + ""
+ + " xmlns:mobyObject=\"http://biomoby.org/RESOURCES/MOBY-S/Objects#\""
+ + System.getProperty("line.separator")
+ + ""
+ + " xmlns:serviceInstances=\"http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#\""
+ + System.getProperty("line.separator") + ""
+ + " xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\""
+ + System.getProperty("line.separator") + ""
+ + " xmlns:xs=\"http://www.w3.org/2001/XMLSchema#\""
+ + System.getProperty("line.separator") + ""
+ + " xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\""
+ + System.getProperty("line.separator") + ""
+ + " xmlns:owl=\"http://www.w3.org/2002/07/owl#\""
+ + System.getProperty("line.separator") + ""
+ + " xmlns:dc=\"http://purl.org/dc/elements/1.1/\">"
+ + System.getProperty("line.separator") + "");
+ // add the predicates here
+ buffer
+ .append(createOntologyBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+ "The BioMoby Predicates Vocabulary (moby)",
+ "This is the RDF Schema for the BioMoby Predicate vocabulary defined in the moby 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://biomoby.org/RESOURCES/MOBY-S/Objects#Object",
+ "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object"));
+
+ 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://biomoby.org/RESOURCES/MOBY-S/Objects#Object",
+ "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object"));
+
+ buffer
+ .append(createPropertyBlock(
+ "http://biomoby.org/RESOURCES/MOBY-S/Predicates#articleName",
+ "http://biomoby.org/RESOURCES/MOBY-S/Predicates#",
+ "articleName",
+ "Uses a non-controlled vocabulary to describe the intended semantic relationship between the Subject node, and the node in which the Subject is associated through a HAS or HASA relationship.",
+ "http://biomoby.org/RESOURCES/MOBY-S/Objects#Object",
+ "http://www.w3.org/2000/01/rdf-schema#Literal"));
+
+ buffer.append(createPropertyBlock(
+ "http://biomoby.org/RESOURCES/MOBY-S/Predicates#componentName",
+ "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "componentName",
+ "The subject is known to be named object.",
+ "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent",
+ "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", // TODO -
+ // namespace?
+ "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://biomoby.org/RESOURCES/MOBY-S/Objects#Object",
+ "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://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent",
+ "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://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent",
+ "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", // TODO
+ // servicetype?
+ "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://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary",
+ "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://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary",
+ "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://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary",
+ "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://biomoby.org/RESOURCES/MOBY-S/Predicates#Secondary",
+ "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/2001/XMLSchema#type",
+ "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://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#", // TODO
+ "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://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent"));
+
+ 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://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent"));
+
+ 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://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent"));
+
+ buffer.append(createClassBlock("http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyThing",
+ "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "mobyThing", "NOT SURE",
+ "http://www.w3.org/2000/01/rdf-schema#Class"));
+
+ buffer.append(createClassBlock(
+ "http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyMessageComponent",
+ "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "MobyMessageComponent",
+ "NOT SURE", "http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyThing"));
+
+ buffer.append(createClassBlock(
+ "http://biomoby.org/RESOURCES/MOBY-S/Predicates#DataComponent",
+ "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "DataComponent", "NOT SURE",
+ "http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyMessageComponent"));
+
+ buffer.append(createClassBlock(
+ "http://biomoby.org/RESOURCES/MOBY-S/Predicates#StructuralComponent",
+ "http://biomoby.org/RESOURCES/MOBY-S/Predicates#", "StructuralComponent",
+ "NOT SURE", "http://biomoby.org/RESOURCES/MOBY-S/Predicates#MobyMessageComponent"));
+
+ // end the addition of predicates here
+ buffer.append("" + System.getProperty("line.separator") + "" + "</rdf:RDF>");
+ return buffer.toString();
+ }
+
+ private String createPropertyBlock(String about, String definedBy, String label,
+ String comment, String domain, String range) {
+ String s = "" + System.getProperty("line.separator") + "<rdf:Property rdf:about=\"" + about
+ + "\">" + System.getProperty("line.separator") + ""
+ + " <rdfs:isDefinedBy rdf:resource=\"" + definedBy + "\"/>"
+ + System.getProperty("line.separator") + "" + " <rdfs:label>" + label
+ + "</rdfs:label>" + System.getProperty("line.separator") + "" + " <rdfs:comment>"
+ + comment + "</rdfs:comment>" + System.getProperty("line.separator") + ""
+ + " <rdfs:range rdf:resource=\"" + range + "\"/>"
+ + System.getProperty("line.separator") + "" + " <rdfs:domain rdf:resource=\""
+ + domain + "\"/>" + System.getProperty("line.separator") + "" + "</rdf:Property>"
+ + System.getProperty("line.separator") + "";
+ return s;
+ }
+
+ private String createClassBlock(String about, String definedBy, String label, String comment,
+ String subClassOf) {
+ String s = "" + System.getProperty("line.separator") + "<rdfs:Class rdf:about=\"" + about
+ + "\">" + System.getProperty("line.separator") + ""
+ + " <rdfs:isDefinedBy rdf:resource=\"" + definedBy + "\"/>"
+ + System.getProperty("line.separator") + "" + " <rdfs:label>" + label
+ + "</rdfs:label>" + System.getProperty("line.separator") + "" + " <rdfs:comment>"
+ + comment + "</rdfs:comment>" + System.getProperty("line.separator") + ""
+ + " <rdfs:subClassOf rdf:resource=\"" + subClassOf + "\"/>"
+ + System.getProperty("line.separator") + "" + "</rdfs:Class>"
+ + System.getProperty("line.separator") + "";
+ return s;
+ }
+
+ private String createDescriptionBlock(String about, String[] seeAlsos) {
+ if (seeAlsos == null)
+ return "" + System.getProperty("line.separator") + "<rdf:Description rdf:about=\""
+ + about + "\"/>";
+ StringBuffer sb = new StringBuffer();
+ sb.append(" <rdf:Description rdf:about=\"" + about + "\">"
+ + System.getProperty("line.separator") + "");
+ for (int x = 0; x < seeAlsos.length; x++) {
+ sb.append(" <rdfs:seeAlso rdf:resource=\"" + seeAlsos[x] + "\"/>"
+ + System.getProperty("line.separator") + "");
+ }
+ sb.append("</rdf:Description>" + System.getProperty("line.separator") + "");
+ return sb.toString();
+ }
+
+ private String createOntologyBlock(String about, String title, String description) {
+ String s = "" + System.getProperty("line.separator") + "<owl:Ontology "
+ + System.getProperty("line.separator") + "" + " rdf:about=\"" + about + "\">"
+ + System.getProperty("line.separator") + "" + " <dc:title>" + title
+ + "</dc:title>" + System.getProperty("line.separator") + "" + " <dc:description>"
+ + description + "</dc:description>" + System.getProperty("line.separator") + ""
+ + "</owl:Ontology>" + System.getProperty("line.separator") + "";
+ return s;
+ }
+
+ private String createEscapedComment(String comment) {
+ String s = "" + System.getProperty("line.separator") + "<!-- " + comment + " -->"
+ + System.getProperty("line.separator") + "";
+ return s;
+ }
+
+ public static void main(String[] args) throws Exception {
+ CentralDigest central = new CentralDigestImpl(
+ "http://bioinfo.icapture.ubc.ca/cgi-bin/mobycentral/MOBY-Central.pl");
+ MobyService[] services = central.getServices();
+
+ Model m = ServiceInstanceRDF.createRDFModel(ModelFactory.createDefaultModel(), services);
+ RDFWriter writer = m.getWriter("RDF/XML-ABBREV");
+ writer.setProperty("showXmlDeclaration", "false");
+ writer.setProperty("tab", "5");
+ writer.write(m, System.out, null);
+ }
+
+ private final String serviceDescriptionVocabulary = "<?xml version=\'1.0\' encoding=\'ISO-8859-1\'?>"
+ + System.getProperty("line.separator")
+ + "<!DOCTYPE rdf:RDF ["
+ + System.getProperty("line.separator")
+ + " <!ENTITY rdf \'http://www.w3.org/1999/02/22-rdf-syntax-ns#\'>"
+ + System.getProperty("line.separator")
+ + " <!ENTITY rdfs \'http://www.w3.org/2000/01/rdf-schema#\'>"
+ + System.getProperty("line.separator")
+ + "]>"
+ + System.getProperty("line.separator")
+ + "<rdf:RDF xmlns:rdf=\"&rdf;\""
+ + System.getProperty("line.separator")
+ + " xmlns:rdfs=\"&rdfs;\">"
+ + System.getProperty("line.separator")
+ + ""
+ + System.getProperty("line.separator")
+ + "<rdf:Property rdf:about=\"http://biomoby.org/RESOURCES/MOBY-S/ServiceDescription#authoritative\">"
+ + System.getProperty("line.separator")
+ + " <rdfs:range rdf:resource=\"http://www.w3.org/2001/XMLSchema#string\"/>"
+ + System.getProperty("line.separator")
+ + " <rdfs:domain rdf:resource=\"http://www.mygrid.org.uk/ontology#organisation\"/>"
+ + System.getProperty("line.separator")
+ + "</rdf:Property>"
+ + System.getProperty("line.separator")
+ + ""
+ + System.getProperty("line.separator")
+ + "<rdf:Property rdf:about=\"http://biomoby.org/RESOURCES/MOBY-S/ServiceDescription#objectType\">"
+ + System.getProperty("line.separator")
+ + " <rdfs:subPropertyOf rdf:resource=\"http://www.w3.org/2000/01/rdf-schema#type\"/>"
+ + System.getProperty("line.separator")
+ + " <rdfs:range rdf:resource=\"http://biomoby.org/RESOURCES/MOBY-S/Objects\"/><!-- but somehow this has to accommodate both our ontology and the myGrid ontology, so I don\'t think this will work very well as it stands. We need to wait for their response. -->"
+ + System.getProperty("line.separator")
+ + " <rdfs:domain rdf:resource=\"http://www.mygrid.org.uk/ontology#parameter\"/>"
+ + System.getProperty("line.separator")
+ + "</rdf:Property>"
+ + System.getProperty("line.separator")
+ + ""
+ + System.getProperty("line.separator")
+ + "<rdf:Property rdf:about=\"http://biomoby.org/RESOURCES/MOBY-S/ServiceDescription#inNamespaces\">"
+ + System.getProperty("line.separator")
+ + " <rdfs:range rdf:resource=\"http://www.mygrid.org.uk/ontology#parameterNamespace\"/>"
+ + System.getProperty("line.separator")
+ + " <rdfs:domain rdf:resource=\"http://www.mygrid.org.uk/ontology#parameter\"/>"
+ + System.getProperty("line.separator")
+ + "</rdf:Property>"
+ + System.getProperty("line.separator")
+ + ""
+ + System.getProperty("line.separator")
+ + "<rdf:Property rdf:about=\"http://biomoby.org/RESOURCES/MOBY-S/ServiceDescription#namespaceType\">"
+ + System.getProperty("line.separator")
+ + " <rdfs:subPropertyOf rdf:resource=\"http://www.w3.org/2000/01/rdf-schema#type\"/><!-- do you want to check this compared to http://www.w3.org/1999/02/22-rdf-syntax-ns#type which is what myGrid seems to be using... -->"
+ + System.getProperty("line.separator")
+ + " <rdfs:range rdf:resource=\"http://biomoby.org/RESOURCES/MOBY-S/Namespaces\"/> <!-- you had domain and range reversed here...domain is the left and range is the right side of the tripe -->"
+ + System.getProperty("line.separator")
+ + " <rdfs:domain rdf:resource=\"http://www.mygrid.org.uk/ontology#parameterNamespace\"/>"
+ + System.getProperty("line.separator")
+ + "</rdf:Property>"
+ + System.getProperty("line.separator")
+ + ""
+ + System.getProperty("line.separator")
+ + "<rdf:Property rdf:about=\"http://biomoby.org/RESOURCES/MOBY-S/ServiceDescription#datatype\">"
+ + System.getProperty("line.separator")
+ + " <rdfs:range rdf:resource=\"http://www.mygrid.org.uk/ontology#parameter\"/>"
+ + System.getProperty("line.separator")
+ + " <rdfs:domain rdf:resource=\"http://www.w3.org/2000/01/rdf-schema#Literal\"/>"
+ + System.getProperty("line.separator")
+ + "</rdf:Property>"
+ + System.getProperty("line.separator")
+ + ""
+ + System.getProperty("line.separator")
+ + ""
+ + System.getProperty("line.separator")
+ + "<rdf:Property rdf:about=\"http://biomoby.org/RESOURCES/MOBY-S/ServiceDescription#min\">"
+ + System.getProperty("line.separator")
+ + " <rdfs:range rdf:resource=\"http://www.mygrid.org.uk/ontology#parameter\"/>"
+ + System.getProperty("line.separator")
+ + " <rdfs:domain rdf:resource=\"http://www.w3.org/2000/01/rdf-schema#Literal\"/>"
+ + System.getProperty("line.separator")
+ + "</rdf:Property>"
+ + System.getProperty("line.separator")
+ + ""
+ + System.getProperty("line.separator")
+ + "<rdf:Property rdf:about=\"http://biomoby.org/RESOURCES/MOBY-S/ServiceDescription#max\">"
+ + System.getProperty("line.separator")
+ + " <rdfs:domain rdf:resource=\"http://www.mygrid.org.uk/ontology#parameter\"/>"
+ + System.getProperty("line.separator")
+ + " <rdfs:range rdf:resource=\"http://www.w3.org/2000/01/rdf-schema#Literal\" /> "
+ + System.getProperty("line.separator")
+ + "</rdf:Property>"
+ + System.getProperty("line.separator")
+ + ""
+ + System.getProperty("line.separator")
+ + "<rdf:Property rdf:about=\"http://biomoby.org/RESOURCES/MOBY-S/ServiceDescription#enum\">"
+ + System.getProperty("line.separator")
+ + " <rdfs:domain rdf:resource=\"http://www.mygrid.org.uk/ontology#parameter\"/>"
+ + System.getProperty("line.separator")
+ + " <rdfs:range rdf:resource=\"http://www.w3.org/2000/01/rdf-schema#Literal\" /> "
+ + System.getProperty("line.separator")
+ + "</rdf:Property>"
+ + System.getProperty("line.separator")
+ + ""
+ + System.getProperty("line.separator")
+ + "</rdf:RDF>"
+ + System.getProperty("line.separator")
+ + ""
+ + System.getProperty("line.separator") + "";
}
\ No newline at end of file
More information about the MOBY-guts
mailing list