[NLP] semantic network map and an introduction (a)

Semantic Web and knowledge map entry (a)

RDF / XML

Body: For shared concepts clear and detailed description of a formal system. It refers to an abstract model can be used to describe the world object types, attributes, and relationships of the type of constitution.

RDF / XML is mainly about is how to use XML way to represent RDF Fig.

Ovals represent nodes, while rectangles represent text, arcs predicate.

Node Description

<rdf:Description rdf:about="A"></rdf:Description>

A node itself needs to be rdf: Description defined by rdf: about resources described uri.

Rdf space in front of the name, the default is the natural space rdf space.

Attribute Description

A description of how the value of the property d D it?

属性描述
<rdf:Description rdf:about="A">
    <d>D</d>
</rdf:Description>

简写
<rdf:Description rdf:about="A" d="D"></rdf:Description>

Path Description

How to describe a path from A to B it?

Can be defined rdf: nodeId manner specified unique nodeId, can also rdf: parseType specified node is empty Resouce.

属性描述,注意这里的B也是个节点,所以也需要Description
<rdf:Description rdf:about="A">
    <a rdf:nodeId="abc"></a>
</rdf:Description>
<rdf:Description rdf:nodeId="abc">
    <b>
        <rdf:Description rdf:about="B" ></rdf:Description>
    </b>
</rdf:Description>

不单独写空节点,即用resource
<rdf:Description rdf:about="A">
    <a rdf:parseType="Resource">
        <b>
            <rdf:Description rdf:about="B" ></rdf:Description>
        </b>
    </a>
</rdf:Description>

Text representation

<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:ex="http://purl.org/dc/elements/1.1/">
    <rdf:Description rdf:about="http://example.com">
        <ex:prop rdf:parseType="Literal" xmlns:a="http://example.org/a#">
            123
        </ex:prop>
    </rdf:Description>
</rdf:RDF>

xmlns i.e. xml namespace, the definition of a command space.

Using the syntax: xmlns: namespace-prefix = "namespaceURI".

Here the definition of a name as a command space

The results can be seen after resolved to:

Number Subject Predicate Object
1 http://example.com](http://example.com/) http://purl.org/dc/elements/1.1/prop) "123"^^http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral

Parse URL: https: //www.w3.org/RDF/Validator/rdfval

Can be seen by analyzing the contents of the resolution became a prop point text types, namely by specifying rdf: parseType = "Literal" to achieve. Predicate RDF: parseType = "the Literal" , the contents of the node is specified plain text, the interpreter does not need to be explained.

type of data

May be used rdf: datatype specified text data type

<rdf:RDF>
    <rdf:Description rdf:about="http://example.com">
        <a rdf:datatype="http://www.w3.org/2001/XMLSchema#int">
        123
        </a>
    </rdf:Description>
</rdf:RDF>

Similarly, there string, date, decimal data type and the like may be specified in the above datatype.

RDF Schema (RDFS)

Full name RDFS RDF Schema, RDF Schema class in object-oriented programming language is very similar to a class. This is so that the resources can be defined as a subclass of the class and instances of classes.

<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>

rdf: type
is used to represent the subject is an example of the predicate, the subject is a resource, the predicate is a class, the above described example is an example of class animal, Horse is class instance.

rdfs:subClassOf

Is used to indicate the subject is a subclass of the predicate, the subject and predicate is a class. The above example shows that the horse is a subclass of the animal.

rdfs:subPropertyOf

Is used to indicate the subject sub-attribute of the predicate, the subject and predicate properties are

rdfs:domain

It is used to indicate the attribute domain

rdfs:range

It used to represent the range

In addition, all are all the resources (resource): all classes (class) are the resources, all the attributes (property) all resources, all resources are literal.

container

Open Lists

open lists to add new elements to the container issue.

rdf: Seq expressed as a predetermined ordered list of values ​​(such as sorting in alphabetical order of a), may contain duplicate values.

rdf: Bag as represented by a predetermined value unordered list may contain duplicate values.

rdf: Alt represents a list of alternative values ​​(the user can select only one of these values).

<rdf:RDF>
    <rdf:Description rdf:about="http://a.com">
        <a>
            <rdf:Alt>
                 <rdf:li>CD</rdf:li>
                 <rdf:li>Record</rdf:li>
                 <rdf:li>Tape</rdf:li>
           </rdf:Alt>
        </a>
    </rdf:Description>
</rdf:RDF>

RDF: Li , interpreter interpreting automatically generated number.

Closed Lists

closed lists can not be added to container element, it becomes collections. By rdf: parseType = "collections" object can be regarded as closed lists.

<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>

Turtle syntax

turtle represented by triples, each behind a sentence. indicates the end of a sentence.

Prefix

@prefix book: <http://aa.com> .
@prefix ex: <http://axx.com> .

@Prefix specified by the prefix, the prefix can be used so that in the back.

book:uri ex:a "aaa".

Guess you like

Origin www.cnblogs.com/aoru45/p/11483330.html