Categories
Uncategorized

Knowledge Mapping reasoning and practice (1)

Because of work reasons, need to establish a pattern of reasoning in the system function, so simple to learn the knowledge map of Zhejiang University professor Chen Huajun introductory courses courseware, here record the study notes.

The main method of mapping knowledge reasoning

• description logic-based reasoning (e.g., DL-based)
    • outline view of mining and statistical inference rules (such as: PRA, AMIE)
    • Knowledge-based learning map table displayed reasoning (such as: TransE)
    • Based on the logic of probability methods (such as: Statistical Relational Learning)

Reasoning Based on Symbolic Logic – ontology reasoning

    The traditional symbolic logic and reasoning major means of reasoning about knowledge map is based on description logic ontology reasoning.

    Using the logic is to describe the main body of things into ⾏ modeling and reasoning, selectively used to describe the relationship between the concept and the concept of classification and inference.

  • 主要方法:

      Based on the table calculation (Tableaux) and improved Remedies: FaCT ++, Racer, Pellet Hermit etc.

      Remedies based Datalog converted as KAON, RDFox etc.

      Rule-based algorithms yield ⽣ (e.g. rete): Jena, Sesame, OWLIM etc.

Based on statistical view of the structure and rules of inference mining

Main methods:
    • Sorting based on the path of learning Remedies (PRA, Path ranking Algorithm)
    • mining Remedies (AMIE) based on association rules

Inference-based knowledge representation learning map

    The entities and relationships are represented as a vector

    Calculated between the place of the search vectors to predict the presence of traversal and triples, since the vector indicating the entity already contains the original semantic information, comprising calculating energy ⼀ reasoning given eyesight.

    Using the links available to predict, based on the path of abundance inquiry

Based on probability logic Remedies –Statistical Relational Learning

Probabilistic logic learning, sometimes called Relational Machine Learning (RML), concerned about the uncertainty and complexity of the relationship.
    Typically use Bayesian networks or Markov networks

Symbolic logic based reasoning

The concept ontology reasoning

Map as based on RDF resource description language, RDF is the Resource Description Framework for short.

But RDF shows the relationship between levels is limited, so there is RDFS, on the basis of RDF, adding a Class, subClassOf, type, Property, subPropertyOf, Domain, Range vocabulary, you can better express correlation.

Based on RDFS, you can do some simple reasoning

OWL RDFS on the basis of further expansion of a number of complex types, constraints:

Therefore, we also call for the OWL ontology language:

    OWL is a language mapping knowledge in the most standardized, most rigorous, the most expressive language

    Based on RDF syntax, so that out of the document with semantic understanding of the structural basis

    Promote the use of uniform glossary, the definition of a rich semantic vocabulary

    Allow logical reasoning

OWL description logic system:

  • 一个描述逻辑系统包括四个基本的组成部分

      1) basic elements: concept, relationships and individual (instances),

    • 2) TBox术语集 (概念术语的公理集合) – 泛化的知识

        Describe the concepts and knowledge relationships, called axioms (Axiom)

    • 3) ABox断言集 (个体的断言集合) –具体个体的信息

        ABox include extension of knowledge (also known as the assertion (Assertion)), described on the field
                                Specific individual

    • 4) inference mechanism on TBox and ABox

  • Indicates the ability to describe different reasoning mechanism logic of the system because these four different compositions of different selected portions

Corresponding to Logic and OWL description:

Reasoning is acquiring new knowledge or conclusions through a variety of methods, knowledge and conclusions meet semantics.

OWL ontology reasoning

  • 可满足性

      Body SATISFIABILITY: checking whether a body meet, i.e., the body has to check whether the model.

      Concept satisfiability, checking satisfiability of a concept, i.e., check the model, so that the explanation of the concept is not an empty set.

    Classification (classification), for Tbox reasoning, calculation includes the new concept of relationship

    Examples of (materialization), i.e. which belong to the set of all instances of a concept or relationship.

example:

A typical inference algorithms: Tableaux, a body adapted to examine the concept of satisfiability, detecting and examples, the basic idea is to build Abox through a series of rules to detect satisfiability, or detecting the presence or absence of a certain concept instance, the basic idea is similar to first-order logic attributed to refute.

Based on method of rewriting logic programming

Ontology reasoning limitations:

    (1) supports only reasoning on predefined ontology axioms (reasoning can not support flexible for custom words)

    (2) Users can not define their own reasoning process

Therefore, the introduction of rule-based reasoning

    (1) can be customized according to specific rules scene to implement user-defined inference process

    (2) Datalog language can be combined ontology reasoning and rule-based reasoning

Datalog syntax:

  • 原子(atom)
    • p(t1,t2,…,tn)
    • p is a predicate, n being the number, ti is the term

      E.g. has_child (x, y)

  • 规则(rule)
    • H:-B1,B2,…,Bm
    • has_child(X, Y) :−has_son(X, Y)
  • 事实(Fact)
    • F(c1,c2,…cn):-
    • Rule no body and no variables

      For example: has_child (Alice, Bob): –

Datalog program is a set of rules:

has_child(X, Y) : −has_son(X, Y).
has_child(Alice, Bob) : −

Datalog inference Example:

Tools:

Based on method of production rules

Production system, the former to the reasoning system that can perform in accordance with the rules of certain mechanisms to achieve certain goals, and first-order logic is similar, there are differences that can be applied automatically to do the planning and expert systems.

Production system consists of:

    A set of facts (Working Memory)

    Production / rule set (Production Memory, PM)

    Inference engine

Production said:

IF conditions THEN actions

    conditions is composed of a collection of conditions, also known as LHS (Left Hand Side)

    It is a sequence of movements and actions, also known as RHS (Right Hand Side)

