Semantic Web based tutorial notes (a) - Pei Zhang Han's blog

Reading notes do not have to see it again in the end is. . . RDF is a bold expression language about the life of an object (resource); it is a standard semantic data model to provide a machine-processable. RDF schema provides a set of primitives for modeling RDF vocabulary organized into a type hierarchy with.

World Wide Web's success demonstrates the power of information exchange and the use of standardized communication mechanisms. HTML is the standard language of the web page that can be edited, which is used to convey information about the structure of the human-oriented document. As for the Semantic Web, we need richer. RDF (Resource Description Framework) just such a flexible and independent field data model. His base member is an entity - property - value triples, called a statement. Because RDF is not against Ren and field use, for the user must define the terms they use in these statements. To do this, use RDF Schema (RDFS). RDFS allows the user to precisely define their vocabulary (vocabulary, i.e., terms) should explain how.

Taken together, these techniques define part of a standardized exchange of data in any language different machines:

  • RDF - Data Model
  • RDFS - semantics
  • Turtle / RDFa / RDF-XML - syntax

Although primarily it refers RDF data model, but it is also often used as a generic term for all the above.

RDF: Data Model

The basic concepts include RDF resources, attributes, statements and drawing.

Resources

We can think of a resource is an object. Each resource has a URI. A URI can be a URL ((Uniform Resource Locator, uniform resource locator), or URL) or another unique identifier. URI provides a mechanism to unambiguously identify one thing we want to talk about. Use URI does not have to have access to a resource. But you can use the dereference the URL as a resource identifier is considered a good practice.

Attributes

Property is a special kind of resource that describes the relationship between resources. Such as "located in". Like other resources, property is also identified by a URI. We can also de-referenced URL attribute to find their descriptions.

statement

Statement asserted property resources. A statement is an entity - Properties - triplet values ​​from a resource, an attribute and an attribute value components. Property value is either a resource or a literal (literal). Text is the atomic value, such as numbers, strings, or date. We often use the term to refer to the subject of triples in the entity, and use object to refer to its value.

For example, for the statement "BAron Way Building is located in Amsterdam", write:

<http://www.semanticwebprimer.org/ontology/apartments.ttl#BaronWayBuilding>
<http://dbpedia.org/ontology/location>
<http://dbpedia.org/resource/Amsterdam>.

Map

We can also use a graphical way to write the same statement. As shown below, in which we have to improve readability useless URI. Wherein a node tagged with labels via edge connector. Edges are directed, the subject attribute declaration from the object to the declaration statement are marked on the side. The label identifier on the subject and object nodes, the object may be a subject of another declaration statement. This graphical representation emphasizes this concept to RDF is a data model Pictured center.

Point statement and

Sometimes some parts can point to a particular statement or graph is very useful. RDF provides two implementation mechanisms for this purpose. Called concrete (reification), the key idea behind the concrete is to introduce an additional object and three parts of its original declaration by property subject predicate object association. But the cost of this approach is relatively high, so the introduction of the concept of named graphs in newer versions of the RDF standard. At this time, an explicit identifier is assigned a set of statements and declarations. FIG circle allows a named set of RDF statements and provide an identifier for these statements.

RDF Syntax

It has been introduced an RDF syntax that graphical syntax. But this syntax is neither a machine interpretable, nor standardized. Here we introduce a standard machine interpretable grammar, called Turle. There are other syntax.

Turtle

Turtle (Terse RDF Triple Language) is a text-based RDF syntax. Turtle suffix text file using the ".ttl". Before we see the triad is a statement of the Turtle.

<http://www.semanticwebprimer.org/ontology/apartments.ttl#BaronWayBuilding>
<http://dbpedia.org/ontology/location>
<http://dbpedia.org/resource/Amsterdam>.

URL enclosed in angle brackets. A statement of the subject, property and object appear one after another, by the end of the period.

Writing

In addition to declaring the resource as above, linked together. We also introduced the text in RDF, that atomic values. In Turtle, we simply unload the value quotes, along with the data type of the value. Data type contains the string, date, integer data types or other data types are not expressed in the URL. In practice we recommend using XML schema-defined data types. If no data type after a word, it is assumed that a character data type. Such as:

<http://www.semanticwebprimer.org/ontology/apartments.ttl#BaronWayAppartment>
<http://www.semanticwebprimer.org/ontology/apartments.ttl#hasNumberOfBedrooms>
"3"^^<http://www.w3.org/2001/XMLSchema#integer>.

<http://www.semanticwebprimer.org/ontology/apartments.ttl#BaronWayAppartment>
<http://www.semanticwebprimer.org/ontology/apartments.ttl#isPartOf>
<http://www.semanticwebprimer.org/ontology/apartments.ttl#BaronWayBuilding>.

