[MOBY-guts] biomoby commit
Eddie Kawas
kawas at pub.open-bio.org
Thu Jul 28 15:26:14 UTC 2005
kawas
Thu Jul 28 11:26:13 EDT 2005
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier
In directory pub.open-bio.org:/tmp/cvs-serv3976/org/biomoby/registry/rdfagent/verifier
Modified Files:
ServiceDescrParser.java
Log Message:
Changes made were only to formatting of code (i think!?!).
Also, i added some todos for later on.
moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier ServiceDescrParser.java,1.6,1.7
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/ServiceDescrParser.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/registry/rdfagent/verifier/ServiceDescrParser.java 2005/07/25 20:20:02 1.6
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/ServiceDescrParser.java 2005/07/28 15:26:13 1.7
@@ -5,6 +5,7 @@
import java.util.Iterator;
import java.util.Vector;
+import org.biomoby.registry.rdfagent.util.Constants;
import org.biomoby.registry.rdfagent.util.Log;
import org.biomoby.registry.rdfagent.util.Report;
import org.biomoby.registry.rdfagent.util.XMLBuilder;
@@ -22,772 +23,865 @@
/**
* @author Nina Opushneva
- *
- * The ServiceDescrParser is a software component for processing RDF data.
- * One or more RDF documents can be loaded into the parser and then the parser
- * browses the input stream and extracts data for to compare with data in database
+ *
+ * The ServiceDescrParser is a software component for processing RDF data. One
+ * or more RDF documents can be loaded into the parser and then the parser
+ * browses the input stream and extracts data for to compare with data in
+ * database
*/
public class ServiceDescrParser {
- Model servDescrMd;
-
- int bag = 0;
- int n = 0;
- int[] ver = {0,0,0,0,0,0,0,0};
-
- ServiceDescrParser(Model serviceDescrMd){
-
- this.servDescrMd = serviceDescrMd;
- }
-
-/** get a provider's RDF file by signatureURL,
- * and check if every of service RDF is valid MOBY
- * @param signURL - the URL of resource (signatureURL)
- * @param servNames - list of services which have registered with signURL
- *
- */
-
- public void getValidRDF(String servNames,String signURL){
- String res = "";
- int amount = 0;
- int validMoby = 0;
- int servError = 0;
- Vector resources = new Vector(); // the list of services at given URL (including new services)
- String auth_URI = "";
- String servName = "";
- Vector deletedServ = new Vector(); // the list of deleted services from database
-
-
- // get the set of RDF with the same signatureURL
-
- ResIterator iter = servDescrMd.listSubjectsWithProperty(DC.title);
- while (iter.hasNext()){
- String resource = iter.next().toString();
- Hashtable servSign = new Hashtable();
- amount += 1;
-
- servSign = getServSignature(resource);
-
- if(!servSign.isEmpty()){ // a valid MOBY RDF
- servName = servSign.get("servicename").toString();
- auth_URI = servSign.get("authURI").toString();
- resources.addElement(servName);
-
- Hashtable servInp = new Hashtable();
- servInp = getInput(resource) ;
- Hashtable servOut = new Hashtable();
- servOut = getOutput(resource) ;
-
- for (int i = 0; i < ver.length; i++) { // a clearance of the array ver[]
- ver[i] = 0;
-
- }
- if (servInp.containsValue("error") | servOut.containsValue("error")){
- servError +=1;
- String msg = "A bad Input or Output structure for the service <"+ servName+">. ";
- String msg1 = "The service have not processed";
- Report.doWrite(msg+msg1);
- }else{
- DataMngr.processService(servSign,servInp,servOut,servName,auth_URI,signURL);
- }
- }else{
- validMoby += 1; // a not valid MOBY RDF
- }
-
- }
-
- String[] result = servNames.split(",");
-
-
- Report.doWrite("");
- Report.add("----------------------------------------------------------------------------------------");
- Report.add(" ");
- Report.doWrite("Expected services for given URL "+result.length);
- Report.add("Expected services for given URL "+result.length);
-
- Report.doWrite("In fact = "+amount);
- Report.add("In fact = "+amount);
- Report.add("notValidMoby services or with a bad structure = "+(servError+validMoby));
- Report.add(" ");
-
- for (int j=0;j<result.length;j++){
- res = "";
- for (int i=0; i<resources.size(); i++) {
- String s = (String) resources.elementAt(i);
- if (result[j].equals(s)){
- res = "ok";
- break;
- }
- }
-
- if (res.equals("")){
- servName = result[j];
- if (deletedServ.size()==0){
- XMLBuilder.startServiceXml();
- }
- XMLBuilder.buildServiceXml(servName,signURL);
- DataMngr.delServByNameAndUrl(servName,signURL);
- deletedServ.addElement(servName);
- String msg = "The service < "+ servName+" > was not found in the RDF file. The service was deregistered from MOBYCENTRAL Registry" ;
- Report.doWrite(msg );
- Report.add(msg );
-
-/* if (Constants.MB_MAIL_SERVER != null | Constants.MB_MAIL_SERVER.equals("") ){
- String to = DataMngr.getContactEmail(signURL);
- Communicator.sendMail(to,Constants.SP_SUBJECT,msg,Constants.MB_FROM); // send message to the service provider - that service was deregistered
-
- }*/
- }
- }
- int del = deletedServ.size();
- if (del > 0){
- Report.doWrite("DELETED SERVICES: ");
- Report.add(" ");
- Report.add("DELETED SERVICES: ");
- Iterator i = deletedServ.iterator();
- int m=1;
- while (i.hasNext()){
- String delServ = i.next().toString();
- Report.doWrite(m+". "+delServ);
- Report.add(m+". "+delServ);
- m+=1;
- }
-
- }
- Report.doWrite("notValidMoby services or with a bad structure = "+(servError+validMoby));
-// Report.add("notValidMoby services or with a bad structure = "+(servError+validMoby));
- Report.doWrite("=======================================================================================");
-
- Log.info("=======================================================================");
- }
-
-
- /** get service Signature data for the service
- * @param resource - the URL of resource + serviceName+authURI
- * @return Hashtable represented by a pair: service signature descriptor and value
- */
+ private Model servDescrMd;
+
+ int bag = 0;
+
+ int n = 0;
+
+ int[] ver = { 0, 0, 0, 0, 0, 0, 0, 0 };
+
+ ServiceDescrParser(Model serviceDescrMd) {
+
+ this.servDescrMd = serviceDescrMd;
+ }
+
+ /**
+ * get a provider's RDF file by signatureURL, and check if every of service
+ * RDF is valid MOBY
+ *
+ * @param signURL -
+ * the URL of resource (signatureURL)
+ * @param servNames -
+ * list of services which have registered with signURL
+ *
+ */
+
+ public void getValidRDF(String servNames, String signURL) {
+ String res = "";
+ int amount = 0;
+ int validMoby = 0;
+ int servError = 0;
+ Vector resources = new Vector(); // the list of services at given URL
+ // (including new services)
+ String auth_URI = "";
+ String servName = "";
+ Vector deletedServ = new Vector(); // the list of deleted services from
+ // database
+
+ // get the set of RDF with the same signatureURL
+
+ ResIterator iter = servDescrMd.listSubjectsWithProperty(DC.title);
+ while (iter.hasNext()) {
+ String resource = iter.next().toString();
+ Hashtable servSign = new Hashtable();
+ amount += 1;
+
+ servSign = getServSignature(resource);
+
+ if (!servSign.isEmpty()) { // a valid MOBY RDF
+ servName = servSign.get("servicename").toString();
+ auth_URI = servSign.get("authURI").toString();
+ resources.addElement(servName);
+
+ Hashtable servInp = new Hashtable();
+ servInp = getInput(resource);
+ Hashtable servOut = new Hashtable();
+ servOut = getOutput(resource);
+
+ for (int i = 0; i < ver.length; i++) { // a clearance of the
+ // array ver[]
+ ver[i] = 0;
+
+ }
+ if (servInp.containsValue("error")
+ | servOut.containsValue("error")) {
+ servError += 1;
+ String msg = "A bad Input or Output structure for the service <"
+ + servName + ">. ";
+ String msg1 = "The service have not processed";
+ Report.doWrite(msg + msg1);
+ } else {
+ DataMngr.processService(servSign, servInp, servOut,
+ servName, auth_URI, signURL);
+ }
+ } else {
+ validMoby += 1; // a not valid MOBY RDF
+ }
+
+ }
+
+ String[] result = servNames.split(",");
+
+ Report.doWrite("");
+ Report
+ .add("----------------------------------------------------------------------------------------");
+ Report.add(" ");
+ Report.doWrite("Expected services for given URL " + result.length);
+ Report.add("Expected services for given URL " + result.length);
+
+ Report.doWrite("In fact = " + amount);
+ Report.add("In fact = " + amount);
+ Report.add("notValidMoby services or with a bad structure = "
+ + (servError + validMoby));
+ Report.add(" ");
+
+ for (int j = 0; j < result.length; j++) {
+ res = "";
+ for (int i = 0; i < resources.size(); i++) {
+ String s = (String) resources.elementAt(i);
+ if (result[j].equals(s)) {
+ res = "ok";
+ break;
+ }
+ }
+
+ if (res.equals("")) {
+ servName = result[j];
+ if (deletedServ.size() == 0) {
+ XMLBuilder.startServiceXml();
+ }
+ XMLBuilder.buildServiceXml(servName, signURL);
+ DataMngr.delServByNameAndUrl(servName, signURL);
+ deletedServ.addElement(servName);
+ String msg = "The service < "
+ + servName
+ + " > was not found in the RDF file. The service was deregistered from MOBYCENTRAL Registry";
+ Report.doWrite(msg);
+ Report.add(msg);
+
+ if (Constants.MB_MAIL_SERVER != null
+ || !Constants.MB_MAIL_SERVER.equals("")) {
+ String to = DataMngr.getContactEmail(signURL);
+ Communicator.sendMail(to, Constants.SP_SUBJECT, msg,
+ Constants.MB_FROM);
+ // send message to the service provider - that service was
+ // deregistered
+ }
+ }
+ }
+ int del = deletedServ.size();
+ if (del > 0) {
+ Report.doWrite("DELETED SERVICES: ");
+ Report.add(" ");
+ Report.add("DELETED SERVICES: ");
+ Iterator i = deletedServ.iterator();
+ int m = 1;
+ while (i.hasNext()) {
+ String delServ = i.next().toString();
+ Report.doWrite(m + ". " + delServ);
+ Report.add(m + ". " + delServ);
+ m += 1;
+ }
+ }
+ Report.doWrite("notValidMoby services or with a bad structure = "
+ + (servError + validMoby));
+ // Report.add("notValidMoby services or with a bad structure =
+ // "+(servError+validMoby));
+ Report
+ .doWrite("=======================================================================================");
+
+ Log
+ .info("=======================================================================");
+ }
+
+ /**
+ * get service Signature data for the service
+ *
+ * @param resource -
+ * the URL of resource + serviceName+authURI
+ * @return Hashtable represented by a pair: service signature descriptor and
+ * value
+ */
+
+ public Hashtable getServSignature(String resource) {
- public Hashtable getServSignature(String resource){
-
Hashtable sign = new Hashtable();
- Resource si = servDescrMd.getResource(resource);
-
- Report.doWrite("----------------------------------------------------------------------------------------");
- Report.add("----------------------------------------------------------------------------------------");
- n +=1; // the number of RDF at the signatureURL
- Log.info("RDF "+n+" : "+ si);
- Report.doWrite("RDF "+n+" : "+ si);
- Report.add("RDF "+n+" : "+ si);
-
- int in = 0;
- int out = 0;
- StmtIterator signNum = si.listProperties();
-
- while (signNum.hasNext()) {
- Statement stmtSign = signNum.nextStatement();
- String signPred = stmtSign.getPredicate().toString().trim();
- String signNode = stmtSign.getObject().toString();
-
- String[] rezNode = signNode.split(":http:");
- int k = (rezNode.length)-1;
- if (k == 0){
- String[] rezNode1 = signNode.split("~");
- signNode = rezNode1[0];
- }else{
- signNode = rezNode[0];
- }
-
- String[] result = signPred.split("#");
- int i = (result.length)-1;
- if (i == 0){
- String[] res = signPred.split("/");
- int j = (res.length)-1;
- String name = getFieldName(res[j]);
- sign.put(name,signNode);
- }
- else {
- if (result[i].equals("input") | result[i].equals("consumes")){
- in = 1;
- }
- if (result[i].equals("output") | result[i].equals("produces")){
- out = 1;
- }
- String name = getFieldName(result[i]);
- if (name.equals("service_type_uri")){
- String lsid_node = switchURItoLSID(signNode);
- sign.put(name,lsid_node);
- }else{
- sign.put(name,signNode);
- }
-
-
- }
- }
-
- for (int vn=0; vn<ver.length; vn++){ // an array of the basic predicates for service signature
-
- if (ver[vn] != 1){
- Log.info("THE RDF IS NOT VALID MOBY RDF - absent "+ ver[vn]);
- Report.doWrite("THE RDF IS NOT VALID MOBY RDF: one or more MOBY descriptors are absent");
- Report.add("THE RDF IS NOT VALID MOBY RDF: one or more MOBY descriptors are absent");
- sign.clear();
- break;
- }
- }
- if (in == 0 && out == 0){
- Report.doWrite("THE RDF IS NOT VALID MOBY RDF: Input and Output are absent ");
- Report.add("THE RDF IS NOT VALID MOBY RDF: Input and Output are absent ");
- Log.info("THE RDF IS NOT VALID MOBY RDF - Consumes and Produces are absent");
- sign.clear();
- }else{
- Enumeration num = sign.keys();
-
- }
-
-
+ Resource si = servDescrMd.getResource(resource);
+
+ Report
+ .doWrite("----------------------------------------------------------------------------------------");
+ Report
+ .add("----------------------------------------------------------------------------------------");
+ n += 1; // the number of RDF at the signatureURL
+ Log.info("RDF " + n + " : " + si);
+ Report.doWrite("RDF " + n + " : " + si);
+ Report.add("RDF " + n + " : " + si);
+
+ int in = 0;
+ int out = 0;
+ StmtIterator signNum = si.listProperties();
+
+ while (signNum.hasNext()) {
+ Statement stmtSign = signNum.nextStatement();
+ String signPred = stmtSign.getPredicate().toString().trim();
+ String signNode = stmtSign.getObject().toString();
+
+ String[] rezNode = signNode.split(":http:");
+ int k = (rezNode.length) - 1;
+ if (k == 0) {
+ String[] rezNode1 = signNode.split("~");
+ signNode = rezNode1[0];
+ } else {
+ signNode = rezNode[0];
+ }
+
+ String[] result = signPred.split("#");
+ int i = (result.length) - 1;
+ if (i == 0) {
+ String[] res = signPred.split("/");
+ int j = (res.length) - 1;
+ String name = getFieldName(res[j]);
+ sign.put(name, signNode);
+ } else {
+ if (result[i].equals("input") | result[i].equals("consumes")) {
+ in = 1;
+ }
+ if (result[i].equals("output") | result[i].equals("produces")) {
+ out = 1;
+ }
+ String name = getFieldName(result[i]);
+ if (name.equals("service_type_uri")) {
+ String lsid_node = switchURItoLSID(signNode);
+ sign.put(name, lsid_node);
+ } else {
+ sign.put(name, signNode);
+ }
+
+ }
+ }
+
+ for (int vn = 0; vn < ver.length; vn++) { // an array of the basic
+ // predicates for service
+ // signature
+
+ if (ver[vn] != 1) {
+ Log.info("THE RDF IS NOT VALID MOBY RDF - absent " + ver[vn]);
+ Report
+ .doWrite("THE RDF IS NOT VALID MOBY RDF: one or more MOBY descriptors are absent");
+ Report
+ .add("THE RDF IS NOT VALID MOBY RDF: one or more MOBY descriptors are absent");
+ sign.clear();
+ break;
+ }
+ }
+ if (in == 0 && out == 0) {
+ Report
+ .doWrite("THE RDF IS NOT VALID MOBY RDF: Input and Output are absent ");
+ Report
+ .add("THE RDF IS NOT VALID MOBY RDF: Input and Output are absent ");
+ Log
+ .info("THE RDF IS NOT VALID MOBY RDF - Consumes and Produces are absent");
+ sign.clear();
+ } else {
+ Enumeration num = sign.keys();
+
+ }
return sign;
}
- /** get set of Inputs for service (Simple, Collection, and Secondary)
- * @param resource - the URL of resource + serviceName+authURI
- * @return Hashtable of hashtables represented by a pair:
- * a name of the input = hashtable for this input
- * hashtable for input is represented by a Input descriptor and value.
- *
- */
-
-
- public Hashtable getInput(String resource){
- int bagin = 0;
- int sin = 1;
- int cin = 1;
- int sec = 1;
- String simple = "ok";
+ /**
+ * get set of Inputs for service (Simple, Collection, and Secondary)
+ *
+ * @param resource -
+ * the URL of resource + serviceName+authURI
+ * @return Hashtable of hashtables represented by a pair: a name of the
+ * input = hashtable for this input hashtable for input is
+ * represented by a Input descriptor and value.
+ *
+ */
+
+ public Hashtable getInput(String resource) {
+ int bagin = 0;
+ int sin = 1;
+ int cin = 1;
+ int sec = 1;
+ String simple = "ok";
String collection = "ok";
String secondary = "ok";
- Hashtable input = new Hashtable();
-
-
- Resource si = servDescrMd.getResource(resource);
-
- try{
- Resource consumes = si.getRequiredProperty(MP.consumes).getResource();
- StmtIterator p23iter = consumes.listProperties();
-
- while (p23iter.hasNext()) {
- Hashtable siminp = new Hashtable(); // a simple input
- Hashtable colinp = new Hashtable(); // a collection input
- Hashtable secinp = new Hashtable(); // a secondary input
- StringBuffer sumsns = new StringBuffer(); // the row of namespaces
- StringBuffer sumen = new StringBuffer(); // the row of enum
-
- Statement l3iter = p23iter.nextStatement();
+ Hashtable input = new Hashtable();
+
+ Resource si = servDescrMd.getResource(resource);
+
+ try {
+ Resource consumes = si.getRequiredProperty(MP.consumes)
+ .getResource();
+ StmtIterator p23iter = consumes.listProperties();
+
+ while (p23iter.hasNext()) {
+ Hashtable siminp = new Hashtable(); // a simple input
+ Hashtable colinp = new Hashtable(); // a collection input
+ Hashtable secinp = new Hashtable(); // a secondary input
+ StringBuffer sumsns = new StringBuffer(); // the row of
+ // namespaces
+ StringBuffer sumen = new StringBuffer(); // the row of enum
+
+ Statement l3iter = p23iter.nextStatement();
Resource l3Res = l3iter.getResource();
- if (l3Res.isAnon()){
-
- Object type = l3Res.getRequiredProperty(RDF.type).getObject();
-
- if (type.equals(MP.Simple)){
- StmtIterator p34iter = l3Res.listProperties();
-
- while (p34iter.hasNext()) {
-
- Statement l4iter = p34iter.nextStatement();
- String l4Pred1 = l4iter.getPredicate().toString();
- String l4Node1 = l4iter.getObject().toString();
- String[] result = l4Pred1.split("#");
- int i = (result.length)-1;
-
- String name = getInpOutName(result[i]);
- if (name.equals("")){
- Report.doWrite("BAD STRUCTURE: Unknown name of predicate for Simple input <"+result[i]+">");
- Report.add("BAD STRUCTURE: Unknown name of predicate for Simple input <"+result[i]+">");
- simple = "error";
- continue;
+ if (l3Res.isAnon()) {
+
+ Object type = l3Res.getRequiredProperty(RDF.type)
+ .getObject();
+
+ if (type.equals(MP.Simple)) {
+ StmtIterator p34iter = l3Res.listProperties();
+
+ while (p34iter.hasNext()) {
+
+ Statement l4iter = p34iter.nextStatement();
+ String l4Pred1 = l4iter.getPredicate().toString();
+ String l4Node1 = l4iter.getObject().toString();
+ String[] result = l4Pred1.split("#");
+ int i = (result.length) - 1;
+
+ String name = getInpOutName(result[i]);
+ if (name.equals("")) {
+ Report
+ .doWrite("BAD STRUCTURE: Unknown name of predicate for Simple input <"
+ + result[i] + ">");
+ Report
+ .add("BAD STRUCTURE: Unknown name of predicate for Simple input <"
+ + result[i] + ">");
+ simple = "error";
+ continue;
+ }
+ if (name.equals("type")) {
+ continue;
+ }
+ String[] rezNode1 = l4iter.getObject().toString()
+ .split(":http:");
+ String l4Nodestr = rezNode1[0];
+ if (name.equals("namespace_type_uris")) {
+ siminp.remove("namespace_type_uris");
+ String lsid_nsp = switchURItoLSID(l4Nodestr);
+ if (sumsns.length() == 0) {
+ sumsns.append(lsid_nsp);
+ } else {
+ sumsns.append("," + lsid_nsp);
+ }
+
+ siminp.put(name, sumsns.toString());
+ } else if (name.equals("object_type_uri")) {
+ String lsid_nsp = switchURItoLSID(l4Nodestr);
+ siminp.put(name, lsid_nsp);
+ } else {
+ siminp.put(name, l4Nodestr);
+ }
+ }
+ if (siminp.isEmpty()) {
+ } else {
+ input.put("siminp" + sin, siminp); // to add Simple
+ // to Input
+ sin += 1;
+ Enumeration num = siminp.keys();
+
+ }
+ } else if (type.equals(MP.Collection)
+ | type.equals(RDF.Bag)) {
+ // if (l3Res.hasProperty(RDF.type,RDF.Bag) &&
+ // l3Res.hasProperty(RDF.li(1))){
+ if (l3Res.hasProperty(RDF.li(1))) {
+ StmtIterator p34iter = l3Res.listProperties();
+ if (l3Res.hasProperty(MP.article_name)) {
+ String col_artName = l3Res.getProperty(
+ MP.article_name).getObject().toString();
+ String[] rezNode = col_artName.split(":http:");
+ col_artName = rezNode[0];
+ colinp.put("col_articleName", col_artName);
+ }
+ while (p34iter.hasNext()) {
+ Statement l4iter = p34iter.nextStatement();
+ Property l4Pred = l4iter.getPredicate();
+ Node l4Node = l4iter.getObject().asNode();
+
+ if (l4Node.isBlank()) {
+ Resource l4Res = l4iter.getResource();
+ StmtIterator p45iter = l4Res
+ .listProperties();
+ if (p45iter.hasNext()) {
+ StringBuffer sumns = new StringBuffer();
+ while (p45iter.hasNext()) {
+ Statement l5iter = p45iter
+ .nextStatement();
+ String l5Pred = l5iter
+ .getPredicate().toString();
+ Node l5Node = l5iter.getObject()
+ .asNode();
+ String[] result = l5Pred.split("#");
+ int i = (result.length) - 1;
+ String name = getInpOutName(result[i]);
+ if (name.equals("")) {
+ Report
+ .doWrite("BAD STRUCTURE: Unknown name of predicate for Collection input <"
+ + result[i]
+ + ">");
+ Report
+ .add("BAD STRUCTURE: Unknown name of predicate for Collection input <"
+ + result[i]
+ + ">");
+ String Collection = "error";
+ break;
+ }
+ String[] rezNode = l5iter
+ .getObject().toString()
+ .split(":http:");
+ String l5Nodestr = rezNode[0];
+ if (name
+ .equals("namespace_type_uris")) {
+ colinp
+ .remove("namespace_type_uris");
+ String lsid_nsp = switchURItoLSID(l5Node
+ .toString());
+ if (sumns.length() == 0) {
+ sumns.append(lsid_nsp);
+ } else {
+ sumns
+ .append(","
+ + lsid_nsp);
+ }
+
+ colinp.put(name, sumns
+ .toString());
+ // sumns.append(l5Node+",");
+ } else if (name
+ .equals("object_type_uri")) {
+ String lsid_nsp = switchURItoLSID(l5Node
+ .toString());
+ colinp.put(name, lsid_nsp);
+ } else {
+ colinp.put(name, l5Node);
+ }
+ }
+ input.put("colinp" + cin, colinp);
+ cin += 1;
+ Enumeration num = colinp.keys();
+ }
+ }
+
+ }
+ } else {
+ collection = "error";
+ Report
+ .doWrite("BAD STRUCTURE: The Collection input isn't 'Bag' type or have not members");
+ Report
+ .add("BAD STRUCTURE: The Collection input isn't 'Bag' type or have not members");
+
}
- if (name.equals("type")){
- continue;
- }
- String[] rezNode1 = l4iter.getObject().toString().split(":http:");
- String l4Nodestr = rezNode1[0];
- if (name.equals("namespace_type_uris")){
- siminp.remove("namespace_type_uris");
- String lsid_nsp = switchURItoLSID(l4Nodestr);
- if (sumsns.length()==0){
- sumsns.append(lsid_nsp);
- }else{
- sumsns.append(","+lsid_nsp);
- }
-
- siminp.put(name,sumsns.toString());
- }
- else if (name.equals("object_type_uri")){
- String lsid_nsp = switchURItoLSID(l4Nodestr);
- siminp.put(name,lsid_nsp);
- }
- else{
- siminp.put(name,l4Nodestr);
- }
}
- if (siminp.isEmpty()){
- }else{
- input.put("siminp"+sin,siminp); // to add Simple to Input
- sin+=1;
- Enumeration num = siminp.keys();
-
- }
- }
- else if (type.equals(MP.Collection) | type.equals(RDF.Bag)){
-// if (l3Res.hasProperty(RDF.type,RDF.Bag) && l3Res.hasProperty(RDF.li(1))){
- if (l3Res.hasProperty(RDF.li(1))){
- StmtIterator p34iter = l3Res.listProperties();
- if (l3Res.hasProperty(MP.article_name)){
- String col_artName = l3Res.getProperty(MP.article_name).getObject().toString();
- String[] rezNode = col_artName.split(":http:");
- col_artName = rezNode[0];
- colinp.put("col_articleName",col_artName);
- }
- while (p34iter.hasNext()) {
- Statement l4iter = p34iter.nextStatement();
- Property l4Pred = l4iter.getPredicate();
- Node l4Node = l4iter.getObject().asNode();
-
- if (l4Node.isBlank()){
- Resource l4Res = l4iter.getResource();
- StmtIterator p45iter = l4Res.listProperties();
- if(p45iter.hasNext()) {
- StringBuffer sumns = new StringBuffer();
- while (p45iter.hasNext()) {
- Statement l5iter = p45iter.nextStatement();
- String l5Pred = l5iter.getPredicate().toString();
- Node l5Node = l5iter.getObject().asNode();
- String[] result = l5Pred.split("#");
- int i = (result.length)-1;
- String name = getInpOutName(result[i]);
- if (name.equals("")){
- Report.doWrite("BAD STRUCTURE: Unknown name of predicate for Collection input <"+result[i]+">");
- Report.add("BAD STRUCTURE: Unknown name of predicate for Collection input <"+result[i]+">");
- String Collection = "error";
- break;
- }
- String[] rezNode = l5iter.getObject().toString().split(":http:");
- String l5Nodestr = rezNode[0];
- if (name.equals("namespace_type_uris")){
- colinp.remove("namespace_type_uris");
- String lsid_nsp = switchURItoLSID(l5Node.toString());
- if (sumns.length()==0){
- sumns.append(lsid_nsp);
- }else{
- sumns.append(","+lsid_nsp);
- }
-
- colinp.put(name,sumns.toString());
-// sumns.append(l5Node+",");
- }else if (name.equals("object_type_uri")){
- String lsid_nsp = switchURItoLSID(l5Node.toString());
- colinp.put(name,lsid_nsp);
- }
- else{
- colinp.put(name,l5Node);
- }
- }
- input.put("colinp"+cin,colinp);
- cin+=1;
- Enumeration num = colinp.keys();
- }
- }
-
- }
- }else{
- collection = "error";
- Report.doWrite("BAD STRUCTURE: The Collection input isn't 'Bag' type or have not members");
- Report.add("BAD STRUCTURE: The Collection input isn't 'Bag' type or have not members");
-
- }
- }
- if (type.equals(MP.Secondary)){
-
- StmtIterator p34iter = l3Res.listProperties();
- while (p34iter.hasNext()) {
- Statement l4iter = p34iter.nextStatement();
- String l4Pred1 = l4iter.getPredicate().toString();
- String l4Node1 = l4iter.getObject().toString();
-
- String[] result = l4Pred1.split("#");
- int i = (result.length)-1;
- String name = getSecondaryName(result[i]);
-
- if (name.equals("")){
- Report.doWrite("BAD STRUCTURE: Unknown name of predicate for Secondary input <"+result[i]+">");
- Report.add("BAD STRUCTURE: Unknown name of predicate for Secondary input <"+result[i]+">");
- secondary = "error";
- break;
- }
-
- String[] rezNode1 = l4iter.getObject().toString().split(":http:");
- String l4Nodestr = rezNode1[0];
- if (name.equals("enum")){
- secinp.remove("enum");
- if (sumen.length()==0){
- sumen.append(l4Nodestr);
- }else{
- sumen.append(","+l4Nodestr);
- }
-
- secinp.put(name,sumen.toString());
-
- }
- else{
- secinp.put(name,l4Nodestr);
- }
- }
-
- if (secinp.isEmpty()){
- }else{
- input.put("secinp"+sec,secinp); // to add Secondary to Input
- sec+=1;
- Enumeration num = secinp.keys();
-// Report.doWrite("Secondary input "+ (sec-1));
-// Log.info("Secondary input "+ (sec-1));
- }
- }
- }
- }
-
- if (simple.equals("error") | collection.equals("error") | secondary.equals("error")){
- input.put("input","error");
- }
- }catch(Exception e){
- Log.warning("Failed:"+ e);
- }
-// }
-//System.out.println("input= "+input);
- return input;
-
- }
-
-/** get set of Outputs for service (Simple and Collection)
- * @param resource - the URL of resource + serviceName+authURI
- * @return Hashtable of hashtables represented by a pair:
- * a name of the output = hashtable for this output
- * hashtable for output is represented by a Output descriptor and value.
- *
- */
-
- public Hashtable getOutput(String resource){
- int bagout = 0;
- int so = 1;
- int co = 1;
+ if (type.equals(MP.Secondary)) {
+
+ StmtIterator p34iter = l3Res.listProperties();
+ while (p34iter.hasNext()) {
+ Statement l4iter = p34iter.nextStatement();
+ String l4Pred1 = l4iter.getPredicate().toString();
+ String l4Node1 = l4iter.getObject().toString();
+
+ String[] result = l4Pred1.split("#");
+ int i = (result.length) - 1;
+ String name = getSecondaryName(result[i]);
+
+ if (name.equals("")) {
+ Report
+ .doWrite("BAD STRUCTURE: Unknown name of predicate for Secondary input <"
+ + result[i] + ">");
+ Report
+ .add("BAD STRUCTURE: Unknown name of predicate for Secondary input <"
+ + result[i] + ">");
+ secondary = "error";
+ break;
+ }
+
+ String[] rezNode1 = l4iter.getObject().toString()
+ .split(":http:");
+ String l4Nodestr = rezNode1[0];
+ if (name.equals("enum")) {
+ secinp.remove("enum");
+ if (sumen.length() == 0) {
+ sumen.append(l4Nodestr);
+ } else {
+ sumen.append("," + l4Nodestr);
+ }
+
+ secinp.put(name, sumen.toString());
+
+ } else {
+ secinp.put(name, l4Nodestr);
+ }
+ }
+
+ if (secinp.isEmpty()) {
+ } else {
+ input.put("secinp" + sec, secinp); // to add
+ // Secondary to
+ // Input
+ sec += 1;
+ Enumeration num = secinp.keys();
+ // Report.doWrite("Secondary input "+ (sec-1));
+ // Log.info("Secondary input "+ (sec-1));
+ }
+ }
+ }
+ }
+
+ if (simple.equals("error") | collection.equals("error")
+ | secondary.equals("error")) {
+ input.put("input", "error");
+ }
+ } catch (Exception e) {
+ Log.warning("Failed:" + e);
+ }
+ // }
+ //System.out.println("input= "+input);
+ return input;
+
+ }
+
+ /**
+ * get set of Outputs for service (Simple and Collection)
+ *
+ * @param resource -
+ * the URL of resource + serviceName+authURI
+ * @return Hashtable of hashtables represented by a pair: a name of the
+ * output = hashtable for this output hashtable for output is
+ * represented by a Output descriptor and value.
+ *
+ */
+
+ public Hashtable getOutput(String resource) {
+ int bagout = 0;
+ int so = 1;
+ int co = 1;
String simple = "ok";
String collection = "ok";
- Hashtable output = new Hashtable();
+ Hashtable output = new Hashtable();
+
+ Resource si = servDescrMd.getResource(resource);
+
+ try {
+ Resource consumes = si.getRequiredProperty(MP.produces)
+ .getResource();
+ StmtIterator p23iter = consumes.listProperties();
+
+ while (p23iter.hasNext()) {
+
+ Hashtable simout = new Hashtable();
+ Hashtable colout = new Hashtable();
+ StringBuffer simpns = new StringBuffer();
+ // StringBuffer colons = new StringBuffer();
+
+ Statement l3iter = p23iter.nextStatement();
+ Resource l3Res = l3iter.getResource();
+
+ if (l3Res.isAnon()) {
+ Object type = l3Res.getRequiredProperty(RDF.type)
+ .getObject();
+ //System.out.println("type_out = "+type);
+ if (type.equals(MP.Simple)) {
+ StmtIterator p34iter = l3Res.listProperties();
+
+ while (p34iter.hasNext()) {
+ Statement l4iter = p34iter.nextStatement();
+ String l4Pred1 = l4iter.getPredicate().toString();
+ String l4Node1 = l4iter.getObject().toString();
+ String[] result = l4Pred1.split("#");
+ int i = (result.length) - 1;
+
+ String name = getInpOutName(result[i]);
+ if (name.equals("")) {
+ Report
+ .doWrite("BAD STRUCTURE: Unknown name of predicate for Simple output <"
+ + result[i] + ">");
+ Report
+ .add("BAD STRUCTURE: Unknown name of predicate for Simple output <"
+ + result[i] + ">");
+ simple = "error";
+ continue;
+ }
+ if (name.equals("type")) {
+ continue;
+ }
+ String[] rezNode1 = l4iter.getObject().toString()
+ .split(":http:");
+ String l4Nodestr = rezNode1[0];
+ if (name.equals("namespace_type_uris")) {
+ simout.remove("namespace_type_uris");
+ String lsid_nsp = switchURItoLSID(l4Nodestr);
+ if (simpns.length() == 0) {
+ simpns.append(lsid_nsp);
+ } else {
+ simpns.append("," + lsid_nsp);
+ }
+
+ simout.put(name, simpns.toString());
+ } else if (name.equals("object_type_uri")) {
+ String lsid_nsp = switchURItoLSID(l4Nodestr);
+ simout.put(name, lsid_nsp);
+ } else {
+ simout.put(name, l4Nodestr);
+ }
+ }
+ if (simout.isEmpty()) {
+ } else {
+ output.put("simout" + so, simout); // to add Simple
+ // to Output
+ so += 1;
+ Enumeration num = simout.keys();
+
+ }
+ }
+
+ else if (type.equals(MP.Collection) | type.equals(RDF.Bag)) {
+ // if (l3Res.hasProperty(RDF.type,RDF.Bag) &&
+ // l3Res.hasProperty(RDF.li(1))){
+
+ if (l3Res.hasProperty(RDF.li(1))) {
+ StmtIterator p34iter = l3Res.listProperties();
+
+ if (l3Res.hasProperty(MP.article_name)) {
+ String col_artName = l3Res.getProperty(
+ MP.article_name).getObject().toString();
+ String[] rezNode = col_artName.split(":http:");
+ col_artName = rezNode[0];
+ colout.put("col_articleName", col_artName);
+ }
+ while (p34iter.hasNext()) {
+ Statement l4iter = p34iter.nextStatement();
+ Property l4Pred = l4iter.getPredicate();
+ Node l4Node = l4iter.getObject().asNode();
+
+ if (l4Node.isBlank()) {
+ Resource l4Res = l4iter.getResource();
+ StmtIterator p45iter = l4Res
+ .listProperties();
+ if (p45iter.hasNext()) {
+ StringBuffer sumns = new StringBuffer();
+ while (p45iter.hasNext()) {
+ Statement l5iter = p45iter
+ .nextStatement();
+ String l5Pred = l5iter
+ .getPredicate().toString();
+ Node l5Node = l5iter.getObject()
+ .asNode();
+ String[] result = l5Pred.split("#");
+ int i = (result.length) - 1;
+ String name = getInpOutName(result[i]);
+ if (name.equals("")) {
+ Report
+ .doWrite("BAD STRUCTURE: Unknown name of predicate for Collection output <"
+ + result[i]
+ + ">");
+ Report
+ .add("BAD STRUCTURE: Unknown name of predicate for Collection output <"
+ + result[i]
+ + ">");
+ String Collection = "error";
+ break;
+ }
+ String[] rezNode = l5iter
+ .getObject().toString()
+ .split(":http:");
+ String l5Nodestr = rezNode[0];
+ if (name
+ .equals("namespace_type_uris")) {
+ colout
+ .remove("namespace_type_uris");
+ String lsid_nsp = switchURItoLSID(l5Node
+ .toString());
+ if (sumns.length() == 0) {
+ sumns.append(lsid_nsp);
+ } else {
+ sumns
+ .append(","
+ + lsid_nsp);
+ }
+
+ colout.put(name, sumns
+ .toString());
+ // sumns.append(l5Node+",");
+ } else if (name
+ .equals("object_type_uri")) {
+ String lsid_nsp = switchURItoLSID(l5Node
+ .toString());
+ colout.put(name, lsid_nsp);
+ } else {
+ colout.put(name, l5Node);
+ }
+ }
+ output.put("colout" + co, colout);
+ co += 1;
+ Enumeration num = colout.keys();
+ }
+ }
+
+ }
+ } else {
+ collection = "error";
+ Report
+ .doWrite("BAD STRUCTURE: The Collection output isn't 'Bag' type or have not members");
+ Report
+ .add("BAD STRUCTURE: The Collection output isn't 'Bag' type or have not members");
+
+ }
+ }
+ }
+ }
+
+ if (simple.equals("error") | collection.equals("error")) {
+ output.put("output", "error");
+ }
+ } catch (Exception e) {
+ Log.warning("Failed:" + e);
+ }
+ //System.out.println("output = "+output);
+ return output;
+ }
+
+ /**
+ * mapping RDF data to the database data
+ *
+ * @param name -
+ * the name of predicate in the RDF of service
+ * @return String field name in database corresponding with this predicate
+ *
+ */
+
+ public String getFieldName(String name) {
+ String res = "";
+
+ if (name.equals("publisher") | name.equals("authURI")) {
+ ver[0] = 1;
+ res = "authURI";
+ } else if (name.equals("coverage")) {
+ ver[1] = 1;
+ res = "category";
+ } else if (name.equals("creator") | name.equals("contactEmail")) {
+ ver[2] = 1;
+ res = "contact_email";
+ } else if (name.equals("source")) {
+ ver[3] = 1;
+ res = "URL";
+ } else if (name.equals("performs_task") | name.equals("serviceType")) {
+ ver[4] = 1;
+ res = "service_type_uri";
+ } else if (name.equals("title") | name.equals("serviceName")) {
+ ver[5] = 1;
+ res = "servicename";
+ } else if (name.equals("description") | name.equals("comment")) {
+ ver[6] = 1;
+ res = "description";
+ } else if (name.equals("authoritative")) {
+ ver[7] = 1;
+ res = "authoritative";
+ } else if (name.equals("signatureURL")) {
+ res = "signatureURL";
+ }
+
+ return res;
+ }
+
+ /**
+ * mapping RDF input/output data to the database data
+ *
+ * @param name -
+ * the name of predicate in the RDF of service
+ * @return String field name in database corresponding with this predicate
+ *
+ */
+
+ public String getInpOutName(String name) {
+ String res = "";
+ if (name.equals("article_name") | name.equals("articleName")) {
+ res = "articleName";
+ }
- Resource si = servDescrMd.getResource(resource);
-
-
- try{
- Resource consumes = si.getRequiredProperty(MP.produces).getResource();
- StmtIterator p23iter = consumes.listProperties();
-
- while (p23iter.hasNext()) {
-
- Hashtable simout = new Hashtable();
- Hashtable colout = new Hashtable();
- StringBuffer simpns = new StringBuffer();
-// StringBuffer colons = new StringBuffer();
-
- Statement l3iter = p23iter.nextStatement();
- Resource l3Res = l3iter.getResource();
-
- if (l3Res.isAnon()){
- Object type = l3Res.getRequiredProperty(RDF.type).getObject();
-//System.out.println("type_out = "+type);
- if (type.equals(MP.Simple)){
- StmtIterator p34iter = l3Res.listProperties();
-
- while (p34iter.hasNext()) {
- Statement l4iter = p34iter.nextStatement();
- String l4Pred1 = l4iter.getPredicate().toString();
- String l4Node1 = l4iter.getObject().toString();
- String[] result = l4Pred1.split("#");
- int i = (result.length)-1;
-
- String name = getInpOutName(result[i]);
- if (name.equals("")){
- Report.doWrite("BAD STRUCTURE: Unknown name of predicate for Simple output <"+result[i]+">");
- Report.add("BAD STRUCTURE: Unknown name of predicate for Simple output <"+result[i]+">");
- simple = "error";
- continue;
- }
- if (name.equals("type")){
- continue;
- }
- String[] rezNode1 = l4iter.getObject().toString().split(":http:");
- String l4Nodestr = rezNode1[0];
- if (name.equals("namespace_type_uris")){
- simout.remove("namespace_type_uris");
- String lsid_nsp = switchURItoLSID(l4Nodestr);
- if (simpns.length()==0){
- simpns.append(lsid_nsp);
- }else{
- simpns.append(","+lsid_nsp);
- }
-
- simout.put(name,simpns.toString());
- }
- else if (name.equals("object_type_uri")){
- String lsid_nsp = switchURItoLSID(l4Nodestr);
- simout.put(name,lsid_nsp);
- }
- else{
- simout.put(name,l4Nodestr);
- }
- }
- if (simout.isEmpty()){
- }else{
- output.put("simout"+so,simout); // to add Simple to Output
- so+=1;
- Enumeration num = simout.keys();
-
- }
- }
-
- else if (type.equals(MP.Collection) | type.equals(RDF.Bag)){
-// if (l3Res.hasProperty(RDF.type,RDF.Bag) && l3Res.hasProperty(RDF.li(1))){
-
- if (l3Res.hasProperty(RDF.li(1))){
- StmtIterator p34iter = l3Res.listProperties();
-
- if (l3Res.hasProperty(MP.article_name)){
- String col_artName = l3Res.getProperty(MP.article_name).getObject().toString();
- String[] rezNode = col_artName.split(":http:");
- col_artName = rezNode[0];
- colout.put("col_articleName",col_artName);
- }
- while (p34iter.hasNext()) {
- Statement l4iter = p34iter.nextStatement();
- Property l4Pred = l4iter.getPredicate();
- Node l4Node = l4iter.getObject().asNode();
-
- if (l4Node.isBlank()){
- Resource l4Res = l4iter.getResource();
- StmtIterator p45iter = l4Res.listProperties();
- if(p45iter.hasNext()) {
- StringBuffer sumns = new StringBuffer();
- while (p45iter.hasNext()) {
- Statement l5iter = p45iter.nextStatement();
- String l5Pred = l5iter.getPredicate().toString();
- Node l5Node = l5iter.getObject().asNode();
- String[] result = l5Pred.split("#");
- int i = (result.length)-1;
- String name = getInpOutName(result[i]);
- if (name.equals("")){
- Report.doWrite("BAD STRUCTURE: Unknown name of predicate for Collection output <"+result[i]+">");
- Report.add("BAD STRUCTURE: Unknown name of predicate for Collection output <"+result[i]+">");
- String Collection = "error";
- break;
- }
- String[] rezNode = l5iter.getObject().toString().split(":http:");
- String l5Nodestr = rezNode[0];
- if (name.equals("namespace_type_uris")){
- colout.remove("namespace_type_uris");
- String lsid_nsp = switchURItoLSID(l5Node.toString());
- if (sumns.length()==0){
- sumns.append(lsid_nsp);
- }else{
- sumns.append(","+lsid_nsp);
- }
-
- colout.put(name,sumns.toString());
-// sumns.append(l5Node+",");
- }else if (name.equals("object_type_uri")){
- String lsid_nsp = switchURItoLSID(l5Node.toString());
- colout.put(name,lsid_nsp);
- }
- else{
- colout.put(name,l5Node);
- }
- }
- output.put("colout"+co,colout);
- co+=1;
- Enumeration num = colout.keys();
- }
- }
-
- }
- }else{
- collection = "error";
- Report.doWrite("BAD STRUCTURE: The Collection output isn't 'Bag' type or have not members");
- Report.add("BAD STRUCTURE: The Collection output isn't 'Bag' type or have not members");
-
- }
- }
- }
- }
-
- if (simple.equals("error") | collection.equals("error")){
- output.put("output","error");
- }
- }catch(Exception e){
- Log.warning("Failed:"+ e);
- }
-//System.out.println("output = "+output);
- return output;
- }
-
-
-/** mapping RDF data to the database data
- * @param name - the name of predicate in the RDF of service
- * @return String field name in database corresponding with this predicate
- *
- */
-
-
-public String getFieldName(String name){
- String res = "";
-
- if (name.equals("publisher") | name.equals("authURI")){
- ver[0] = 1;
- res = "authURI";
- }
- else if (name.equals("coverage")){
- ver[1] = 1;
- res = "category";
- }
- else if (name.equals("creator") | name.equals("contactEmail")){
- ver[2] = 1;
- res = "contact_email";
- }
- else if (name.equals("source") ){
- ver[3] = 1;
- res = "URL";
- }
- else if (name.equals("performs_task") | name.equals("serviceType")){
- ver[4] = 1;
- res = "service_type_uri";
- }
- else if (name.equals("title") | name.equals("serviceName")){
- ver[5] = 1;
- res = "servicename";
- }
- else if (name.equals("description") | name.equals("comment")){
- ver[6] = 1;
- res = "description";
- }
- else if (name.equals("authoritative") ){
- ver[7] = 1;
- res = "authoritative";
- }
- else if (name.equals("signatureURL") ){
- res = "signatureURL";
- }
-
- return res;
-}
-
-/** mapping RDF input/output data to the database data
- * @param name - the name of predicate in the RDF of service
- * @return String field name in database corresponding with this predicate
- *
- */
-
-public String getInpOutName(String name){
- String res = "";
- if (name.equals("article_name") | name.equals("articleName")){
- res = "articleName";
- }
-
- else if (name.equals("object_type")){
- res = "object_type_uri";
- }
- else if (name.equals("namespace_type")){
- res = "namespace_type_uris";
- }
- else if (name.equals("type")){
- res = "type";
- }
-
- return res;
-}
-
-/** mapping RDF Secondary data to the database data
- * @param name - the name of predicate in the RDF of service
- * @return String field name in database corresponding with this predicate
- *
- */
-
-public String getSecondaryName(String name){
- String res = "";
-
- if (name.equals("article_name") | name.equals("articleName")){
- res = "article_name";
- }
-
- if (name.equals("default_value")){
- res = "default";
- }
- if (name.equals("datatype")){
- res = "datatype";
- }
- if (name.equals("max")){
- res = "max";
- }
- if (name.equals("min")){
- res = "min";
- }
- if (name.equals("enum")){
- res = "enum";
- }
- if (name.equals("type")){
- res = "type";
- }
-
- return res;
-}
-
-public String switchURItoLSID(String uri){
- String lsid = "";
-
-try{
-
-
- if (uri.substring(0,4).equals("http")){
- String[] result = uri.split("/");
- if ((result.length)-1 > 0){
- if (result[2].equals("biomoby.org")){
- String[] result1 = result[5].split("#");
- if ((result1.length)-1 > 0){
- if (result1[0].equals("Namespaces")){
- lsid = "urn:lsid:biomoby.org:namespacetype:"+result1[1];
- }
- else if (result1[0].equals("Objects")){
- lsid = "urn:lsid:biomoby.org:objectclass:"+result1[1];
- }
- else if (result1[0].equals("Services")){
- lsid = "urn:lsid:biomoby.org:servicetype:"+result1[1];
- }
- }
- }
- else {
- lsid = uri;
- }
- }
- }
-
-else if (uri.substring(0,3).equals("urn:")){
- lsid = uri;
-}
-else {
- lsid = "";
-}
-}catch (Exception e){
-//System.out.println("False: "+e);
-
-}
- return lsid;
-}
-}
+ else if (name.equals("object_type")) {
+ res = "object_type_uri";
+ } else if (name.equals("namespace_type")) {
+ res = "namespace_type_uris";
+ } else if (name.equals("type")) {
+ res = "type";
+ }
+
+ return res;
+ }
+
+ /**
+ * mapping RDF Secondary data to the database data
+ *
+ * @param name -
+ * the name of predicate in the RDF of service
+ * @return String field name in database corresponding with this predicate
+ *
+ */
+
+ public String getSecondaryName(String name) {
+ String res = "";
+
+ if (name.equals("article_name") | name.equals("articleName")) {
+ res = "article_name";
+ }
+
+ if (name.equals("default_value")) {
+ res = "default";
+ }
+ if (name.equals("datatype")) {
+ res = "datatype";
+ }
+ if (name.equals("max")) {
+ res = "max";
+ }
+ if (name.equals("min")) {
+ res = "min";
+ }
+ if (name.equals("enum")) {
+ res = "enum";
+ }
+ if (name.equals("type")) {
+ res = "type";
+ }
+
+ return res;
+ }
+
+ public String switchURItoLSID(String uri) {
+ String lsid = "";
+
+ try {
+
+ if (uri.substring(0, 4).equals("http")) {
+ String[] result = uri.split("/");
+ if ((result.length) - 1 > 0) {
+ if (result[2].equals("biomoby.org")) {
+ String[] result1 = result[5].split("#");
+ if ((result1.length) - 1 > 0) {
+ if (result1[0].equals("Namespaces")) {
+ lsid = "urn:lsid:biomoby.org:namespacetype:"
+ + result1[1];
+ } else if (result1[0].equals("Objects")) {
+ lsid = "urn:lsid:biomoby.org:objectclass:"
+ + result1[1];
+ } else if (result1[0].equals("Services")) {
+ lsid = "urn:lsid:biomoby.org:servicetype:"
+ + result1[1];
+ }
+ }
+ } else {
+ lsid = uri;
+ }
+ }
+ }
+
+ else if (uri.substring(0, 3).equals("urn:")) {
+ lsid = uri;
+ } else {
+ lsid = "";
+ }
+ } catch (Exception e) {
+ //System.out.println("False: "+e);
+
+ }
+ return lsid;
+ }
+}
\ No newline at end of file
More information about the MOBY-guts
mailing list