回复:DREFT SKOS同义词表API演示器

你好,弗兰克是的,我知道导致IndexOutOfBoundsException的错误。然而,我不记得uri导致了MalformedQueryExceptions,这是我认为你在说什么。你似乎很理解代码,我也能理解建议如果你想提交一个错误修复,我会更新sourceforge代码。如果没有,那么我(我自己)已经答应我会的圣诞节前在我的机器上恢复DREFT演示,如果是这样的话我自己重新安装所有东西,并将跟踪您的查询和给你回电话。我现在只能说这些了。我们目前没有有资金在内部维护DREFT软件。顺便问一下,你能描述一下你用DREFT做什么吗?如果我把演示再次出现在我们的网站上,如果我们能够链接其他人正在用软件做/开发/测试什么。非常感谢尼基·罗杰斯--2005年12月5日星期一下午02:12:59-0800 Frank Wang<fwang@maketechnologies.com>写道:>>>安装、配置和验证tomcat5.5、axis1.3和芝麻之后> 1.2.2. 我已经构建并部署了SKOS服务,其中的源代码>已从下载>http://www.w3.org/2001/sw/Europe/reports/thes/skosapi.html.我在那里找到的>测试此API时,源代码中存在一些问题。所有查询>使用org.w3.y2001.sw构造的字符串。Europe.skos.query。SERQLQuery(SERQL查询)>类不正确。对于URI或URL,格式为<!…>,和结果>在org.openrdf.sesame.query中。错误的查询异常。例外情况>java.lang.IndexOutOfBoundsException是从>org.w3.y2001.sw。欧洲.skos.repository。SesameRepo#doSearch_for_concepts>因为循环语句中有一些bug(请参阅变量row,col)。>这种异常也来自>resultsTable变量可能为null或空集合。>>>>>>我回顾的方法如下:>>>>公共概念[]doSearch_for_concepts(AbstractQuery查询){>>>>>>//接下来,我们需要实际创建>存储库。>>//我们通过创建LocalService>输入配置,然后检索>>//服务中的存储库。>>LocalService服务=Sesame.getService();>>>>AdminMsgCollector admin_info=新建>管理员消息收集器();>>>>尝试{>>>>service.addRepository(repo_config);>>>>Sesame存储库myRepository=>service.getRepository(RepoID);>>>>//测试skos的查询:相关。没有>由此推断,此查询只返回1个结果:>>//网址:/example.com/Concept/0003>>//我也需要它来带回0004概念>暂时性工作时-即使规则文件当前也不工作>读入>>//字符串查询=“从{X:>core:Concept}core:related{Y}其中X喜欢>\“http://example.com/Concept/0002\”使用命名空间核心=>http://www.w3.org/2004/02/skos/core#";>>>>//String query=“select*from{X}core:broader>{Y}其中Y类似于“http://example.com/Concept/0002”using namespace>堆芯,堆芯=http://www.w3.org/2004/02/skos/core#";>>//字符串查询=“select*from{X}@P{Y}”;>>//字符串查询=“select X,@PROPERTY,VALUE from>{X:core:Concept}核心:更宽的{Y},{X}@PROPERTY{VALUE},其中Y喜欢>\“http://example.com/Concept/0002\”使用命名空间核心=>http://www.w3.org/2004/02/skos/core#";>>字符串query_str=query.getQuery();>>>>//System.out.println(“现在要发出查询>针对存储库”);>>//System.out.println(“查询是:”+Query_str);>>>>//确定内部查询对象的类型>我们有,(RQL、SERQL RDQL等)>>//所以我们可以教芝麻>适当地。>>>>//TODO:这看起来特别可疑-使用>要打开的类名的子字符串。>>字符串query_type=query.getClass().getName();>>查询语言query_format=null;>>>>if(query_type.indexOf(“SERQL”)!=-1)>>                         {>>//System.out.println(“检测到的SERQL>查询”);>>logger.debug(this+“检测到SERQL>查询“”+query_str+“”);>>query_format=查询语言。SERQL;>>>>                         }>>else if(query_type.indexOf(“RQL”)!=-1)  {>>//System.out.println(“检测到RQL>查询”);>>logger.debug(this+“检测到的RQL>查询“”+query_str+“”);>>query_format=查询语言。RQL;>>                         }>>其他{>>//默认为SERQL>>//System.out.println(“默认为>SERQL查询”);>>logger.debug(this+“默认为>SERQL查询“+query_str+”“”);>>query_format=查询语言。SERQL;>>                         }>>>>查询结果表结果表=>myRepository.performTableQuery(query_format,query_str);>>>>//添加>>if((结果表==空)||>(resultsTable.getRowCount()==0))>>                         {>>返回null;>>                         }>>>>                         /*>>//*******************仅调试> ******************>>System.out.println(“得到一个带有的结果表”+>resultsTable.getRowCount()+“其中的行”);>>for(int行=0;行<>resultsTable.getRowCount();行++){>>for(int列=0;>列<resultsTable.getColumnCount();列++){>>Value值=>resultsTable.getValue(行、列);>>>>>System.out.print(value.toString());>>>System.out.print(“”);>>>>                                                 }>>System.out.println();>>                                     }>>//*****************仅调试> ******************>>                 */>>>>>>//实例化要保存为的arraylist对象>作为结果集返回的许多概念对象>>concept_resultset=新数组列表();>>>>//获取第一个概念的uri>在结果表中>>值curr_concept=结果表.getValue(0,0);>>//System.out.println(curr_concept.toString());>>>>>>//实例化数组列表>反对持有未提及条款>>non_pref_term_list=新数组列表();>>>>概念Concept_bean=新概念();>>//System.out.println(“刚构造了一个新bean>准备填充XXXXXXXXXXX x“);>>logger.debug(this+“*****构建了一个概念>准备填充的豆子*****“);>>>>//移到牵引绳下方以进行环路>>//int行=0;>>//int col=0;>>>>对于(int row_n=0;row_n<>(resultsTable.getRowCount()-1);第n行++){>>>>int行=0;>>整数列=0;>>>>做{>>当前概念=>resultsTable.getValue(行,列);>>>>if(curr_concept!=空)> {>>>if(curr_concept实例org.openrdf.model.URI){>>>URI tmp_URI=新URI();>>>tmp_uri.setUri(((org.openrdf.model.uri)curr_concept).getURI());>>>concept_bean.setUri(tmp_uri);>>>tmp_uri=空;>>                                                             }>>>>//待办事项>为每个prefLabel等分隔名称空间和属性名>>//这个可以>然后通过初始参数等进行配置>>字符串>curr_property=结果表.getValue(行,1).toString();>>>如果>(curr_property.equals(skosNamespaceUri+“prefLabel”){>>>//System.out.println(“bean的pref标签:”>+resultsTable.getValue(行,2).toString());>>>concept_bean.setPreferredLabel(resultsTable.getValue(行,2).toString());>>}否则如果>(curr_property.equals(skosNamespaceUri+“definition”)){>>                                                                //>System.out.println(“必须定义bean:”>+resultsTable.getValue(行,2).toString());>>>concept_bean.setDefinition(resultsTable.getValue(row,2).toString());>>}否则如果>(curr_property.equals(skosNamespaceUri+“示例”){>>                                                                //>System.out.println(“bean的示例:”>+resultsTable.getValue(行,2).toString());>>>concept_bean.setExample(resultsTable.getValue(row,2).toString());>>}否则如果>(curr_perty.equals(skosNamespaceUri+“scopeNote”)){>>                                                                //>System.out.println(“必须确定bean的作用域注意:”>+resultsTable.getValue(行,2).toString());>>>concept_bean.setScopeNote(resultsTable.getValue(行,2).toString());>>}否则如果>(curr_property.toString().equals(skosNamespaceUri+“externalID”)){>>>//System.out.println(“获取bean的外部id:”>+resultsTable.getValue(行,2).toString());>>>concept_bean.setExternalID(resultsTable.getValue(row,2).toString());>>}否则如果>(curr_property.toString().equals(skosNamespaceUri+“inScheme”){>>>URI tmp_URI=新URI();>>>tmp_uri.setUri(resultsTable.getValue(第2行).toString());>>>concept_bean.setInScheme(tmp_uri);>>>tmp_uri=空;>>}否则如果>(curr_property.equals(skosNamespaceUri+“altLabel”){>>                                                                        //>System.out.println(“bean的total(non-pref):”>+resultsTable.getValue(行,2).toString());>>>add_to_nonrefLabel_array(resultsTable.getValue(row,2).toString());>>>                                                             }>>>}//结束条件>>>>logger.debug(这个+>“*****当前正在处理的概念称为*****”+>当前概念);>>>//System.out.println(“doing a bean,current concept is”+curr_concept);>>>//System.out.println(“Property is”+resultsTable.getValue(row,1));>>>//System.out.println(“值为”+resultsTable.getValue(行,2));>>>>}while((第++行<>(结果表.getRowCount()-1))&&>resultsTable.getValue(行,列).equals(curr_concept));>>//从数组列表转换为字符串>阵列,因为Axis软件最容易处理阵列>>String[]str=(String[])>non_pref_term_list.toArray(新字符串[non_pref_term_list.size()]);>>concept_bean.setNonPreferredLabels(str);>>>>//System.out.println(“left while loop now”);>>//我们已经完成了为此创建的bean>特定概念,因此将概念bean添加到概念bean结果集>>add_to_concept_array(概念bean);>>//重置非首选项数组列表>>non_pref_term_list=新数组列表();>>logger.debug(this+“*****已完成构造>a Concept bean*****“);>>//System.out.println(“刚构造了一个新bean>XXXXXXXXXXX x“);>>>>concept_bean=新概念();>>>>}//结束for循环>>>>>>>>             }>>catch(java.lang.IndexOutOfBoundsException ioobe)>>             {>>记录器错误(ioobe);>>             }>>catch(文件未找到异常fnfe)>>             {>>日志管理员消息(admin_info);>>//System.out.println(fnfe);>>记录器错误(fnfe);>>             }>>catch(AccessDeniedException ade)>>             {>>日志管理员消息(admin_info);>>//System.out.println(ade);>>记录器错误(ade);>>             }>>catch(IOException ioe)>>             {>>日志管理员消息(admin_info);>>//System.out.println(“IO异常”+ioe);>>logger.error(此+“IO异常:”+ioe);>>>             }>>catch(配置异常cfe)>>             {>>日志管理员消息(admin_info);>>//System.out.println(cfe);>>>记录器错误(cfe);>>             }>>catch(未知RepositoryException ure){>>日志管理员消息(admin_info);>>//System.out.println(ure);>>记录器错误(ure);>>             }>>catch(异常e)>>             {>>日志管理员消息(admin_info);>>记录器错误(e);>>             }>>>>//现在让我们获取我们一直存储的概念结果&>把它们还给我>>return(Concept[])Concept_resultset.toArray(新概念>[concept_resultset.size()]);>>>>             }>>>>>>>>> __________________________________________________>>>弗兰克·王>Java开发人员>>MAKE技术公司。>>电子邮件:>>fwang@maketechnologies.com>>电话:>>604.738.4999 xtn 0码>>传真:>> 604.738.4979>>访问:>>www.maketechnologies.com>>----------------------NJ Rogers,技术研究员(高级技术开发人员和网络期货协调员)学习与研究技术学院(ILRT)电子邮件:nikki.rogers@bristol.ac.uk电话:+44(0)117 9287113(直拨)电话:+44(0)117 9287193(办公室)

接收日期:2005年12月7日星期三11:15:07 UTC