1. mathematical logic

first order predicate logic、description logic


description logic

  • element

    • individuals: seu, jack, etc.
    • concepts: Person, Course, Student, etc.
    • roles: hasFather, attends, etc
  • constituents

    | Terminological Box | Assertion Box |
    | :————————: | :————————: |
    | ontology,抽象的类 | ground facts,实例 |

  • ALC,the simplest DL

    | ⊤ | ⊥ | ⊓ | ⊔ | ¬ | ∀ | ∃ |
    | :—: | :—: | :—: | :—: | :——: | :—: | :—: |
    | 全集 | 空集 | 与 | 或 | 非(补) | 任意 | 存在 |

    1. ⊤, ⊥ are concepts
    2. for concepts C/D, ¬C, C⊓D, C⊔D are concepts
    3. for a role r and a concept C, ∀r.C and ∃r.C are concepts

    | TBox | ABox |
    | :————————————————————————-: | :—————: |
    | consist of a set of GCIs(general concept inclusion) | C(a)、r(a,b) |

  • Interpretation

    a DL interpretation I consists of a domain△^I and a function·^I .

    image-20230129190730766

    将ALC转化为Interpretation

    1. 定义全集△,要求individual、concept和role在全集中都有对应的实例。
    2. 进行所有元素的实例映射。

    e.g.image-20230129215904011

  • 一些概念

    • satisfiable: a set of axioms has a model
    • inconsistent: does not have a medel,一般是因为模型有误
    • incoherent: 如果一个命名的class必须是空集才满足模型

2. production rules

If A Then B (CF=[0,1]), A→B;

CF: Certainty Factor 置信度

3. semantic network

use human language to label nodes and links.

XML(eXtensible Markup Language )

  • Origins from SGML(标准通用标记语言)⇨ HTML(超文本标记语言)

    HTML注重文本的格式

    e.g. <i>This book</i> has the title <b>KG</b>

    This book has the title KG

  • designed for data exchange

  • XML Syntax

    1. each XML document begin with a declaration containing version number and character encoding (default: Unicode)

      example: <?xml version="1.0" encoding="GB2312"?>

    2. case-sensitive <CITY>≠<City>≠<city>

    3. arbitrarily nested 任意嵌套

    4. empty element can be abbreviated

      example: <year></year>=<year/>

    5. the outermost element is called root element

      1
      2
      3
      4
      5
      6
      <author>
      <firstName>Jennifer</firstName>
      <lastName>Wu</lastName>
      <email>2050407179@qq.com</email>
      This is some text inside an XML element
      </author>
    6. an attribute is a name-value pair separated by “=”

      1
      2
      3
      4
      5
      <author email="2050407179@qq.com">
      <firstName>Jennifer</firstName>
      <lastName>Wu</lastName>
      This is some text inside an XML element
      </author>

      ps. 元素不能重复、属性值必须在“ ”中间、根节点存在且唯一

    7. XML Pre-defined Entities

      • HTML 嵌入XML

        1
        2
        3
        4
        5
        6
        7
        8
        9
        10
        <artical>
        <paragraph>
        <html>
        <head><title></title></head>
        <body>
        <h1>SEU</h1>
        </body>
        </html>
        </paragraph>
        </artical>
      • 将HTML看为纯文本

        1
        2
        3
        4
        5
        6
        7
        8
        9
        10
        <artical>
        <paragraph><![CDATA[
        <html>
        <head><title></title></head>
        <body>
        <h1>SEU</h1>
        </body>
        </html>]]>
        </paragraph>
        </artical>
  • XML Namespaces

    为防止元素名称相同但实际内容不同,添加前缀

    1
    2
    3
    4
    5
    6
    <table>
    <tr>
    <td>Apples</td>
    <td>Bananas</td>
    </tr>
    </table>
    1
    2
    3
    4
    5
    <table>
    <name>Coffee Table</name>
    <width>80</width>
    <length>120</length>
    </table>

    添加xmlns

    1
    2
    3
    4
    5
    6
    <table xmlns="http://www.w3.org/TR/html4/">
    <tr>
    <td>Apples</td>
    <td>Bananas</td>
    </tr>
    </table>
    1
    2
    3
    4
    5
    <table xmlns="https://www.w3schools.com/furniture">
    <name>Coffee Table</name>
    <width>80</width>
    <length>120</length>
    </table
International Resource Indentifer Uniform Resource Identifier Uniform Resource Locator
IRIs(范围max) URIs URLs
uses Unicode for more languages only uses English characters has a location on the WWW

