在RDF中获取和显示结果
运行应用程序。您将看到以下输出,它是以RDF格式返回的结果。
Result = <?xml version="1.0" encoding="UTF-8"?>
<!--Use of the Calais Web Service is governed by the Terms of Service located at
http://www.opencalais.com. By using this service or the results of the service you agree to these terms of service.-->
<!--Relations: -->
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:c="http://s.opencalais.com/1/pred/">
<rdf:Description c:allowDistribution="true" c:allowSearch="true" c:externalID="17cabs901"
c:id="http://id.opencalais.com/bUbfFuD236B*1cQ0HYI6oQ"
rdf:about="http://d.opencalais.com/dochash-1/39398136-d4d6-3982-8f21-485fb471eeb8">
<rdf:type rdf:resource="http://s.opencalais.com/1/type/sys/DocInfo"/>
<c:document>
<![CDATA[<Document><Title>1202964573347-746EE973-4572
</Title><Date>2008-02-13</Date><Body>water
</Body></Document>]]>
</c:document>
<c:externalMetadata></c:externalMetadata>
<c:submitter>ABC</c:submitter>
</rdf:Description>
<rdf:Description c:contentType="text/txt" c:emVer="UnifiedIM-DJ"
c:langIdVer="DefaultLangId" c:language="English" c:processingVer="CalaisJob01"
c:submitionDate="2008-02-13 23:49:33.347"
rdf:about="http://d.opencalais.com/dochash-1/39398136-d4d6-3982-8f21-485fb471eeb8/meta">
<rdf:type rdf:resource="http://s.opencalais.com/1/type/sys/DocInfoMeta"/>
<c:docId rdf:resource="http://d.opencalais.com/dochash-1/39398136-d4d6-3982-8f21-485fb471eeb8"/>
<c:submitterCode>954dedfb-e5af-ff67-5cc1-9599f94aeacf</c:submitterCode>
<c:signature>
digestalg-1|Rv3gMjGYbJzloiKbo24xZwaUCNs=|NxxctMO/y2jIkIcVC1AI8WYUd+OTqz2cdzZWTrqqkiIhOjPXI7FAGA==
</c:signature>
</rdf:Description>
<rdf:Description rdf:about="http://d.opencalais.com/dochash-1/39398136-d4d6-3982-8f21-485fb471eeb8/lid/DefaultLangId">
<rdf:type rdf:resource="http://s.opencalais.com/1/type/lid/DefaultLangId"/>
<c:docId rdf:resource="http://d.opencalais.com/dochash-1/39398136-d4d6-3982-8f21-485fb471eeb8"/>
<c:lang rdf:resource="http://d.opencalais.com/lid/DefaultLangId/English"/>
</rdf:Description>
</rdf:RDF>
更多练习
我们获得的是RDF,而不是一般的可读性文本。它并未显示出Open Calais的功能强大之处。但是,现在我们已经完成了“后台办公”的任务。接下来,您可以试着完成以下任务:
使用该RDF获得有用格式的返回信息。
创建应一个名称为"contextualiser"的应用程序,用于返回与查询文本相关的上下文信息,因此在这里我选择它作为Java应用程序的名称。
要从RDF输出中获得相关信息,必须具备一定的RDF知识。以下工具/库可以提供帮助:
结束语
本教程的主要目的是介绍如何创建能够与Open Calais Web服务交互的JAX-WS客户机。但是,本文中的概念同样适用于编写与任何其它Web服务进行交互的客户机。