[MOBY-guts] biomoby commit
Eddie Kawas
kawas at pub.open-bio.org
Tue Jul 19 15:32:54 UTC 2005
kawas
Tue Jul 19 11:32:54 EDT 2005
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources
In directory pub.open-bio.org:/tmp/cvs-serv20493/org/biomoby/client/ui/graphical/servlet/jresources
Modified Files:
RESOURCE.java
Log Message:
Code has mobycentral registry domain changes, as well as certain todo statements have been excised. The next version should a way to retrieve information regarding the BioMoby predicate vocabulary. Eddie
moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources RESOURCE.java,1.6,1.7
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources/RESOURCE.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources/RESOURCE.java 2005/06/09 17:39:00 1.6
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources/RESOURCE.java 2005/07/19 15:32:54 1.7
@@ -19,6 +19,7 @@
import org.biomoby.client.CentralDigestImpl;
import org.biomoby.client.rdf.vocabulary.MobyResources;
import org.biomoby.client.rdf.vocabulary.Predicates;
+import org.biomoby.client.rdf.vocabulary.XMLTypes;
import org.biomoby.registry.definitions.types.JNamespaces;
import org.biomoby.registry.definitions.types.JObjects;
import org.biomoby.registry.definitions.types.JServices;
@@ -165,7 +166,7 @@
* @see javax.servlet.GenericServlet#init()
*/
public final void init() throws ServletException {
- super.init();
+ // super.init();
}
protected final void doGet(HttpServletRequest request,
@@ -366,8 +367,8 @@
.getURL()));
subject.addProperty(DC.identifier, model
.createTypedLiteral("urn:lsid:"
- + properties.getProperty("lsid_domain")
- + ":serviceinstance:" + services[i].getAuthority()
+ + MobyProperties.SERVICE_INSTANCE_PROPERTIES().getProperty("lsid_authority") + ":"
+ + MobyProperties.SERVICE_INSTANCE_PROPERTIES().getProperty("lsid_namespace") + ":" +services[i].getAuthority()
+ "," + services[i].getName()));
subject.addProperty(Predicates.performs_task, model
.createResource(SRV + services[i].getType()));
@@ -783,7 +784,9 @@
Pattern p = Pattern.compile("urn:lsid.*:(\\S+)$");
Matcher m = p.matcher(thing);
String label = (m.matches() ? m.group(1) : thing);
+ //TODO - add the ofType property if thing is String, Float, Integer, DataTime.
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")));
@@ -792,7 +795,30 @@
return resource;
}
- private final String getTypes(String type) throws MobyException {
+ /**
+ * @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 JObjects().getObjects();
@@ -800,7 +826,7 @@
e.printStackTrace();
}
// resort to a secondary method for retrieval of JObjects
- return getURL("http://mobycentral.cbr.nrc.ca:8090/types/Objects");
+ return getURL("http://mobycentral.icapture.ubc.ca:8090/types/Objects");
} else if (type.equalsIgnoreCase("services")) {
try {
return new JServices().getServices();
@@ -808,7 +834,7 @@
e.printStackTrace();
}
// resort to a secondary method for retrieval of JServices
- return getURL("http://mobycentral.cbr.nrc.ca:8090/types/Services");
+ return getURL("http://mobycentral.icapture.ubc.ca:8090/types/Services");
} else if (type.equalsIgnoreCase("namespaces")) {
try {
return new JNamespaces().getNamespaces();
@@ -816,7 +842,7 @@
e.printStackTrace();
}
// resort to a secondary method for retrieval of JNamespaces
- return getURL("http://mobycentral.cbr.nrc.ca:8090/types/Namespaces");
+ return getURL("http://mobycentral.icapture.ubc.ca:8090/types/Namespaces");
}
return "";
}
@@ -925,7 +951,7 @@
}
public static void main(String[] args) throws MobyException {
- System.out.println(new RESOURCE().getRESOURCES("ServiceInstances"));
+ System.out.println(new RESOURCE().getRESOURCES("Objects"));
}
}
More information about the MOBY-guts
mailing list