<?xml version="1.0" encoding="gb2312"?>

<!-- RSS generated by oioj.net on 4/16/2004 ; 感谢LeXRus提供 RSS 2.0 文档; 此文件可自由使用，但请保留此行信息 --> 
<!-- Source download URL: http://blogger.org.cn/blog/rss2.asp       -->
<rss version="2.0">

<channel>
<title>kitten_ice的博客</title>
<link>http://blogger.org.cn/blog/blog.asp?name=kitten_ice</link>
<description>爱睡觉的猫的博客</description>
<copyright>blogger.org.cn</copyright>
<generator>W3CHINA Blog</generator>
<webMaster>webmaster@blogger.org.cn</webMaster>
<item>
<title><![CDATA[Jena Introduction]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=kitten_ice&amp;id=17682</link>
<author>kitten_ice</author>
<pubDate>2006/8/20 10:45:24</pubDate>
<description><![CDATA[
<H2 style="MARGIN: auto 30.6pt"><SPAN lang=EN-US><FONT size=4>1.</FONT></SPAN><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; COLOR: black; FONT-FAMILY: Verdana"> Introduction</SPAN></H2><PRE style="MARGIN-RIGHT: 66.6pt"><FONT size=2><CODE><SPAN style="COLOR: black; FONT-FAMILY: 黑体; mso-ascii-font-family: Courier">创建一个模型，并用</SPAN></CODE><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier">StmtInterator</SPAN></CODE><CODE><SPAN style="COLOR: black; FONT-FAMILY: 黑体; mso-ascii-font-family: Courier">循环取出</SPAN></CODE><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier">Statement<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></CODE></FONT></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>// some definitions<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>String personURI<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>= "http://somewhere/JohnSmith";<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>String givenName<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>= "John";<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>String familyName<SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>= "Smith";<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>String fullName<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>= givenName + " " + familyName;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>&nbsp;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>// create an empty Model<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>Model model = ModelFactory.createDefaultModel();<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>&nbsp;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>// create the resource<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>//<SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>and add the properties cascading style<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>Resource johnSmith<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>= model.createResource(personURI)<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>.addProperty(VCARD.FN, fullName)<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>.addProperty(VCARD.N,<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>model.createResource()<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>.addProperty(VCARD.Given, givenName)<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>.addProperty(VCARD.Family, familyName));<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>// list the statements in the Model<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>StmtIterator iter = model.listStatements();<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>// print out the predicate, subject and object of each statement<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>while (iter.hasNext()) {<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>Statement stmt<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>= iter.nextStatement();<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>// get next statement<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>Resource<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>subject<SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>= stmt.getSubject();<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>// get the subject<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>Property<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>predicate = stmt.getPredicate();<SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>// get the predicate<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>RDFNode<SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>object<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>= stmt.getObject();<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>// get the object<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>&nbsp;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>System.out.print(subject.toString());<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>System.out.print(" " + predicate.toString() + " ");<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>if (object instanceof Resource) {<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>System.out.print(object.toString());<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>} else {<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>// object is a literal<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>System.out.print(" \"" + object.toString() + "\"");<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>&nbsp;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>System.out.println(" .");<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>}<o:p></o:p></FONT></SPAN></CODE></PRE>
<H2 style="MARGIN: auto 30.6pt"><FONT size=4><SPAN lang=EN-US>2.Writing RDF</SPAN><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-size: 10.5pt"><o:p></o:p></SPAN></FONT></H2><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>// now write the model in XML form to a file<o:p></o:p></FONT></SPAN></CODE></PRE>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><CODE><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Courier">model.write(System.out);<o:p></o:p></SPAN></CODE></P><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="FONT-FAMILY: Courier"><FONT size=2>The output should look something like this:<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>&lt;rdf:RDF<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>xmlns:vcard='http://www.w3.org/2001/vcard-rdf/3.0#'&gt;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;rdf:Description rdf:about='http://somewhere/JohnSmith'&gt;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;vcard:FN&gt;John Smith&lt;/vcard:FN&gt;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;vcard:N rdf:nodeID="A0"/&gt;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;/rdf:Description&gt;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;rdf:Description rdf:nodeID="A0"&gt;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;vcard:Given&gt;John&lt;/vcard:Given&gt;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;vcard:Family&gt;Smith&lt;/vcard:Family&gt;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;/rdf:Description&gt;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>&lt;/rdf:RDF&gt;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><FONT size=2><CODE><SPAN style="COLOR: black; FONT-FAMILY: 黑体; mso-ascii-font-family: Courier">以更紧凑的方法书写</SPAN></CODE><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier">RDF</SPAN></CODE><CODE><SPAN style="COLOR: black; FONT-FAMILY: 黑体; mso-ascii-font-family: Courier">模型，保留空节点，但不适合大型的模型输出</SPAN></CODE><SPAN lang=EN-US style="COLOR: black"><o:p></o:p></SPAN></FONT></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>// now write the model in XML form to a file<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>model.write(System.out, "RDF/XML-ABBREV");<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="FONT-FAMILY: Courier"><FONT size=2>To write large files and preserve blank nodes, write in N-Triples format:<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>// now write the model in XML form to a file<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>model.write(System.out, "N-TRIPLE");<o:p></o:p></FONT></SPAN></CODE></PRE>
<H2 style="MARGIN: auto 30.6pt"><SPAN lang=EN-US><FONT size=4>3.</FONT></SPAN><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; COLOR: black; FONT-FAMILY: Verdana"> Reading RDF<o:p></o:p></SPAN></H2><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="FONT-FAMILY: Courier"><FONT size=2>p<SPAN style="COLOR: black">ackage jena.rdf.example;<o:p></o:p></SPAN></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>&nbsp;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>import com.hp.hpl.jena.rdf.model.*;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>import com.hp.hpl.jena.util.FileManager;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>import java.io.*;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>&nbsp;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>public class Tutorial05{<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt; tab-stops: 3.75pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-tab-count: 1"> </SPAN>static String fileName = D:/../data/camera.owl";<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-tab-count: 1"> </SPAN>public static void main(String[] args){<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt; tab-stops: 45.8pt 70.5pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-tab-count: 1"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN>Model model = ModelFactory.createDefaultModel();<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt; tab-stops: 45.8pt 49.5pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-tab-count: 1"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN>InputStream in = FileManager.get().open(fileName);<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>if(in == null){<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-tab-count: 1"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN>throw new IllegalArgumentException("File "+fileName+" Not Found!!"); <o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>}else{<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-tab-count: 1"> </SPAN>model.read(new InputStreamReader(in),"");<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-tab-count: 1"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN>model.write(System.out,"RDF/XML-ABBREV");<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-tab-count: 1"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN>}<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-tab-count: 1"> </SPAN>}<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>}<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><B><SPAN lang=EN-US style="FONT-SIZE: 12.5pt; FONT-FAMILY: 宋体">4. Controlling Prefixes<o:p></o:p></SPAN></B></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Verdana"><FONT size=2>4.1explicit prefix definitions<o:p></o:p></FONT></SPAN></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>Model m = ModelFactory.createDefaultModel();<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2> String nsA = "http://somewhere/else#";<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2> String nsB = "http://nowhere/else#";<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2> Resource root = m.createResource( nsA + "root" );<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2> Property P = m.createProperty( nsA + "P" );<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2> Property Q = m.createProperty( nsB + "Q" );<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2> Resource x = m.createResource( nsA + "x" );<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2> Resource y = m.createResource( nsA + "y" );<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2> Resource z = m.createResource( nsA + "z" );<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2> m.add( root, P, x ).add( root, P, y ).add( y, Q, z );<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2> System.out.println( "# -- no special prefixes defined" );<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2> m.write( System.out );<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2> System.out.println( "# -- nsA defined" );<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2> m.setNsPrefix( "nsA", nsA );<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2> m.write( System.out );<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2> System.out.println( "# -- nsA and cat defined" );<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2> m.setNsPrefix( "cat", nsB );<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2> m.write( System.out );<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>&nbsp;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2># -- no special prefixes defined<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>&lt;rdf:RDF<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>xmlns:j.0="http://nowhere/else#"<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>xmlns:j.1="http://somewhere/else#" &gt;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;rdf:Description rdf:about="http://somewhere/else#root"&gt;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;j.1:P rdf:resource="http://somewhere/else#x"/&gt;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;j.1:P rdf:resource="http://somewhere/else#y"/&gt;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;/rdf:Description&gt;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;rdf:Description rdf:about="http://somewhere/else#y"&gt;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;j.0:Q rdf:resource="http://somewhere/else#z"/&gt;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;/rdf:Description&gt;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>&lt;/rdf:RDF&gt;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><FONT size=2><CODE><SPAN style="FONT-FAMILY: 黑体; mso-ascii-font-family: Courier">没有引进名称空间，</SPAN></CODE><CODE><SPAN lang=EN-US style="FONT-FAMILY: Courier">Jena</SPAN></CODE><CODE><SPAN style="FONT-FAMILY: 黑体; mso-ascii-font-family: Courier">就用默认的方式对名称空间命名</SPAN></CODE><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier">j.0</SPAN></CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Verdana"> and </SPAN><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier">j.1</SPAN></CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Verdana">.<o:p></o:p></SPAN></FONT></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><FONT size=2><CODE><SPAN style="COLOR: black; FONT-FAMILY: 黑体; mso-ascii-font-family: Courier">可以用方法</SPAN></CODE><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier">setNsPrefix(String prefix, String URI)</SPAN></CODE><CODE><SPAN style="COLOR: black; FONT-FAMILY: 黑体; mso-ascii-font-family: Courier">引进名称空间</SPAN></CODE><CODE><SPAN lang=EN-US style="FONT-FAMILY: Courier"><o:p></o:p></SPAN></CODE></FONT></PRE>
<H3 style="MARGIN: auto 30.6pt auto 0cm"><CODE><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">4.2 implicit prefix definitions</SPAN></CODE><CODE><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 黑体; mso-ascii-font-family: Courier">（？？？？？）</SPAN></CODE><CODE><SPAN lang=EN-US style="FONT-WEIGHT: normal; FONT-SIZE: 10pt; FONT-FAMILY: Courier"><o:p></o:p></SPAN></CODE></H3><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="FONT-FAMILY: Courier"><FONT size=2>As well as prefix declarations provided by calls to setNsPrefix, Jena will remember the prefixes that were used in input to model.read(). <o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="FONT-FAMILY: Courier"><FONT size=2>Take the output produced by the previous fragment, and paste it into some file, with URL file:/tmp/fragment.rdf say. Then run the code: <o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="FONT-FAMILY: Courier"><FONT size=2>&nbsp;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="FONT-FAMILY: Courier"><FONT size=2>Model m2 = ModelFactory.createDefaultModel();<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="FONT-FAMILY: Courier"><FONT size=2>m2.read( "file:/tmp/fragment.rdf" );<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="FONT-FAMILY: Courier"><FONT size=2>m2.write( System.out );<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="FONT-FAMILY: Courier"><FONT size=2>&nbsp;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="FONT-FAMILY: Courier"><FONT size=2>You'll see that the prefixes from the input are preserved in the output. All the prefixes are written, even if they're not used anywhere. You can remove a prefix with removeNsPrefix(String prefix) if you don't want it in the output. <o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="FONT-FAMILY: Courier"><FONT size=2>Since NTriples doesn't have any short way of writing URIs, it takes no notice of prefixes on output and doesn't provide any on input. The notation N3, also supported by Jena, does have short prefixed names, and records them on input and uses them on output. <o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><FONT size=2><CODE><SPAN lang=EN-US style="FONT-FAMILY: Courier">Jena has further operations on the prefix mappings that a model holds, such as extracting a Java <SPAN style="COLOR: black">Map</SPAN> of the exiting mappings, or adding a whole group of mappings at once; see the documentation for <SPAN style="COLOR: black">PrefixMapping</SPAN> for details. </SPAN></CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></FONT></PRE>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><CODE><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Courier">5.</SPAN></CODE><SPAN lang=EN-US style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'"> Jena RDF 包<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'">Jena 是一个为语义网应用设计的一个Java API. 对应用开发者而言, 主要可用的RDF 包是com.hp.hpl.je<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'">na.rdf.model. 因为API 是以接口的方式定义的, 所以应用代码可以使用不同的实现机制而不用改变代码<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'">本身<SPAN lang=EN-US>. 这个包包含了可以表示模型, 资源, 属性, 文本, 陈述和其他RDF 关键概念的接口, 还有一个用来<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'">创建模型的<SPAN lang=EN-US>ModelFactory. 所以如果要应用代码与实现类保持独立, 最好尽可能地使用接口, 而不要使用<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'">特定的实现类<SPAN lang=EN-US>.<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'">com.hp.hpl.jena.impl 这些包包含了许多执行时所常用的执行类. 比如, 它们定义了诸如ResourseImp<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'">l, PropertyImpl 和LiteralImpl 的类, 这些类可以被不同的应用直接使用也可以被继承使用. 应用程序<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'">应该尽可能少地直接使用这些类<SPAN lang=EN-US>. 例如, 与其使用ResouceImpl 来创建一个新的实例, 更好的办法是使用<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'">任何正在使用的模型的<SPAN lang=EN-US>createResource 方法来完成. 那样的话, 如果模型的执行采用了一个优化的Resou<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'">ce 执行, 那么在这两种类型中不需要有任何的转换工作.</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></P><PRE style="MARGIN-RIGHT: 66.6pt"><CODE><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Courier"><FONT size=2>&nbsp;<o:p></o:p></FONT></SPAN></CODE></PRE><PRE style="MARGIN-RIGHT: 66.6pt"><SPAN lang=EN-US><FONT size=2><FONT face="Courier New">&nbsp;<o:p></o:p></FONT></FONT></SPAN></PRE>]]></description>
</item><item>
<title><![CDATA[ISP ：接口隔离原则]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=kitten_ice&amp;id=17449</link>
<author>kitten_ice</author>
<pubDate>2006/8/11 14:48:17</pubDate>
<description><![CDATA[
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 15.75pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口隔离原则（</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">ISP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）讲的是：使用多个专门的接口比使用单个接口要好的多。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">人们所说的接口往往指的是两种不同的东西：一种是</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">JAVA</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中有严格定义的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Interface</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">结构，比如</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">java.lang.Runnable</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">就是一个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">java</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口；另一种就是一个类型所具有的方法特征的集合，也称作“接口”，但这仅是一种逻辑上的抽象。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 15.75pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一个接口相当于剧本中的一个角色，而此角色有哪个演员来扮演相当于接口的实现。因此，一个接口应当简单地代表一个角色，而不是多个角色。如果系统涉及到多个角色的话，那么每一个角色都应该由一个特定的接口代表。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes"><FONT face="Times New Roman">&nbsp; </FONT></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果将接口理解成狭义的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">java </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口，这样一来，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">ISP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">讲的就是为同一个角色提供宽窄不一的接口，以对付不同的客户端。这种办法在服务行业中叫做定制服务。也就是说我们只提供给客户端需要的方法。一个设计师往往想节省接口的数目而讲看上去类似的接口合并，实际上这是一种错误的做法，提供给客户多余的方法，使接口变得臃肿，造成接口污染。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes"><FONT face="Times New Roman">&nbsp;&nbsp; </FONT></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">定制化服务设计原则的好处在于：这样作很整洁；有利于系统的维护，向客户端提供</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">public</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口是一种承诺，我们应尽量减少这种承诺。将接口隔离出来，有利于降低成本。</SPAN></P>]]></description>
</item><item>
<title><![CDATA[DIP:依赖倒转原则]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=kitten_ice&amp;id=17408</link>
<author>kitten_ice</author>
<pubDate>2006/8/10 15:59:28</pubDate>
<description><![CDATA[<A>　
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">传统的过程化设计的设计方法倾向于使高层的模块依赖于低层次的模块，抽象层次依赖于具体层次。倒转原则就是要把这个错误的依赖关系倒转过来，这就是倒转依赖原则的由来。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes"><FONT face="Times New Roman">&nbsp;&nbsp; </FONT></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在面向对象的系统中，两个类之间通常是<B style="mso-bidi-font-weight: normal">三种依赖关系</B>：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 33.75pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 33.75pt"><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore"><FONT face="Times New Roman">1.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">零耦合：两个类之间没有耦合关系</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 33.75pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 33.75pt"><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore"><FONT face="Times New Roman">2.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">具体耦合：具体耦合关系发生在两个具体的类之间，经由一个类引用另一个类造成</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 33.75pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 33.75pt"><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore"><FONT face="Times New Roman">3.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">抽象耦合：抽象耦合发生在一个具体类和一个抽象之间</SPAN><FONT face="Times New Roman"> </FONT><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">或者</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">JAVA</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口之间，使两个必须发生关系的类之间存在最大的灵活性。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 15.75pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">通常我们对</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">DIP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的表述为：抽象不应当依赖于细节；细节应当依赖于抽象。另一种表述为：针对接口编程，不要针对实现编程。也就是说我们应当使用</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">JAVA</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口和抽象</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">JAVA</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类进行变量的类型声明、方法的返回类型说明，以及数据类型的转换等。要保证做到这一点，一个具体的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">JAVA</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类应当只实现</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">JAVA</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口和抽象</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">JAVA</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类中声明过的方法，而不应当给出多余的方法。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 15.75pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes"><FONT face="Times New Roman">&nbsp;&nbsp; </FONT></SPAN></SPAN><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">引用对象的抽象类型</SPAN></B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：在很多情况下，一个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">java</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">程序需要引用一个对象，这个时候，如果这个对象有一个抽象类型的话，应当使用这个抽象类型作为变量的静态类型，这个就是针对接口编程的含义。比如说，蛋代表抽象，鸡代表具体，那么鸡应依赖于蛋，而蛋不应当依赖于鸡，假设蛋使</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">java</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口或者</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">java</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">抽象类，鸡是一个具体类，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">X</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是一个变量，那么声明变量应该是：蛋</SPAN><SPAN lang=EN-US><FONT face="Times New Roman"> X </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">＝</SPAN><SPAN lang=EN-US><FONT face="Times New Roman"> new </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">鸡（），而不应当是</SPAN><FONT face="Times New Roman"> </FONT><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">鸡</SPAN><SPAN lang=EN-US><FONT face="Times New Roman"> X<SPAN style="mso-spacerun: yes">&nbsp; </SPAN></FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">＝</SPAN><SPAN lang=EN-US><FONT face="Times New Roman"> new </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">鸡（）</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 15.75pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">只要一个被引用的对象存在抽象类型，就应当在任何引用此对象的地方使用抽象类型，包括参量的类型声明、方法的返回类型的声明、属性变量的类型声明等。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 15.75pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes"><FONT face="Times New Roman">&nbsp;&nbsp; </FONT></SPAN></SPAN><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">联合使用</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">JAVA</FONT></SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口和</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">JAVA</FONT></SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">抽象类</SPAN></B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：由于抽象类具有提供缺省实现的优点，而接口具有其他的优点，所以联合使用两者是很好的选择。首先，声明类型的工作是由接口承担，但是同时给出的还有一个抽象类，为这个接口提供一个缺省实现。其他同属于这个抽象类型的具体类可以选择实现这个接口，也可以选择继承自这个抽象类。如果需要向接口加入一个方法的话，只要同时向这个抽象类加入这个方法的具体实现就可以了，因为继承自这个抽象类的子类都会从这个抽象类得到这个具体方法。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 15.75pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>DIP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">虽然很强大，但是不容易实现，应为依赖关系倒转的缘故，对象的创建可能会使用对象工厂，以避免对具体类的使用。此外，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">DIP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">假定所有的具体类都是会变化的，这也不总是正确的，如果一个具体类是稳定的、不会发生变化的，那么使用这个具体类的客户端完全可以依赖于这个具体类型。</SPAN></P></A>]]></description>
</item><item>
<title><![CDATA[LSP：里氏代换原则]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=kitten_ice&amp;id=17307</link>
<author>kitten_ice</author>
<pubDate>2006/8/8 10:37:33</pubDate>
<description><![CDATA[
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">LSP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">严格的表达是：如果对每个类型为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">T1</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的对象</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">O1</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，都有类型为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">T2</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的对象</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">O2</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，使得</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">T1</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">定义的所有程序</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">P</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在所有的对象</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">O1</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">替换成</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">O2</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的时候，程序的行为没有发生变化，那么类型</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">T2</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是类型</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">T1</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的子类型。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">也就是说，一个软件实体如果使用的是一个基类的话，那么就一定适用其子类，而且他根本不能察觉出子类跟基类的区别。但是反过来不成里：如果有</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">b</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是基类对象，而</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">d</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是子类对象的话，对于方法</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">method(d)</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">method(b)</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">就不一定成立了。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对于运用</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">LSP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">具体是实例有：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">正方形不是长方形的子类。根据我们的生活常识，可能以为正方形是长方形的子类。但是如果长方形有这样一个方法，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">reSize()</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">Public void resize(Rectangle r)</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">{</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 11.25pt"><SPAN lang=EN-US><FONT face="Times New Roman">Whiel(r.getHeigth &gt;=<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>r.getWidth)</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 11.25pt"><SPAN lang=EN-US><FONT face="Times New Roman">{</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 11.25pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>r.setWidth(r.getWidth+1);</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 11.25pt"><SPAN lang=EN-US><FONT face="Times New Roman">}</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">}</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对于正方形就不适用了，因为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Height</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一改变，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Width</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">也就会改变，知道溢出为止。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">而不变正方形是长方形的子类，因为不变正方形没有</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">setSize </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的方法。看到这里有点疑问，基类有的方法子类并一定有，这样不违反</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">LSP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">吗？</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对于违反</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">LSP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的结构要进行代码重构，如果</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">A</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">继承自</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">B</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，但是违反了</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">LSP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，一般的做法是构造一个抽象类或接口，使之拥有</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">A</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">B</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的公共方法，然后让</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">A</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">B</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">分别继承之。在正方形不是长方形的子类的问题中，我们可以通过定义一个四边形接口，该接口拥有方法</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">getWidth</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">getHeight</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，但不拥有赋值的方法，这样就避免了</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">reSize()</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的方法对于正方形的影响。然后让正方形和长方形继承这个接口。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">JAVA</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在编译的时候会使用</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">LSP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">去检查一个程序是否符合</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">LSP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">原则。</SPAN></P>]]></description>
</item><item>
<title><![CDATA[Inferring and Discovering Relationships using RDF Schemas(2)]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=kitten_ice&amp;id=17302</link>
<author>kitten_ice</author>
<pubDate>2006/8/8 9:12:42</pubDate>
<description><![CDATA[
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><B><SPAN lang=EN-US><FONT face="Times New Roman">NaturallyOccurringWaterSource.rdfs</FONT></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;?xml version="1.0"?&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;rdf:RDF xmlns:rdf="http://www.w3.org/<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /><st1:chsdate IsROCDate="False" IsLunarDate="False" Day="22" Month="2" Year="1999" w:st="on">1999/02/22</st1:chsdate>-rdf-syntax-ns#"</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>xml:base="http://www.geodesy.org/water/naturally-occurring<B>"</B>&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;<B>rdfs:Class</B> rdf:ID="River"&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><B>&lt;rdfs:subClassOf rdf:resource="</B>#Stream<B>"/&gt;<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></B></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;/<B>rdfs:Class</B>&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;<B>rdfs:Class</B> rdf:ID="Stream"&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><B>&lt;rdfs:subClassOf rdf:resource="#</B>NaturallyOccurringWaterSource<B>"/&gt;<o:p></o:p></B></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;/<B>rdfs:Class</B>&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;<B>rdf:Property</B> rdf:ID="emptiesInto"&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><B>&lt;rdfs:domain rdf:resource="</B>#River<B>"/&gt;</B></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><B>&lt;rdfs:range rdf:resource="</B>#BodyOfWater<B>"/&gt;<o:p></o:p></B></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;</SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>&lt;/<B>rdf:Property</B>&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;<B>rdf:Property</B> rdf:ID="length"&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><B>&lt;rdfs:domain rdf:resource="</B>#River<B>"/&gt;</B></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><B>&lt;rdfs:range rdf:resource="http://www.w3.org/2000/01/rdf-schema#Literal"/&gt;<o:p></o:p></B></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;/<B>rdf:Property</B>&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>...</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;/rdf:RDF&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><o:p><FONT face="Times New Roman">&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><o:p><FONT face="Times New Roman">&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文字值</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;</SPAN>&lt;rdf:Property rdf:ID="length"&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;rdfs:domain rdf:resource="#River"/&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;rdfs:range rdf:resource="<B>http://www.w3.org/2000/01/rdf-schema#Literal</B>"/&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;/rdf:Property&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</SPAN><B><SPAN lang=EN-US><FONT face="Times New Roman">NaturallyOccurringWaterSource.rdfs</FONT></SPAN></B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中我们定义了类，类之间的关系，也定义了类的属性，这样实际上我们创建了一个</SPAN><B><SPAN lang=EN-US><FONT face="Times New Roman">NaturallyOccurringWaterSource</FONT></SPAN></B><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的本体</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><B><SPAN lang=EN-US><o:p><FONT face="Times New Roman">&nbsp;</FONT></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如何从属性的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">domain</FONT></SPAN></B><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中推理得出资源所属类</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;?xml version="1.0"?&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;rdf:Description rdf:ID="Yangtze"</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>xmlns:rdf="http://www.w3.org/<st1:chsdate IsROCDate="False" IsLunarDate="False" Day="22" Month="2" Year="1999" w:st="on">1999/02/22</st1:chsdate>-rdf-syntax-ns#"</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>xmlns="http://www.geodesy.org/water/naturally-occurring#"&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;length&gt;6300 kilometers&lt;/length&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;emptiesInto rdf:resource="http://www.china.org/geography#EastChinaSea"/&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;/rdf:Description&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">显然在上面这段</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">XML</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中无法显示的得出</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">"Yangtze"</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的所属类。但根据</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">"Yangtze"</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的属性</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">length</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，以及前面在本体中定义的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">lenth</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">domain</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">River</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，所以可以推断得到</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">"Yangtze"</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的所属类是</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">River.</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">合理地设计</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">RDFS</FONT></SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文档使之便于推理</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;?xml version="1.0"?&gt;<o:p></o:p></FONT></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;River rdf:ID="Yangtze"<o:p></o:p></FONT></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>xmlns:rdf="http://www.w3.org/<st1:chsdate IsROCDate="False" IsLunarDate="False" Day="22" Month="2" Year="1999" w:st="on">1999/02/22</st1:chsdate>-rdf-syntax-ns#"<o:p></o:p></FONT></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>xmlns="http://www.geodesy.org/water/naturally-occurring<SPAN style="mso-bidi-font-weight: bold">#</SPAN>"&gt;<o:p></o:p></FONT></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;length&gt;6300 kilometers&lt;/length&gt;<o:p></o:p></FONT></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-bidi-font-weight: bold">&lt;emptiesInto rdf:resource="http://www.china.org/geography#EastChinaSea"/&gt;</SPAN><o:p></o:p></FONT></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;/River&gt;<o:p></o:p></FONT></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在这个例子中我们可以推理得出</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">emptiesInto </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的值是一种</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">BodyOfWater.</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;?xml version="1.0"?&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;River rdf:ID="Yangtze"</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>xmlns:rdf="http://www.w3.org/<st1:chsdate IsROCDate="False" IsLunarDate="False" Day="22" Month="2" Year="1999" w:st="on">1999/02/22</st1:chsdate>-rdf-syntax-ns#"</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>xmlns="http://www.geodesy.org/water/naturally-occurring<B>#</B>"&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;length&gt;6300 kilometers&lt;/length&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><B>&lt;emptiesInto&gt;<st1:place w:st="on">East China Sea</st1:place>&lt;/emptiesInto&gt;</B></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;/River&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在这里我们就无法得出以上的推论，只知道</SPAN><B><SPAN lang=EN-US><FONT face="Times New Roman">emptiesInto</FONT></SPAN></B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-weight: bold">的值是文字类型。</SPAN></P>]]></description>
</item><item>
<title><![CDATA[Inferring and Discovering Relationships using RDF Schemas(1)]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=kitten_ice&amp;id=17301</link>
<author>kitten_ice</author>
<pubDate>2006/8/8 9:08:18</pubDate>
<description><![CDATA[
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第一部分：</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">RDFS</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">概述</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 10.5pt"><SPAN lang=EN-US><FONT face="Times New Roman">1. RDFS</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的目的是什么？</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 10.5pt"><SPAN lang=EN-US><FONT face="Times New Roman">RDFS</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的目的在于提供一个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">XML</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的词汇表，用于定义类或子类之间的关系以及类和属性之间的关系。这样做的好处在于：提高数据的推理能力和搜索能力。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 10.5pt"><SPAN lang=EN-US><FONT face="Times New Roman">RDFS</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">主要用于创建某个领域的概念分类。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 23.25pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 23.25pt"><FONT face="Times New Roman"><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">2.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN lang=EN-US>RDFS</SPAN></FONT><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">可以提供什么样的推理？</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">举个例子：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">推理可以得出：</SPAN><SPAN lang=EN-US><BR><FONT face="Times New Roman">- Yangtze is a Stream</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">- Yangtze is an NaturallyOcurringWaterSource</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">- http://www.china.org/geography#EastChinaSea is a BodyOfWater</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">3.RDFS</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如何提高搜索数据的能力</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes"><FONT face="Times New Roman">&nbsp; </FONT></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在上例中我们如果这样提问：</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">"Show me all documents that contain info about Streams"</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">我们将得到这样的答案：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: 10.5pt"><SPAN lang=EN-US><FONT face="Times New Roman">- Yangtze is a Stream, so this document is relevant to the query.</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第二部分：</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">RDFS</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的基本语法</SPAN></P>
<OL style="MARGIN-TOP: 0cm" type=1>
<LI class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-list: l1 level1 lfo2; tab-stops: list 36.0pt"><SPAN lang=EN-US><FONT face="Times New Roman">rdfs:class</FONT></SPAN></LI></OL>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;</SPAN>&lt;<B>rdfs:Class</B> rdf:ID="River"&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><B>&lt;rdfs:subClassOf rdf:resource="</B>#Stream<B>"/&gt;<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></B></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;/<B>rdfs:Class</B>&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">用于定义一个类，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">rdf:ID</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">用于定义一个类的名字</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">下面这两种定义类的方法是相等的：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;rdfs:<B>Class</B> rdf:ID="River"&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;rdfs:subClassOf rdf:resource="#Stream"/&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;/rdfs:Class&gt;</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;rdf:Description rdf:ID="River"&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;</SPAN>&lt;rdf:<B>type</B> rdf:resource="http://www.w3.org/2000/01/rdf-schema#<B>Class</B>"/&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;rdfs:subClassOf rdf:resource="#Stream"/&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;/rdf:Description&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">2. rdfs:subClassOf</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">可以有零个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">/</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">/</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">多个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">rdfs:subClassOf</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">属性</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">零个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">rdfs:subClassOf</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">属性隐式地说明了这个类是</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">rdf:Resource</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的子类</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">rdfs:subClassOf</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">属性说明了这个类是另外一个类的子类</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">多个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">rdfs:subClassOf</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">属性说明了这个类是多个类的子类，既是多个类的交集。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">比如：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;rdfs:Class rdf:ID="River"&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><B>&lt;rdfs:subClassOf rdf:resource="#Stream"/&gt;<o:p></o:p></B></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><B><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;rdfs:subClassOf rdf:resource="http://www.containers.org#SedimentContainer"/&gt;</FONT></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;/rdfs:Class&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">另外</SPAN><B><SPAN lang=EN-US><FONT face="Times New Roman">rdfs:subClassOf</FONT></SPAN></B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-weight: bold">具有传递依赖</SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US style="mso-bidi-font-weight: bold"><FONT face="Times New Roman">3.<B> rdf:Property</B><o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;?xml version="1.0"?&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;rdf:RDF xmlns:rdf="http://www.w3.org/<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /><st1:chsdate w:st="on" Year="1999" Month="2" Day="22" IsLunarDate="False" IsROCDate="False">1999/02/22</st1:chsdate>-rdf-syntax-ns#"</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>xml:base="http://www.geodesy.org/water/naturally-occurring<B>"</B>&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;</SPAN>&lt;<B>rdf:Property</B> rdf:ID="emptiesInto"&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><B>&lt;rdfs:domain rdf:resource="</B>#River<B>"/&gt;</B></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><B>&lt;rdfs:range rdf:resource="</B>#BodyOfWater<B>"/&gt;<o:p></o:p></B></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;/<B>rdf:Property</B>&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>...</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;/rdf:RDF&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">注意</SPAN><B><SPAN lang=EN-US><FONT face="Times New Roman">rdfs:domain</FONT></SPAN></B><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">rdfs:range</FONT></SPAN></B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-weight: bold">的用法：</SPAN><B><SPAN lang=EN-US><FONT face="Times New Roman">rdfs:domain</FONT></SPAN></B><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是值域，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">rdfs:range</FONT></SPAN></B><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是作用域</SPAN></B><SPAN lang=EN-US style="mso-bidi-font-weight: bold"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-weight: bold">以下两种表达方法是相等的</SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;rdf:<B>Property</B> rdf:ID="emptiesInto"&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;rdfs:domain rdf:resource="#River"/&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;rdfs:range rdf:resource="#BodyOfWater"/&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;/rdf:Property&gt;</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;rdf:Description rdf:ID="emptiesInto"&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;rdf:<B>type</B> rdf:resource="http://www.w3.org/<st1:chsdate w:st="on" Year="1999" Month="2" Day="22" IsLunarDate="False" IsROCDate="False">1999/02/22</st1:chsdate>-rdf-syntax-ns#<B>Property</B>"/&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;rdfs:domain rdf:resource="#River"/&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;rdfs:range rdf:resource="#BodyOfWater"/&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;/rdf:Description&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">有一点要注意的是：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">Class</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">NS</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">RDF</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，而</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Property</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">NS</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">RDFS</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><FONT face="Times New Roman"><SPAN lang=EN-US>4.</SPAN><SPAN lang=EN-US style="FONT-SIZE: 44pt; COLOR: black; mso-font-kerning: 0pt"> </SPAN><SPAN lang=EN-US>rdfs:range</SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">表示这个属性可能包含的类型的值。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">跟</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">subclassof</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类似，可以包括零个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">/</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">/</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">多个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">rdfs:range</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">属性</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">零个：如果一个属性没有定以</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">rdfs:range</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">说明这个属性的值的类型未确定。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一个：说明这个属性的值的类型唯一</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">多个：说明这个属性的值的类型有多种。比如：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;rdf:Property rdf:ID="emptiesInto"&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;rdfs:domain rdf:resource="#River"/&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><B>&lt;rdfs:range rdf:resource="#BodyOfWater"/&gt;<o:p></o:p></B></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><B><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;rdfs:range rdf:resource="http://www.geodesy.org/coast#CoastalWater"/&gt;<o:p></o:p></FONT></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;/rdf:Property&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><FONT face="Times New Roman"><SPAN lang=EN-US>5.</SPAN><SPAN lang=EN-US style="FONT-SIZE: 44pt; COLOR: black; mso-font-kerning: 0pt"> </SPAN><SPAN lang=EN-US>rdfs:domain</SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">表示可能使用这个属性的类。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">跟</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">rdfs:range</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类似，不再重复</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;rdf:Property rdf:ID="emptiesInto"&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><B>&lt;rdfs:domain rdf:resource="#River"/&gt;<o:p></o:p></B></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><B><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;rdfs:domain rdf:resource="http://www.containers.org#Vessel"/&gt;</FONT></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;rdfs:range rdf:resource="#BodyOfWater"/&gt;<B><o:p></o:p></B></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;/rdf:Property&gt;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><o:p><FONT face="Times New Roman">&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在这里我们要注意，类和属性是分别定义的，而不是象在</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">OO</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">里面那样，定义了类的同时就定义了属性。也就是说在</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">RDFS</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">里面，我们定义了类，然后定义属性，并将属性与类关联起来。这样做的好处是，任何人任何时刻都可以定义类的属性。</SPAN></P>]]></description>
</item><item>
<title><![CDATA[一个关于RDF的简单问题(关于rdf:ID,rdf:about,rdf:resource的用法)]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=kitten_ice&amp;id=17158</link>
<author>kitten_ice</author>
<pubDate>2006/8/3 16:06:31</pubDate>
<description><![CDATA[
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">用<SPAN lang=EN-US>Protege</SPAN>建立一个本体，关于<SPAN lang=EN-US>Pizza</SPAN>的，有三个类，包括<SPAN lang=EN-US>Pizza,&nbsp;PiazzaBase</SPAN>和<SPAN lang=EN-US>PizzaTopping</SPAN>，他们互相<SPAN lang=EN-US>Disjointwith</SPAN>，我原以为这三个类既然是在层次上对等的，那代码也应该差不多。但是当我查看源代码时发现自动生成的代码中，这三个类是不一样的，主要是有些用的是<SPAN lang=EN-US>rdf:ID</SPAN>，有些用的是<SPAN lang=EN-US>rdf:about</SPAN>，还有用<SPAN lang=EN-US>rdf:resource</SPAN>的，如下： <SPAN lang=EN-US><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&lt;?xml&nbsp;version="1.0"?&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&lt;rdf:RDF<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;xmlns:owl="<A href="http://www.w3.org/2002/07/owl" target=_blank><SPAN style="COLOR: #4455aa; mso-bidi-font-size: 12.0pt">http://www.w3.org/2002/07/owl</SPAN></A>#"<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;xmlns="<A href="http://www.owl-ontologies.com/unnamed.owl" target=_blank><SPAN style="COLOR: #4455aa; mso-bidi-font-size: 12.0pt">http://www.owl-ontologies.com/unnamed.owl</SPAN></A>#"<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;xmlns:rdfs="<A href="http://www.w3.org/2000/01/rdf-schema" target=_blank><SPAN style="COLOR: #4455aa; mso-bidi-font-size: 12.0pt">http://www.w3.org/2000/01/rdf-schema</SPAN></A>#"<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;xmlns:rdf="<A href="http://www.w3.org/1999/02/22-rdf-syntax-ns" target=_blank><SPAN style="COLOR: #4455aa; mso-bidi-font-size: 12.0pt">http://www.w3.org/1999/02/22-rdf-syntax-ns</SPAN></A>#"<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;xml:base="<A href="http://www.owl-ontologies.com/unnamed.owl%22%3e" target=_blank><SPAN style="COLOR: #4455aa; mso-bidi-font-size: 12.0pt">http://www.owl-ontologies.com/unnamed.owl"&gt;</SPAN></A><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&lt;owl:Ontology&nbsp;rdf:about=""/&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&lt;owl:Class&nbsp;rdf:ID="PizzaBase"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;owl:disjointWith&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;owl:Class&nbsp;rdf:ID="Pizza"/&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;/owl:disjointWith&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;owl:disjointWith&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;owl:Class&nbsp;rdf:ID="PizzaTopping"/&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;/owl:disjointWith&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&lt;/owl:Class&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&lt;owl:Class&nbsp;rdf:about="#Pizza"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;owl:disjointWith&nbsp;rdf:resource="#PizzaBase"/&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;owl:disjointWith&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;owl:Class&nbsp;rdf:about="#PizzaTopping"/&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;/owl:disjointWith&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&lt;/owl:Class&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&lt;owl:Class&nbsp;rdf:about="#PizzaTopping"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;owl:disjointWith&nbsp;rdf:resource="#PizzaBase"/&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;owl:disjointWith&nbsp;rdf:resource="#Pizza"/&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&lt;/owl:Class&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&lt;/rdf:RDF&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">同样的结构，为什么有些要用<SPAN lang=EN-US>rdf:resource</SPAN>有些又用<SPAN lang=EN-US>rdf:about</SPAN>，还有些用<SPAN lang=EN-US>rdf:ID</SPAN>？这几个有什么区别呢？<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">一些网友的观点：<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">1.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">1</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">）<SPAN lang=EN-US>rdf:ID</SPAN>和<SPAN lang=EN-US>rdf:about</SPAN>的区别：<SPAN lang=EN-US>&nbsp;<BR>rdf:about</SPAN>的值是一个完整<SPAN lang=EN-US>URIref</SPAN>，注意也可以是相对<SPAN lang=EN-US>URI</SPAN>，（相对于<SPAN lang=EN-US>xml:base</SPAN>）<SPAN lang=EN-US>;<BR>rdf:ID</SPAN>是对<SPAN lang=EN-US>rdf:about</SPAN>的值的缩写，其值是一个“<SPAN lang=EN-US>&nbsp;XML&nbsp;Name</SPAN>”，所以，不能是数字开头，不能有“<SPAN lang=EN-US>/</SPAN>”符号等。 <SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">例如：<SPAN lang=EN-US>rdf:ID="PizzaBase"&nbsp;</SPAN>等价于<SPAN lang=EN-US>rdf:about="(xml:base)+</SPAN>‘<SPAN lang=EN-US>#</SPAN>’<SPAN lang=EN-US>+</SPAN>‘<SPAN lang=EN-US>PizzaBase</SPAN>’<SPAN lang=EN-US>&nbsp;"<BR></SPAN>这个<SPAN lang=EN-US>xml:base</SPAN>的值可以在<SPAN lang=EN-US>XML</SPAN>文件头声明，如你例子中的，<SPAN lang=EN-US>xml:base="<A href="http://www.owl-ontologies.com/unnamed.owl%22" target=_blank><SPAN style="COLOR: #4455aa; mso-bidi-font-size: 12.0pt">http://www.owl-ontologies.com/unnamed.owl"</SPAN></A></SPAN>，<SPAN lang=EN-US>&nbsp;</SPAN>如果没有声明，则其值是<SPAN lang=EN-US>RDF</SPAN>文件所放在的位置<SPAN lang=EN-US>uri</SPAN>。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">2)rdf:resource&nbsp;</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">和<SPAN lang=EN-US>rdf:about<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&lt;owl:disjointWith&nbsp;rdf:resource="#PizzaBase"/&gt;&nbsp;</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">是<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&lt;owl:disjointWith&nbsp;&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;rdf:Description&nbsp;rdf:about="#PizzaBase"&nbsp;/&gt;<BR>&lt;/owl:disjointWith&nbsp;&gt;<BR></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">的缩写。这里必须没有对资源<SPAN lang=EN-US>="#PizzaBase"&nbsp;</SPAN>做进一步的说明。所以，<SPAN lang=EN-US>rdf:resource</SPAN>只能出现在表示属性的节点中，如这里的<SPAN lang=EN-US>owl:disjointWith</SPAN>节点。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">而<SPAN lang=EN-US>&nbsp;&nbsp;&lt;owl:disjointWith&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;owl:Class&nbsp;rdf:about="#PizzaTopping"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/owl:disjointWith&gt;<BR></SPAN>是等价于：<SPAN lang=EN-US><BR>&lt;owl:disjointWith&nbsp;&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;rdf:Description&nbsp;rdf:about="#PizzaTopping"&nbsp;&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rdf:type&nbsp;rdf:resource="&amp;rdfs;Class"&nbsp;/&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;/rdf:Description&gt;<BR>&lt;/owl:disjointWith&nbsp;&gt;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">这里不能用<SPAN lang=EN-US>rdf:resource</SPAN>了，因为声明了<SPAN lang=EN-US>#PizzaTopping</SPAN>是一个类。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">所以，我们可以看出：<SPAN lang=EN-US><BR></SPAN>说明了：<SPAN lang=EN-US>&nbsp;&nbsp;&lt;owl:Class&nbsp;rdf:ID="PizzaBase"&gt;<BR></SPAN>以后，后面的都是用：<SPAN lang=EN-US><BR>&nbsp;&lt;owl:disjointWith&nbsp;rdf:resource="#PizzaBase"/&gt;<BR></SPAN>了。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">2.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">其实我们可以把<SPAN lang=EN-US>rdf:ID</SPAN>看作和<SPAN lang=EN-US>rdf:about</SPAN>一样的东西，<SPAN lang=EN-US>rdf:ID</SPAN>只是一个缩写而已。所以<SPAN lang=EN-US><BR>&nbsp;&nbsp;&lt;owl:Class&nbsp;rdf:ID="PizzaBase"&gt;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;owl:disjointWith&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;owl:Class&nbsp;rdf:ID="Pizza"/&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;/owl:disjointWith&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;owl:disjointWith&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;owl:Class&nbsp;rdf:ID="PizzaTopping"/&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;/owl:disjointWith&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&lt;/owl:Class&gt;<BR></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">中，把所有的<SPAN lang=EN-US>rdf:ID="xxx"</SPAN>替换成<SPAN lang=EN-US>rdf:about="#xxx"</SPAN>也是可以的，这是我的第一个理解。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">第二，为什么这里不能用<SPAN lang=EN-US>rdf:resource</SPAN>呢，是因为到目前为止，<SPAN lang=EN-US>Pizza</SPAN>类和<SPAN lang=EN-US>PizzaTopping</SPAN>类还没有被定义，需要在这里申明它是一个类。如果<SPAN lang=EN-US>Pizza</SPAN>类在之前就已经定义了，那么这里也可以用<SPAN lang=EN-US>rdf:resource</SPAN>来简写。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">3.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">再补充一个<SPAN lang=EN-US>rdf:ID</SPAN>和<SPAN lang=EN-US>rdf:about</SPAN>的区别： <SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">rdf:ID</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">是用来定义一个资源，或者说引入一个新的资源名称；<SPAN lang=EN-US><BR>rdf:about</SPAN>除了也可用来定义资源外，还可用来扩展对这个资源的定义<SPAN lang=EN-US>(</SPAN>这可以出现在其他本体文件中<SPAN lang=EN-US>)</SPAN>。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">如果<SPAN lang=EN-US>Pizza</SPAN>是用<SPAN lang=EN-US>rdf:ID</SPAN>定义的，那么要增加对<SPAN lang=EN-US>Pizza</SPAN>的描述，就必须用<SPAN lang=EN-US>rdf:about</SPAN>。因为同一个<SPAN lang=EN-US>RDF</SPAN>文档中，不能出现两个<SPAN lang=EN-US>rdf:ID="Pizza"</SPAN>，否则<SPAN lang=EN-US>RDF&nbsp;Parser</SPAN>就会报错。参见： <SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">{{//RDF&nbsp;Primer.&nbsp;Section&nbsp;3.2&nbsp;</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">的第<SPAN lang=EN-US>4</SPAN>段中间<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;However,&nbsp;using&nbsp;rdf:ID&nbsp;provides&nbsp;an&nbsp;additional&nbsp;check&nbsp;when&nbsp;assigning&nbsp;a&nbsp;set&nbsp;of&nbsp;distinct&nbsp;names,&nbsp;since&nbsp;a&nbsp;given&nbsp;value&nbsp;of&nbsp;the&nbsp;rdf:ID&nbsp;attribute&nbsp;can&nbsp;only&nbsp;appear&nbsp;once&nbsp;relative&nbsp;to&nbsp;the&nbsp;same&nbsp;base&nbsp;URI&nbsp;(the&nbsp;catalog&nbsp;document,&nbsp;in&nbsp;this&nbsp;example).<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">4.<SPAN style="COLOR: #9900ff">Have&nbsp;you&nbsp;looked&nbsp;at&nbsp;the&nbsp;RDF&nbsp;Primer&nbsp;(and&nbsp;specifically,&nbsp;Example&nbsp;4&nbsp;in<BR>Section&nbsp;3.1&nbsp;and&nbsp;its&nbsp;explanation,&nbsp;which&nbsp;is&nbsp;where&nbsp;this&nbsp;is&nbsp;discussed)?<BR>Basically,&nbsp;rdf:about&nbsp;is&nbsp;for&nbsp;expressing&nbsp;the&nbsp;*subject*&nbsp;of&nbsp;an&nbsp;RDF&nbsp;statement<BR>in&nbsp;RDF/XML.&nbsp;&nbsp;rdf:resource&nbsp;is&nbsp;for&nbsp;expressing&nbsp;the&nbsp;*object*&nbsp;of&nbsp;an&nbsp;RDF<BR>statement&nbsp;in&nbsp;RDF/XML,&nbsp;when&nbsp;the&nbsp;object&nbsp;is&nbsp;another&nbsp;resource&nbsp;rather&nbsp;than&nbsp;a<BR>literal&nbsp;value.&nbsp;&nbsp;Does&nbsp;that&nbsp;help?&nbsp;&nbsp;If&nbsp;you&nbsp;have&nbsp;some&nbsp;particular&nbsp;example&nbsp;in<BR>mind&nbsp;that&nbsp;you&nbsp;are&nbsp;trying&nbsp;to&nbsp;express,&nbsp;could&nbsp;you&nbsp;provide&nbsp;it?</SPAN><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">--Frank<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">按照<SPAN lang=EN-US>Frank</SPAN>的说法，<SPAN lang=EN-US>rdf:about</SPAN>用来表示<SPAN lang=EN-US>statement</SPAN>的主体，<SPAN lang=EN-US>rdf:resource</SPAN>在<SPAN lang=EN-US>statement</SPAN>的客体是一个资源而不是文字值时用来表示客体</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">5.在RDF&nbsp;primer的第三章有解释：<A class=contentlink href="http://www.w3.org/TR/rdf-primer/" target=_blank><FONT color=#4455aa>http://www.w3.org/TR/rdf-primer/</FONT></A><BR>其中的对rdf:ID的解释：<BR>An&nbsp;important&nbsp;difference&nbsp;from&nbsp;previous&nbsp;examples&nbsp;is&nbsp;that,&nbsp;in&nbsp;line&nbsp;5,&nbsp;the&nbsp;rdf:Description&nbsp;element&nbsp;has&nbsp;an&nbsp;rdf:ID&nbsp;attribute&nbsp;instead&nbsp;of&nbsp;an&nbsp;rdf:about&nbsp;attribute.&nbsp;Using&nbsp;rdf:ID&nbsp;specifies&nbsp;a&nbsp;fragment&nbsp;identifier,&nbsp;given&nbsp;by&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;rdf:ID&nbsp;attribute&nbsp;(item10245&nbsp;in&nbsp;this&nbsp;case,&nbsp;which&nbsp;might&nbsp;be&nbsp;the&nbsp;catalog&nbsp;number&nbsp;assigned&nbsp;by&nbsp;example.com),&nbsp;as&nbsp;an&nbsp;abbreviation&nbsp;of&nbsp;the&nbsp;complete&nbsp;URIref&nbsp;of&nbsp;the&nbsp;resource&nbsp;being&nbsp;described.&nbsp;The&nbsp;fragment&nbsp;identifier&nbsp;item10245&nbsp;will&nbsp;be&nbsp;interpreted&nbsp;relative&nbsp;to&nbsp;a&nbsp;base&nbsp;URI,&nbsp;in&nbsp;this&nbsp;case,&nbsp;the&nbsp;URI&nbsp;of&nbsp;the&nbsp;containing&nbsp;catalog&nbsp;document.&nbsp;The&nbsp;full&nbsp;URIref&nbsp;for&nbsp;the&nbsp;tent&nbsp;is&nbsp;formed&nbsp;by&nbsp;taking&nbsp;the&nbsp;base&nbsp;URI&nbsp;(of&nbsp;the&nbsp;catalog),&nbsp;and&nbsp;appending&nbsp;the&nbsp;character&nbsp;"#"&nbsp;(to&nbsp;indicate&nbsp;that&nbsp;what&nbsp;follows&nbsp;is&nbsp;a&nbsp;fragment&nbsp;identifier)&nbsp;and&nbsp;then&nbsp;item10245&nbsp;to&nbsp;it,&nbsp;giving&nbsp;the&nbsp;absolute&nbsp;URIref&nbsp;<A class=contentlink href="http://www.example.com/2002/04/products" target=_blank><FONT color=#4455aa>http://www.example.com/2002/04/products</FONT></A>#item10245. </P>
<DIV>
<P></P>
<P>The&nbsp;rdf:ID&nbsp;attribute&nbsp;is&nbsp;somewhat&nbsp;similar&nbsp;to&nbsp;the&nbsp;ID&nbsp;attribute&nbsp;in&nbsp;XML&nbsp;and&nbsp;HTML,&nbsp;in&nbsp;that&nbsp;it&nbsp;defines&nbsp;a&nbsp;name&nbsp;which&nbsp;must&nbsp;be&nbsp;unique&nbsp;relative&nbsp;to&nbsp;the&nbsp;current&nbsp;base&nbsp;URI&nbsp;(in&nbsp;this&nbsp;example,&nbsp;that&nbsp;of&nbsp;the&nbsp;catalog).&nbsp;In&nbsp;this&nbsp;case,&nbsp;the&nbsp;rdf:ID&nbsp;attribute&nbsp;appears&nbsp;to&nbsp;be&nbsp;assigning&nbsp;a&nbsp;name&nbsp;(item10245)&nbsp;to&nbsp;this&nbsp;particular&nbsp;kind&nbsp;of&nbsp;tent.&nbsp;Any&nbsp;other&nbsp;RDF/XML&nbsp;within&nbsp;this&nbsp;catalog&nbsp;could&nbsp;refer&nbsp;to&nbsp;the&nbsp;tent&nbsp;by&nbsp;using&nbsp;either&nbsp;the&nbsp;absolute&nbsp;URIref&nbsp;<A class=contentlink href="http://www.example.com/2002/04/products" target=_blank><FONT color=#4455aa>http://www.example.com/2002/04/products</FONT></A>#item10245,&nbsp;or&nbsp;the&nbsp;relative&nbsp;URIref&nbsp;#item10245.&nbsp;The&nbsp;relative&nbsp;URIref&nbsp;would&nbsp;be&nbsp;understood&nbsp;as&nbsp;being&nbsp;a&nbsp;URIref&nbsp;defined&nbsp;relative&nbsp;to&nbsp;the&nbsp;base&nbsp;URIref&nbsp;of&nbsp;the&nbsp;catalog.&nbsp;Using&nbsp;a&nbsp;similar&nbsp;abbreviation,&nbsp;the&nbsp;URIref&nbsp;of&nbsp;the&nbsp;tent&nbsp;could&nbsp;also&nbsp;be&nbsp;given&nbsp;by&nbsp;specifying&nbsp;rdf:about="#item10245"&nbsp;in&nbsp;the&nbsp;catalog&nbsp;entry&nbsp;(i.e.,&nbsp;by&nbsp;specifying&nbsp;the&nbsp;relative&nbsp;URIref&nbsp;directly)&nbsp;instead&nbsp;of&nbsp;rdf:ID="item10245"&nbsp;.&nbsp;As&nbsp;an&nbsp;abbreviation&nbsp;mechanism,&nbsp;the&nbsp;two&nbsp;forms&nbsp;are&nbsp;essentially&nbsp;synonyms:&nbsp;the&nbsp;full&nbsp;URIref&nbsp;formed&nbsp;by&nbsp;RDF/XML&nbsp;is&nbsp;the&nbsp;same&nbsp;in&nbsp;either&nbsp;case:&nbsp;<A class=contentlink href="http://www.example.com/2002/04/products" target=_blank><FONT color=#4455aa>http://www.example.com/2002/04/products</FONT></A>#item10245.&nbsp;However,&nbsp;using&nbsp;rdf:ID&nbsp;provides&nbsp;an&nbsp;additional&nbsp;check&nbsp;when&nbsp;assigning&nbsp;a&nbsp;set&nbsp;of&nbsp;distinct&nbsp;names,&nbsp;since&nbsp;a&nbsp;given&nbsp;value&nbsp;of&nbsp;the&nbsp;rdf:ID&nbsp;attribute&nbsp;can&nbsp;only&nbsp;appear&nbsp;once&nbsp;relative&nbsp;to&nbsp;the&nbsp;same&nbsp;base&nbsp;URI&nbsp;(the&nbsp;catalog&nbsp;document,&nbsp;in&nbsp;this&nbsp;example).&nbsp;Using&nbsp;either&nbsp;form,&nbsp;example.com&nbsp;would&nbsp;be&nbsp;giving&nbsp;the&nbsp;URIref&nbsp;for&nbsp;the&nbsp;tent&nbsp;in&nbsp;a&nbsp;two-stage&nbsp;process,&nbsp;first&nbsp;assigning&nbsp;the&nbsp;URIref&nbsp;for&nbsp;the&nbsp;whole&nbsp;catalog,&nbsp;and&nbsp;then&nbsp;using&nbsp;a&nbsp;relative&nbsp;URIref&nbsp;in&nbsp;the&nbsp;description&nbsp;of&nbsp;the&nbsp;tent&nbsp;in&nbsp;the&nbsp;catalog&nbsp;to&nbsp;indicate&nbsp;the&nbsp;URIref&nbsp;that&nbsp;has&nbsp;been&nbsp;assigned&nbsp;to&nbsp;this&nbsp;particular&nbsp;kind&nbsp;of&nbsp;tent.&nbsp;Moreover,&nbsp;this&nbsp;use&nbsp;of&nbsp;a&nbsp;relative&nbsp;URIref&nbsp;can&nbsp;be&nbsp;thought&nbsp;of&nbsp;either&nbsp;as&nbsp;being&nbsp;an&nbsp;abbreviation&nbsp;for&nbsp;a&nbsp;full&nbsp;URIref&nbsp;that&nbsp;has&nbsp;been&nbsp;assigned&nbsp;to&nbsp;the&nbsp;tent&nbsp;independently&nbsp;of&nbsp;the&nbsp;RDF,&nbsp;or&nbsp;as&nbsp;being&nbsp;the&nbsp;assignment&nbsp;of&nbsp;the&nbsp;URIref&nbsp;to&nbsp;the&nbsp;tent&nbsp;within&nbsp;the&nbsp;catalog.<BR></P></DIV></SPAN>]]></description>
</item><item>
<title><![CDATA[Java设计模式之抽象类]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=kitten_ice&amp;id=17156</link>
<author>kitten_ice</author>
<pubDate>2006/8/3 15:05:59</pubDate>
<description><![CDATA[<P>1.什么是抽象类</P>
<P>抽象类提供一个类型的部分实现，可以有实例变量，构造方法，抽象方法和具体方法。一个抽象类不会有实例。抽象类跟具体类是蛋跟鸡的关系：蛋决定了鸡的性状，鸡是蛋的具体实现。</P>
<P>2.抽象类的用途</P>
<P>抽象类通常代表一个抽象概念，可以用一句话来概括抽象类的用途：抽象类是用来继承的。反过来可以说具体类不是用来继承的，只要有可能，我们不要从具体类继承。</P>
<P>3.抽象类设计使用的原则</P>
<P>在设计抽象类时我们应注意这几条原则：</P>
<P>1）抽象类应尽可能多地拥有具体类公共的代码，这样做可以提高代码的重用性。我们应针对抽象编程，也就是说我们应该把注意力放在“蛋”上。</P>
<P>2）抽象类应尽可能少地拥有数据，数据应尽量放在具体类中。</P>
<P>4.什么时候才应该使用继承复用</P>
<P>继承代表“一般化/特殊化”关系，其中基类代表一般，而衍生类代表特殊，衍生类将基类特殊化或扩展化。只有当以下的Code条件满足时才应当使用继承关系</P>
<P>1）子类是超类的一个特殊种类，而不是超类的一个角色，也就是应当区别IS－A和Has-A。</P>
<P>2）永远不会出现需要将子类换成另一个类的子类的情况，如果不能肯定一个类在将来会不会成为另一个类的子类，就不要把这个类设计成当前超类的子类</P>
<P>3）子类的责任是扩展超类，而不是Override和Nullify超类。如果子类需要大量地置换超类的行为，就说明子类跟超类的行为差别很大，不存在继承关系。</P>
<P>4）只有在分类学上角度看有意义时，才可以使用继承，不要从工具类继承。举个例子：包装商业规则的类不要去继承数据库管理的类，这样也许会让你很方便地让子类具有数据处理的方法，可是这滥用了继承关系</P>
<P>&nbsp;</P>]]></description>
</item>
</channel>
</rss>