URI(IRI) format: URI = scheme:[//authority]path[?query] [#fragment]

scheme: type of URI. e.g. http,ftp,file

authority: typically a domain name

path: file system name

query: provides non-hierarchical

  • XML Schema

    一些关于XML的规范。


RDF

a data modle about triples: ( subject, predicate, object)

QName:将长长的URI简化成短的名字

​ e.g. 令foo=http://example.com/ ,那么foo: bar 也就是http://example.com/bar

RDF Triple

subject——predicate——>object

subject: resource/blank node

predicates: resource

object: resource/literal/blank node

一些格式:

"Beantown"^^xsd:string

"France"@en

"France"@fr

"法国"@zh

"001"^^xsd: intenger = "1"^^xsd: intenger

"123.0"^^xsd:decimal="123"^^xsd:intenger

Blank node: unnamed resource e.g. _:x

  • RDF Syntax
  1. Turtle

    • <S><P><O>.(IRIs在<>中,string在””中)
    • 空格被忽略

    e.g.

    1
    2
    3
    4
    5
    <http://dbpedia.org/resource/Massachusets> <http://example.org/terms/capital> <http://dbpedia.org/resource/Boston>.
    <http://dbpedia.org/resource/Massachusets> <http://example.org/terms/nickname> "The bay station".
    <http://dbpedia.org/resource/Boston> <http://example.org/terms/inState> <http://dbpedia.org/resource/Massachusets>.
    <http://dbpedia.org/resource/Boston> <http://example.org/terms/nickname> "Beantown".
    <http://dbpedia.org/resource/Boston> <http://example.org/terms/population> "642109"^^xsd:integer.

    use Qname

    1
    2
    3
    4
    5
    6
    7
    8
    @prefix db:<http://dbpedia.org/resource/>
    @prefix dbo:<http://example.org/terms/>

    db:Massachusets dbo:capital db:Boston.
    db:Massachusets dbo:nockname "The bay station".
    db:Boston dbo:inState db:Massachusets.
    db:Boston dbo:nickname "Beantown".
    db:Boston dbo:population "642109"^^xsd:integer.

    use “;” and “,”

    1
    2
    3
    4
    5
    6
    7
    8
    @prefix db:<http://dbpedia.org/resource/>
    @prefix dbo:<http://example.org/terms/>

    db:Massachusets dbo:capital db:Boston;
    dbo:nockname "The bay station".
    db:Boston dbo:inState db:Massachusets;
    dbo:nickname "Beantown";
    dbo:population "642109"^^xsd:integer.
  2. RDF/XML


RDFS

ex:book rdf:type rdfs:Class.

性质: transitive、reflective

ex:TextBook rdfs:subClassOf ex:Book.

ex:happilyMarriedWith rdfs:subPropertyOf ex:marriedWith.

ex:isMarriedTo rdfs:domain ex:Person.

ex:isMarriedTo rdfs:range ex:Person.

image-20230128202044499


OWL

RDFS缺陷:不能形容互斥的关系、不能对某一项有数目的限制,比如父亲只能有一个、缺少对相等的定义

exp:Athlete owl:equivalentClass exp:SportsPlayer.

exp:obtain owl:equivalentProperty exp:acquire.

exp:SportsPlayerA owl:sameAS exp:Thomas.

exp:Man owl:disjointWith exp:Woman.

1
2
exp:Mother rdf:type owl:class;
owl:intersectionOf(exp:Woman exp:Parent).
1
2
exp:Parent rdf:type owl:class;
owl:unionOf(exp:Mother exp:Father).
1
2
exp:LivePerson rdf:type owl:class;
owl:complementOf exp:DeadPerson.
1
2
ex:friendOf rdf:type owl:ObjectProperty.
ex:age rdf:type owl:DataProperty.
1
2
3
exp:ancestor  rdf:type owl:TransitiveProperty
exp:friendOf rdf:type owl:SymmetricProperty
exp:hasMother rdf:type owl:FunctionalProperty
1
exp:ancestor owl:inverseOf exp:descendant
1
2
3
exp:Person rdf:type owl:Restriction;
owl:onProperty exp:hasMother;
owl:allValuesFrom exp:Woman.
1
2
3
exp:SemanticWebPapers rdf:type owl:Restriction;
owl:onProperty exp:PublishedIn;
owl:someValuesFrom exp:AAAIPaper.

Some of the Semantic Web paper were published in AAAI.

1
2
3
exp:Person rdf:type owl:Restriction;
owl:onProperty exp:hasParent;
owl:cardinality "2"^^xsd:integer.