RDF Quick Start...login
RDF Quick Start Tutorial
author:php.cn  update time:2022-04-11 14:47:18

RDF container



RDF container is used to describe a set of things. For example, list the authors of a certain book together.

The following RDF elements are used to describe these groups: <Bag>, <Seq>, and <Alt>.


h2><rdf:Bag> Element

<rdf:Bag> The element is used to describe a list of values ​​specified as unordered. The

<rdf:Bag> element can contain repeated values.

Example

<?xml version="1.0"?>

<rdf:RDF
xmlns:rdf="http:/ /www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cd="http://www.recshop.fake/cd#">

< ;rdf:Description
rdf:about="http://www.recshop.fake/cd/Beatles">
<cd:artist>
<rdf:Bag>
<rdf:li>John</rdf:li>
<rdf:li>Paul</rdf:li>
<rdf:li>George</rdf:li>
<rdf:li>Ringo</rdf:li>
</rdf:Bag>
</cd:artist>
</rdf:Description>

</rdf:RDF>


##<rdf:Seq> ; Element

<rdf:Seq> The element is used to describe a list of values ​​that is specified as ordered (such as an alphabetical sort). The

<rdf:Bag> element can contain repeated values.

Example

<?xml version="1.0"?>

<rdf:RDF
xmlns:rdf="http:/ /www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cd="http://www.recshop.fake/cd#">

< ;rdf:Description
rdf:about="http://www.recshop.fake/cd/Beatles">
<cd:artist>
<rdf:Seq>
<rdf:li>George</rdf:li>
<rdf:li>John</rdf:li>
<rdf:li>Paul</rdf:li>
<rdf:li>Ringo</rdf:li>
</rdf:Seq>
</cd:artist>
</rdf:Description>

</rdf:RDF>
The

<rdf:Alt> element

<rdf:Alt> element is used for a list of replaceable values ​​(the user can select only one of these values) .

Example

<?xml version="1.0"?>

<rdf:RDF
xmlns:rdf="http:/ /www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cd="http://www.recshop.fake/cd#">

< ;rdf:Descriptio
rdf:about="http://www.recshop.fake/cd/Beatles">
<cd:format>
<rdf:Alt>
<rdf:li>CD</rdf:li>
<rdf:li>Record</rdf:li>
<rdf:li>Tape</rdf:li>
</rdf:Alt>
</cd:format>
</rdf:Descriptio>

</rdf:RDF>


#RDF Terminology

In the above example, we have discussed "list of values" when describing the container element. In RDF, these "lists of values" are called members.

Therefore, we can say:

  • A container is a resource that contains things

  • The contained things are Called a member (not a "list of values").