LHS, is a set of conditions, each condition and (AND) relationship, when all the conditions are satisfied, the rule is triggered.
    Conditions of the form (type attr1: spec1 attr2: spec2) form conditions:

    Atom (person name: alice)

    Variable (person name: x)

    Expression (person age: [n + 4]

    Boolean (person age: {> 10})

    Constraints and, or, not

The RHS, is the sequence of operation performed (action) sequentially runtime execution. Operation type has ADD pattern, Remove i, Modify i, as will be appreciated CUD of WME (Working Memory); and

Example production:

IF (Student name: x)
Then ADD (Person name: x)

It can also be written as:

(Student name: x) ⇒ ADD (Person name: x)

Inference engine

➤ controls and procedures:

    Pattern matching, partial matching set of facts with the fact that the conditions of the rule, the entire LHS are met regulations, were triggered and added to the agenda (agenda)

    Resolve conflicts, according to a certain strategy choose from a number of rules to be triggered

    Perform an action performed by the RHS of the selected rule, whereby certain operations on WM

Production System = set of facts set production + + inference engine

Execution flow production system

Pattern matching algorithm –RETE

    The production of the LHS network organized in the form of discriminant

    With space for time

Presentation tools

  • Drools
  • Providing the RDF handling Jena, interfaces RDFS, OWL data, also provides a rules engine

Model m = ModelFactory.createDefaultModel(); 
Reasoner reasoner = new
GenericRuleReasoner(Rule.rulesFromURL("file:rule.txt"));
InfModel inf = ModelFactory.createInfModel(reasoner, m)

Inductive Reasoning – a method based on FIG.

PRA

➤ path connecting two entities characterized as possible to predict the relationship between

• Universal relational learning framework (generic relational learning framework)

Path sorting algorithm – Path Ranking Algorithm (PRA)

TransE

Mapping knowledge embedded START model: TransE

TransE(Translating Embeddings for Modeling Multi-relational Data. NIPS 3013)

Destination time standard function:

Loss function:

Mapping knowledge embedded START model: prediction problem

    Test triple (h, r, t)

    Last entities prediction (h, r,?)

    Head entity prediction (?, R, t)

PRA vs. TransE

Jena achieved based deductive reasoning

Construction of model

NO BB, show code:

Model myMod = ModelFactory.createDefaultModel();
String finance = “http://www.example.org/kse/finance#”;

// 实体
Resource shb = myMod.createResource(finance + "孙宏斌");
Resource rczg = myMod.createResource(finance + "融创中国");


// 关系

Property control = myMod.createProperty(finance + "执掌");

// 加入三元组
myMod.add(shb, control, rczg);

Pattern shown above, contains the following triples:

finance :孙宏斌 finance :control finance :融创中国
finance :贾跃亭 finance :control finance :乐视网
finance :融创中国 rdf:type finance :地产公司
finance :地产公司 rdfs:subclassOf finance:公司
finance:公司 rdfs:subclassOf finance:法人实体
finance:孙宏斌 rdf:type finance:公司
finance:孙宏斌 rdf:type finance:人
finance :人 owl:disjointWith finance:公司

We can join in turn, the code slightly.

Add inference engine

jena reasoning using InfModel, can be constructed based on the Model, in fact, added a RDFS inference engine on top of the original Model

InfModel inf_rdfs = ModelFactory.createRDFSModel(myMod);

• Upper and Lower reasoning

If there is acquired by the condition listStatements triples, thereby realizing judgment, RDFS subClassOf is in the VOB, so use RDFS.subClassOf.

public static void subClassOf(Model m, Resource s, Resource o) {
for (StmtIterator i = m.listStatements(s, RDFS.subClassOf, o); i.hasNext(); ) {
Statement stmt = i.nextStatement();
System.out.println(" yes! " );
break;
}
}

subClassOf(inf_rdfs, myMod.getResource(finance+"地产公司"),myMod.getResource(finance+”法人实体"));

• Category reasoning for, OWL inference engine can make perfect reasoning for the individual categories, namely the complete complement of all categories of individuals; when the query, you can print directly all categories!

First constructed owl inference engine:

Reasoner reasoner = ReasonerRegistry.getOWLReasoner();
InfModel inf_owl = ModelFactory.createInfModel(reasoner, myMod);

Then perform reasoning category

public static void printStatements(Model m, Resource s, Property p, Resource o) {
for (StmtIterator i = m.listStatements(s,p,o); i.hasNext(); ) {
Statement stmt = i.nextStatement();
System.out.println(" - " + PrintUtil.print(stmt));
}
}
printStatements(inf_owl, rczg, RDF.type, null);

• inconsistency detection, jena Another common reasoning is inconsistent with the test data.

Model data = FileManager.get().loadModel(fname);
Reasoner reasoner = ReasonerRegistry.getOWLReasoner();
InfModel inf_owl = ModelFactory.createInfModel(reasoner, myMod);
ValidityReport validity = inf_owl.validate();
if (validity.isValid()) {
System.out.println(“没有不一致");
} else {
System.out.println(“存在不一致,如下: ");
for (Iterator i = validity.getReports(); i.hasNext(); ) {
System.out.println(" - " + i.next());
}
}


Author: Jadepeng
    Source: jqpeng technical notepad –http: //www.cnblogs.com/xiaoqi
    Your support is the greatest encouragement blogger, thank you for your read.
    This article belongs to the author of all, welcome to reprint, but without the author’s consent declared by this section must be retained, and given the original connection in the apparent position of the article page, otherwise the right to pursue legal responsibilities.

Leave a Reply