<http://www.semanticwebprimer.org/ontology/apartments.ttl#BaronWayBuilding>
<http://www.dbpedia.org/ontology/location>
<http://www.dbpedia.org/resource/Amsterdam>.

The above example is not relatively easy to use. For greater clarity, Turtle provides some constructors to make writing easier.

abbreviation

In the above example, BaronWayAppartment BaronWayBuilding and are defined in the http://www.semanticwebprimer.org/ontology/apartments.ttl this URL. This URL defines the namespace of these resources. Turtle used this convention to allow the URL is abbreviated. It introduces @prefix syntax to define alternative forms namespace. As may be used as an alternative form of swp of http://www.semanticwebprimer.org/ontology/apartments.ttl. This alternative is called qualified name (qualified name). Qualifying names rewrite the above example:

@prefix swp: <http://www.semanticwebprimer.org/ontology/apartments.ttl#>.
@prefix dbpedia: <http://dbpedia.org/resource>.
@prefix dbpedia-owl: <http://dbpedia.org/ontology>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.

swp:BaronWayAppartment swp:hasNumberOfBedrooms "3"^^<xsd:integer>.
swp:BaronWayAppartment swp:isPartOf swp:BaronWayBuilding.
swp:BaronWayBuilding dbpedia-owl:location dbpedia:Amsterdam.

Turtle also allows us to reuse some of the subject when writing do not need to be repeated. This can be done using a semi-colon at the end of a statement to make the writing more compact.

@prefix swp: <http://www.semanticwebprimer.org/ontology/apartments.ttl#>.
@prefix dbpedia: <http://dbpedia.org/resource>.
@prefix dbpedia-owl: <http://dbpedia.org/ontology>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.

swp:BaronWayAppartment swp:hasNumberOfBedrooms "3"^^<xsd:integer>                        swp:isPartOf swp:BaronWayBuilding.
swp:BaronWayBuilding dbpedia-owl:location dbpedia:Amsterdam.

If the subject and predicate are reused, we can use a comma at the end of the statement. To illustrate BAron Way Building is not only located in Amsterdam also located in Netherlands, then:

@prefix swp: <http://www.semanticwebprimer.org/ontology/apartments.ttl#>.
@prefix dbpedia: <http://dbpedia.org/resource>.
@prefix dbpedia-owl:大专栏  语义网基础教程笔记(一) - 张涵沛的博客="w"> <http://dbpedia.org/ontology>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.

swp:BaronWayAppartment swp:hasNumberOfBedrooms "3"^^<xsd:integer>                        swp:isPartOf swp:BaronWayBuilding.

swp:BaronWayBuilding dbpedia-owl:location dbpedia:Amsterdam,
                                          dbpedia:Netherlands.

Finally, Turtle also allows us shorthand common data types. Such as digital without quotation marks to write, if the number contains a decimal point, it is interpreted as a decimal. If a decimal point is interpreted as integers.

Named graphs

Before we discuss the ability of a pointer to a group statement. Trig is an extension of the Turtle, it allows us to express this concept. For this reason we want a set of statements enclosed in braces, and give this group claim a URL.

@prefix swp: <http://www.semanticwebprimer.org/ontology/apartments.ttl#>.
@prefix dbpedia: <http://dbpedia.org/resource>.
@prefix dbpedia-owl: <http://dbpedia.org/ontology>.
@prefix dc: <http://purl.org/dc/terms/>.

{
    <http://www.semanticwebprimer.org/ontology/apartments.ttl#>
    dc:creator <http://wwww.cs.vu.nl/frankh>
}

<http://www.semanticwebprimer.org/ontology/apartments.ttl#>
{
    swp:BaronWayAppartment swp: hasNumberOfBedrooms 3;
                           swp:isPartOf swp:BaronWayBuilding.
    swp:BaronWayBuilding dbpedia-owl:location dbpedia:Amsterdam,
                                            dbpedia:Netherlands.
}

In the example above, located in curly braces but not the URL declaration is not a part of a specific figure before. It becomes the default map.

Other grammar

In addition to the Turtle, there are other syntax for writing RDF's. There are two standard syntax: RDF / XML and RDFa.

RDF / XML

RDF / XML RDF is encoded in XML language. It allows existing RDF is XML processing tools. At first, RDF / XML syntax of RDF is unique. However, due Turtle generally easier to read, it was adopted as an additional criterion. The following example is an example RDF / XML to:

<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:dbpedia-owl="http://dbpedia.org/ontology/"
    xmlns:dbpedia="http://dbpedia.org/resource/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:swp="http://www.semanticwebprimer.org/ontology/apartments.ttl#">
