以文本方式查看主题

-  计算机科学论坛  (http://bbs.xml.org.cn/index.asp)
--  『 Semantic Web(语义Web)/描述逻辑/本体 』  (http://bbs.xml.org.cn/list.asp?boardid=2)
----  怎样识别某个属性的值?"中国^^http://www.w3.org/2001/XMLSchema#string"  (http://bbs.xml.org.cn/dispbbs.asp?boardid=2&rootid=&id=37668)


--  作者:horizonman
--  发布时间:9/7/2006 10:31:00 AM

--  怎样识别某个属性的值?"中国^^http://www.w3.org/2001/XMLSchema#string"
查询某个类的实例的属性,并返回其值,返回的结果如下:
"中国^^http://www.w3.org/2001/XMLSchema#string"
"900^^http://www.w3.org/2001/XMLSchema#int"
这并非所预期的:
“中国”
“900”
怎么回事呀,jena返回的实例的值都是字符串形式的,难道还要自己去解析呀!我感觉这有点别扭!
--  作者:jpz6311whu
--  发布时间:9/7/2006 12:30:00 PM

--  
com.hp.hpl.jena.rdf.model
Interface Literal

getString
java.lang.String getString()If the literal is interpretable as a string return its value. For typed literals this will throw an error for non string literals and one needs to use getLexicalForm to return the string form of other datatypes.

Returns:
the literal string


--  作者:jpz6311whu
--  发布时间:9/7/2006 12:31:00 PM

--  
getInt
int getInt()If the literal is interpretable as a Integer return its value. Plain literals are interpreted by parsing their lexical representation, typed literals are interpreted by coercion of the java object representing their value.

Returns:
the literal interpeted as an int


W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
109.375ms