XML RDF
RDF 문서 예
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:si="https://www.w3schools.com/rdf/">
<rdf:Description rdf:about="https://www.w3schools.com">
<si:title>W3Schools</si:title>
<si:author>Jan Egil Refsnes</si:author>
</rdf:Description>
</rdf:RDF>
RDF 란 무엇입니까?
- RDF는 자원 설명 프레임 워크 를 나타 냅니다 .
- RDF는 웹상의 리소스를 설명하기 위한 프레임워크입니다.
- RDF는 컴퓨터가 읽고 이해할 수 있도록 설계되었습니다.
- RDF는 사람들에게 표시되도록 설계되지 않았습니다.
- RDF는 XML로 작성됩니다.
- RDF는 W3C의 시맨틱 웹 활동의 일부입니다.
- RDF는 2004년 2월 10일의 W3C 권장 사항입니다.
RDF - 사용 예
- 가격 및 가용성과 같은 쇼핑 항목의 속성 설명
- 웹 이벤트 시간 일정 설명
- 웹 페이지에 대한 설명(콘텐츠, 작성자, 생성 및 수정 날짜)
- 웹 사진에 대한 콘텐츠 및 등급 설명
- 검색 엔진용 콘텐츠 설명
- 전자 라이브러리 설명
RDF는 컴퓨터에서 읽을 수 있도록 설계되었습니다.
RDF는 정보를 설명하는 일반적인 방법을 제공하여 컴퓨터 응용 프로그램에서 읽고 이해할 수 있도록 설계되었습니다.
RDF 설명은 웹에 표시되도록 설계되지 않았습니다.
RDF는 XML로 작성
RDF 문서는 XML로 작성됩니다. RDF에서 사용하는 XML 언어를 RDF/XML이라고 합니다.
XML을 사용하면 다른 유형의 운영 체제 및 응용 프로그램 언어를 사용하는 다른 유형의 컴퓨터 간에 RDF 정보를 쉽게 교환할 수 있습니다.
RDF와 "시맨틱 웹"
RDF 언어는 W3C의 시맨틱 웹 활동의 일부입니다. W3C의 "Semantic Web Vision"은 다음과 같은 미래입니다.
- 웹 정보에는 정확한 의미가 있습니다.
- 웹 정보는 컴퓨터에 의해 이해되고 처리될 수 있습니다.
- 컴퓨터는 웹에서 정보를 통합할 수 있습니다.
RDF는 웹 식별자(URI)를 사용하여 리소스를 식별합니다.
RDF는 속성 및 속성 값으로 리소스를 설명합니다.
RDF 리소스, 속성 및 속성 값
RDF는 웹 식별자(URI)를 사용하여 사물을 식별하고 속성 및 속성 값으로 리소스를 설명합니다.
리소스, 속성 및 속성 값에 대한 설명:
- 리소스 는 "https://www.w3schools.com/rdf"와 같이 URI를 가질 수 있는 모든 것입니다 .
- 속성 은 "저자" 또는 "홈페이지"와 같은 이름을 가진 리소스입니다 .
- 속성 값 은 "Jan Egil Refsnes" 또는 "https://www.w3schools.com"과 같은 속성 값입니다(속성 값은 다른 리소스일 수 있음) .
다음 RDF 문서는 "https://www.w3schools.com/rdf" 리소스를 설명할 수 있습니다.
<?xml version="1.0"?>
<RDF>
<Description about="https://www.w3schools.com/rdf">
<author>Jan Egil Refsnes</author>
<homepage>https://www.w3schools.com</homepage>
</Description>
</RDF>
위의 예는 단순화되었습니다. 네임스페이스는 생략됩니다.
RDF 문
Resource, Property 및 Property 값의 조합은 Statement (Statement의 주제, 술어 및 객체 로 알려짐 )를 형성합니다.
더 나은 이해를 위해 몇 가지 예문을 살펴보겠습니다.
성명서: "https://www.w3schools.com/rdf의 저자는 Jan Egil Refsnes입니다."
- 위 진술의 주제는 https://www.w3schools.com/rdf입니다.
- 술어는 작성자입니다.
- 대상: Jan Egil Refsnes
성명서: "https://www.w3schools.com/rdf의 홈페이지는 https://www.w3schools.com입니다."
- 위 진술의 주제는 https://www.w3schools.com/rdf입니다.
- 술어는 홈페이지
- 개체: https://www.w3schools.com
RDF 예
다음은 CD 목록의 두 레코드입니다.
Title | Artist | Country | Company | Price | Year |
---|---|---|---|---|---|
Empire Burlesque | Bob Dylan | USA | Columbia | 10.90 | 1985 |
Hide your heart | Bonnie Tyler | UK | CBS Records | 9.90 | 1988 |
다음은 RDF 문서의 몇 줄입니다.
<?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/Empire Burlesque">
<cd:artist>Bob Dylan</cd:artist>
<cd:country>USA</cd:country>
<cd:company>Columbia</cd:company>
<cd:price>10.90</cd:price>
<cd:year>1985</cd:year>
</rdf:Description>
<rdf:Description
rdf:about="http://www.recshop.fake/cd/Hide your heart">
<cd:artist>Bonnie Tyler</cd:artist>
<cd:country>UK</cd:country>
<cd:company>CBS Records</cd:company>
<cd:price>9.90</cd:price>
<cd:year>1988</cd:year>
</rdf:Description>
.
.
.
</rdf:RDF>
RDF 문서의 첫 번째 줄은 XML 선언입니다. XML 선언 뒤에는 RDF 문서의 루트 요소인 <rdf:RDF> 가 옵니다 .
xmlns:rdf 네임스페이스 는 rdf 접두사가 있는 요소가 "http://www.w3.org/1999/02/22-rdf-syntax-ns#" 네임스페이스에서 가져온 것임을 지정합니다.
xmlns:cd 네임스페이스는 cd 접두사가 있는 요소가 "http://www.recshop.fake/cd#" 네임스페이스에서 가져온 것임을 지정합니다 .
< rdf:Description> 요소는 rdf:about 속성 으로 식별되는 리소스에 대한 설명을 포함합니다 .
<cd : artist>, <cd:country>, <cd:company> 등의 요소는 리소스의 속성입니다.
RDF 온라인 검증기
W3C의 RDF Validation Service 는 RDF를 학습할 때 유용합니다. 여기에서 RDF 파일을 실험할 수 있습니다.
온라인 RDF Validator는 RDF 문서를 구문 분석하고 구문을 확인하며 RDF 문서의 표 및 그래픽 보기를 생성합니다.
아래 예제를 복사하여 W3C의 RDF 유효성 검사기에 붙여넣습니다.
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:si="https://www.w3schools.com/rdf/">
<rdf:Description rdf:about="https://www.w3schools.com">
<si:title>W3Schools.com</si:title>
<si:author>Jan Egil Refsnes</si:author>
</rdf:Description>
</rdf:RDF>
위의 예를 구문 분석하면 결과가 다음과 같이 보일 것 입니다.
RDF 요소
RDF의 주요 요소는 루트 요소인 <RDF>와 자원을 식별하는 <Description> 요소이다.
<rdf:RDF> 요소
<rdf:RDF>는 RDF 문서의 루트 요소입니다. XML 문서를 RDF 문서로 정의합니다. 여기에는 RDF 네임스페이스에 대한 참조도 포함되어 있습니다.
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
...Description goes here...
</rdf:RDF>
<rdf:Description> 요소
<rdf:Description> 요소는 about 속성으로 리소스를 식별합니다.
<rdf:Description> 요소에는 리소스를 설명하는 요소가 포함됩니다.
<?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/Empire Burlesque">
<cd:artist>Bob Dylan</cd:artist>
<cd:country>USA</cd:country>
<cd:company>Columbia</cd:company>
<cd:price>10.90</cd:price>
<cd:year>1985</cd:year>
</rdf:Description>
</rdf:RDF>
요소, 아티스트, 국가, 회사, 가격 및 연도는 http://www.recshop.fake/cd# 네임스페이스에 정의되어 있습니다. 이 네임스페이스는 RDF 외부에 있습니다(RDF의 일부가 아님). RDF는 프레임워크만 정의합니다. 요소, 아티스트, 국가, 회사, 가격 및 연도는 다른 사람(회사, 조직, 사람 등)이 정의해야 합니다.
속성으로서의 속성
속성 요소는 요소 대신 속성으로 정의할 수도 있습니다.
<?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/Empire Burlesque"
cd:artist="Bob Dylan" cd:country="USA"
cd:company="Columbia" cd:price="10.90"
cd:year="1985" />
</rdf:RDF>
리소스로서의 속성
속성 요소는 리소스로 정의할 수도 있습니다.
<?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/Empire Burlesque">
<cd:artist rdf:resource="http://www.recshop.fake/cd/dylan" />
...
...
</rdf:Description>
</rdf:RDF>
위의 예에서 속성 아티스트에는 값이 없지만 아티스트에 대한 정보가 포함된 리소스에 대한 참조가 있습니다.
RDF 컨테이너
RDF 컨테이너는 사물의 그룹을 설명하는 데 사용됩니다.
다음 RDF 요소는 그룹을 설명하는 데 사용됩니다: <Bag>, <Seq> 및 <Alt>.
<rdf:Bag> 요소
<rdf:Bag> 요소는 특정 순서일 필요가 없는 값 목록을 설명하는 데 사용됩니다.
<rdf:Bag> 요소에 중복 값이 포함될 수 있습니다.
예시
<?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> 요소
<rdf:Seq> 요소는 정렬된 값 목록을 설명하는 데 사용됩니다(예: 알파벳 순서).
<rdf:Seq> 요소에 중복 값이 포함될 수 있습니다.
예시
<?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>
<rdf:Alt> 요소
<rdf:Alt> 요소는 대체 값 목록을 설명하는 데 사용됩니다(사용자는 값 중 하나만 선택할 수 있음).
예시
<?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:format>
<rdf:Alt>
<rdf:li>CD</rdf:li>
<rdf:li>Record</rdf:li>
<rdf:li>Tape</rdf:li>
</rdf:Alt>
</cd:format>
</rdf:Description>
</rdf:RDF>
RDF 용어
위의 예에서 우리는 컨테이너 요소를 설명할 때 "값 목록"에 대해 이야기했습니다. RDF에서는 이러한 "값 목록"을 구성원이라고 합니다.
따라서 다음이 있습니다.
- 컨테이너는 사물을 포함하는 리소스입니다.
- 포함된 것을 구성원이라고 합니다(값 목록이 아님).
RDF 컬렉션
RDF 컬렉션은 지정된 구성원만 포함할 수 있는 그룹을 설명합니다.
rdf:parseType="Collection" 속성
이전 장에서 보았듯이 컨테이너는 포함하는 리소스가 구성원이라고 말합니다. 다른 구성원이 허용되지 않는다는 것은 아닙니다.
RDF 컬렉션은 지정된 구성원만 포함할 수 있는 그룹을 설명하는 데 사용됩니다.
컬렉션은 rdf:parseType="Collection" 속성으로 설명됩니다.
예시
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cd="http://recshop.fake/cd#">
<rdf:Description
rdf:about="http://recshop.fake/cd/Beatles">
<cd:artist rdf:parseType="Collection">
<rdf:Description rdf:about="http://recshop.fake/cd/Beatles/George"/>
<rdf:Description rdf:about="http://recshop.fake/cd/Beatles/John"/>
<rdf:Description rdf:about="http://recshop.fake/cd/Beatles/Paul"/>
<rdf:Description rdf:about="http://recshop.fake/cd/Beatles/Ringo"/>
</cd:artist>
</rdf:Description>
</rdf:RDF>
RDF 스키마 및 애플리케이션 클래스
RDF 스키마(RDFS)는 RDF의 확장입니다.
RDF는 클래스, 속성 및 값으로 리소스를 설명합니다.
또한 RDF는 응용 프로그램별 클래스 및 속성을 정의하는 방법도 필요합니다. 응용 프로그램별 클래스 및 속성은 RDF에 대한 확장을 사용하여 정의해야 합니다.
그러한 확장 중 하나는 RDF 스키마입니다.
RDF 스키마(RDFS)
RDF 스키마는 실제 응용 프로그램별 클래스 및 속성을 제공하지 않습니다.
대신 RDF 스키마는 응용 프로그램별 클래스 및 속성을 설명하는 프레임워크를 제공합니다.
Classes in RDF Schema are much like classes in object oriented programming languages. This allows resources to be defined as instances of classes, and subclasses of classes.
RDFS Example
The following example demonstrates some of the RDFS facilities:
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xml:base="http://www.animals.fake/animals#">
<rdf:Description rdf:ID="animal">
<rdf:type
rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
</rdf:Description>
<rdf:Description rdf:ID="horse">
<rdf:type
rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
<rdfs:subClassOf rdf:resource="#animal"/>
</rdf:Description>
</rdf:RDF>
In the example above, the resource "horse" is a subclass of the class "animal".
Example Abbreviated
Since an RDFS class is an RDF resource we can abbreviate the example above by using rdfs:Class instead of rdf:Description, and drop the rdf:type information:
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xml:base="http://www.animals.fake/animals#">
<rdfs:Class rdf:ID="animal" />
<rdfs:Class rdf:ID="horse">
<rdfs:subClassOf rdf:resource="#animal"/>
</rdfs:Class>
</rdf:RDF>
That's it!
The Dublin Core
The Dublin Core Metadata Initiative (DCMI) has created some predefined properties for describing documents.
RDF is metadata (data about data). RDF is used to describe information resources.
The Dublin Core is a set of predefined properties for describing documents.
The first Dublin Core properties were defined at the Metadata Workshop in Dublin, Ohio in 1995 and is currently maintained by the Dublin Core Metadata Initiative.
Property | Definition |
---|---|
Contributor | An entity responsible for making contributions to the content of the resource |
Coverage | The extent or scope of the content of the resource |
Creator | An entity primarily responsible for making the content of the resource |
Format | The physical or digital manifestation of the resource |
Date | A date of an event in the lifecycle of the resource |
Description | An account of the content of the resource |
Identifier | An unambiguous reference to the resource within a given context |
Language | A language of the intellectual content of the resource |
Publisher | An entity responsible for making the resource available |
Relation | A reference to a related resource |
Rights | Information about rights held in and over the resource |
Source | A Reference to a resource from which the present resource is derived |
Subject | A topic of the content of the resource |
Title | A name given to the resource |
Type | The nature or genre of the content of the resource |
A quick look at the table above indicates that RDF is ideal for representing Dublin Core information.
RDF Example
The following example demonstrates the use of some of the Dublin Core properties in an RDF document:
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc= "http://purl.org/dc/elements/1.1/">
<rdf:Description rdf:about="https://www.w3schools.com">
<dc:description>W3Schools - Free tutorials</dc:description>
<dc:publisher>Refsnes Data as</dc:publisher>
<dc:date>2008-09-01</dc:date>
<dc:type>Web Development</dc:type>
<dc:format>text/html</dc:format>
<dc:language>en</dc:language>
</rdf:Description>
</rdf:RDF>
RDF Reference
The RDF namespace (xmlns:rdf) is: http://www.w3.org/1999/02/22-rdf-syntax-ns#
The RDFS namespace (xmlns:rdfs ) is: http://www.w3.org/2000/01/rdf-schema#
The recommended file extension for RDF files is .rdf. However, the extension .xml is often used to provide compatibility with old xml parsers.
The MIME type should be "application/rdf+xml".
RDFS / RDF Classes
Element | Class of | Subclass of |
---|---|---|
rdfs:Class | All classes | |
rdfs:Datatype | Data types | Class |
rdfs:Resource | All resources | Class |
rdfs:Container | Containers | Resource |
rdfs:Literal | Literal values (text and numbers) | Resource |
rdf:List | Lists | Resource |
rdf:Property | Properties | Resource |
rdf:Statement | Statements | Resource |
rdf:Alt | Containers of alternatives | Container |
rdf:Bag | Unordered containers | Container |
rdf:Seq | Ordered containers | Container |
rdfs:ContainerMembershipProperty | Container membership properties | Property |
rdf:XMLLiteral | XML literal values | Literal |
RDFS / RDF Properties
Element | Domain | Range | Description |
---|---|---|---|
rdfs:domain | Property | Class | The domain of the resource |
rdfs:range | Property | Class | The range of the resource |
rdfs:subPropertyOf | Property | Property | The property is a sub property of a property |
rdfs:subClassOf | Class | Class | The resource is a subclass of a class |
rdfs:comment | Resource | Literal | The human readable description of the resource |
rdfs:label | Resource | Literal | The human readable label (name) of the resource |
rdfs:isDefinedBy | Resource | Resource | The definition of the resource |
rdfs:seeAlso | Resource | Resource | The additional information about the resource |
rdfs:member | Resource | Resource | The member of the resource |
rdf:first | List | Resource | |
rdf:rest | List | List | |
rdf:subject | Statement | Resource | The subject of the resource in an RDF Statement |
rdf:predicate | Statement | Resource | The predicate of the resource in an RDF Statement |
rdf:object | Statement | Resource | The object of the resource in an RDF Statement |
rdf:value | Resource | Resource | The property used for values |
rdf:type | Resource | Class | The resource is an instance of a class |
RDF Attributes
Attribute | Description |
---|---|
rdf:about | Defines the resource being described |
rdf:Description | Container for the description of a resource |
rdf:resource | Defines a resource to identify a property |
rdf:datatype | Defines the data type of an element |
rdf:ID | Defines the ID of an element |
rdf:li | Defines a list |
rdf:_n | Defines a node |
rdf:nodeID | Defines the ID of an element node |
rdf:parseType | Defines how an element should be parsed |
rdf:RDF | The root of an RDF document |
xml:base | Defines the XML base |
xml:lang | Defines the language of the element content |