<rdf:Description
rdf:about="http://www.semanticwebprimer.org/ontology/apartments.ttl#BaronWayAppartment">
    <swp:hasNumberOfBedrooms
    rdf:datatype="http:www.w3.org/2001/XMLSchema#integer">
        3
    <swp:hasNumberOfBedrooms>
</rdf:Description>

RDFa

RDF is a use case describes the contents of the HTML page or label. To make it easier to introduce RDFa syntax to help achieve this use case. RDFa embedded in RDF property (attribute) HTML tag.

summary

Each of the above RDF syntax applies to different scenarios. But although it may use different syntax, but their underlying data model and semantics are the same.

RDFS: add semantic

RDF is assumed that neither related to any particular field of application, does not define the semantics of any field. In order to specify the semantics, the user needs a developer or independent by a basic set of RDF Schema art structure defined meanings defined in their vocabulary.

Classes and Properties

Purpose of describing particular art, in addition to the individual subject, there are class, which defines the type of the object. A; class can be understood as a collection of elements. Individual subject belongs to a class of this class is called an instance (instance). RDF provides us with a property through the use of a special rdf: to define the contact between the instance and class type.

Class hierarchy and inheritance

Between classes is associated, a class can be a subclass of another class, and may be another superclass. A class can inherit from another class. RDF mode does not require all of the classes form a strict hierarchy. By creating such a semantic definition, RDFS is a (capacity remains limited) definition of domain-specific languages. In other words, RDF mode is a basic ontology language.

Comparison of RDF and RDFS stratified

The following figure shows the level of this example RDF and RDF schema hierarchy. Wherein the block is the attribute type is above the dotted line circles, and the broken line circles are the following examples.

RDF Schema: Language

RDF mode offers modeling primitives to express information on the festival. Now let's define modeling primitives RDF model.

Core classes

Core classes include:

  • rdfs: Resource, all resource classes
  • rdfs: Class, class of all classes
  • rdfs: Literal, all text (character string) of the class.
  • rdf: Property, class of all properties.
  • rdf: Statement, all specific kind of statement.

The core attribute definition link

Used to define the contact of the core attributes include:

  • rdf: type, associating a resource to its class. The resource is declared as an instance of the class.
  • rdfs: subClassOf, will be associated with a class to its superclass. All instances of a class is an instance of its superclass. Note that a class may be a subclass of more than one class.
  • rdfs: subPropertyOf, a property associated with it a super property.

Note that, rdfs: subPropertyOf and rdfs: subClassOf is defined as passed. rdfs: Class is rdfs: A subclass of the Resource (all classes are resources), while rdfs: the Resource is rdfs: Class of an example. For the same reason, each class is rdfs: Class of instances.

Properties of core restrictions

To limit the property's core attributes include:

  • rdfs: domain, specify a property P domain, declare any resources have a given property is an instance of the class domain.
  • rdfs: range, a specified range of the property P, a declaration attribute value is an instance of the class range.

Useful properties of concrete

Here are a few useful for specific attributes:

  • rdf: subject, speaking of a specific statement related to its subject.
  • rdf: predicate, a concrete statement related to its predicate.
  • rdf: object, say a particular attribute associated with the object to it.

Container class

RDF container also allows the expression of a standard manner. Package can be expressed, or a sequence selected.

  • Class Bag, package: rdf
  • rdf: Class Seq, sequence.
  • rdf: Alt, selected class.
  • rdfs: Container, superclass of all containers, including the aforementioned three kinds.

Utility properties

A resource can be defined and described in many places on the World Wide Web. The following property allows us to define the connection to these addresses:

  • rdfs: seeAlso, associating a resource to another interpretation of its resources.
  • rdfs: isDefinedBy, it is rdfs: seeAlso of a sub-attribute, associating a resource to its place in the definitions of RDF is a general pattern.
  • rdfs: comment, annotate, usually long text, can be associated with a resource.
  • rdfs: label, telling a human-friendly label (name) is associated with a resource.

An example: car

Here is a simple car body, the figure shows the class hierarchy and represents it.

to sum up

  • RDF is a process and understandable data and provides the basis.
  • Based RDF data model of FIG. Its core concepts including resources, properties, and statements. A statement is a resource - triple the value - attribute.
  • RDF has three standard syntax (Turtle, RDF / XML and RDFa) to support the grammatical level interoperability.
  • RDF uses distributed thinking, allows incremental build knowledge, and knowledge sharing and reuse.
  • RDF is unrelated art, RDF model provides a mechanism for describing particular field.
  • RDF Schema is a basic ontology languages. It provides a set of modeling primitives have a fixed meaning. Core concept has an RDF Schema class, subclass relationships, attributes, sub-attribute relationship, and the domain and range limits.

Guess you like

Origin www.cnblogs.com/lijianming180/p/12041203.html