Ignore:
Timestamp:
01/14/11 11:39:19 (13 years ago)
Author:
vronk
Message:

further work on terms/values (layout, behaviour)
fix in repository handling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/model/Query.java

    r1046 r1071  
    328328               
    329329                if (type.equals(MODEL)) {
    330                         targetRequest = toCMDIndex() + "&maxdepth=" + getMaxdepth()  ; /* + "&maxdepth=" + getMaxdepth() );  "&collection=" + getCollection() + */
     330                        targetRequest = fromCMDIndex2Xpath() + "&maxdepth=" + getMaxdepth()  ; /* + "&maxdepth=" + getMaxdepth() );  "&collection=" + getCollection() + */
    331331                } else if (type.equals(VALUES)) {
    332                         targetRequest = toCMDIndex() ; /* + "&maxdepth=" + getMaxdepth() );  "&collection=" + getCollection() + */
     332                        targetRequest = fromCMDIndex2Xpath() ; /* + "&maxdepth=" + getMaxdepth() );  "&collection=" + getCollection() + */
    333333                       
    334334                        if (startItem != null) {
     
    442442        /**
    443443         * if the query is just a path-like structure
    444          * "transforms" to cmdIndex-format, means replace('.', '/') ;)
     444         * "transforms" the cmdIndex-format to appropriate XPath, means replace('.', '/') ;)
     445         * and resolves back possible profile-prefix
    445446         * @return
    446447         */
    447         public String toCMDIndex() {   
    448                  return query_string.replace('.', '/');
     448        public String fromCMDIndex2Xpath() {
     449                String xpath = "";
     450                if (query_string.contains(":")) {
     451                        int delim_index = query_string.indexOf(":");
     452                        String prefix = query_string.substring(0,delim_index );
     453                        Termset res = (Termset) Termset.getTermset(prefix);
     454                        String profile_name = res.getAttr("name");
     455                        if (profile_name.equals("")) {
     456                                xpath=query_string.substring(delim_index);
     457                        } else {
     458                                xpath = profile_name + "//" + query_string.substring(delim_index+1);
     459                        }
     460                               
     461                } else {
     462                        xpath = query_string;
     463                }
     464                               
     465                 return xpath.replace('.', '/');
    449466        }
    450467
Note: See TracChangeset for help on using the changeset viewer.