You are on page 1of 16

20.

INCONSISTENCY CHECKING GENERAL ALGORITHM


a. Query from knowledge base the rule you want to check – you will get result_1
b. Basing on result_1 form dynamic query for the statements, which create/ check
inconsistency
String q1 = @"prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix ind: <urn:inds:>
prefix prop: <urn:prop:>
prefix class: <urn:class:>
prefix process: <urn:process:>
SELECT ?ind1 ?ind2
WHERE
{
?ind1 a owl:Class.
?ind2 a owl:Class.
?ind1 owl:disjointWith ?ind2.
}";

SparqlResultSet rs = (SparqlResultSet)kb.ExecuteQuery(q1);
String q2 = @"prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix ind: <urn:inds:>
prefix prop: <urn:prop:>
prefix class: <urn:class:>
prefix process: <urn:process:>
SELECT ?process1
WHERE
{
<" + rs[0]["ind1"].ToString() + @"> a ?process1.
<" + rs[0]["ind2"].ToString() + @"> a ?process1.
}";
SparqlResultSet r = (SparqlResultSet)kb1.ExecuteQuery(q2);
textBox1.Text += Environment.NewLine + "disjointWith Inconsistency in:" +
Environment.NewLine;
foreach (SparqlResult rs1 in r)
{
textBox1.Text += " disjointWith at ->" + rs1["process1"].ToString() +
Environment.NewLine;
}
21. RDFS CONTENT FOR INCONSISTENCY CHECKING TASK
a. rdfs:domain (of a property) – describes classes of triple’s subject when that
property is a predicate;
For a property one can define (multiple) rdfs:domain axioms. Syntactically,
rdfs:domain is a built-in property that links a property (some instance of the
class rdf:Property) to a class description. An rdfs:domain axiom asserts that
the subjects of such property statements must belong to the class extension
of the indicated class description.
b. rdfs:range (of a property) – describes classes of triple’s object when that
property is a predicate.
For a property one can define (multiple) rdfs:range axioms. Syntactically,
rdfs:range is a built-in property that links a property (some instance of the
class rdf:Property) to to either a class description or a data range. An
rdfs:range axiom asserts that the values of this property must belong to the
class extension of the class description or to data.
Example:
Axiom: :hasManufacturer rdfs:domain :Product.
●Fact: :iPhone :hasManufacturer :AppleCom
.●Inconsistency situations:
1) :iPhone a :Equipment
2)There is no triple “:iPhone a :Product”

22. OWL CONTENT FOR INCONSISTENCY CHECKING TASK


a. owl:one of
There are no individuals in specific class except of shown:
NineteenEightyFour a :Novel.
:AnimalFarm a :Novel.
:NovelsInStore a owl:Class;
owl:oneOf (:AnimalFarm:NineteenEightyFour).
b. owl:disjointWith
Specific classes do not have common individuals
:Car a owl:Class.
:Book a owl:Class.
:Car owl:disjointWith :Book.
c. owl:AllDisjointClasses
Just another way, you can write a class list instead of class pairs
:Car a owl:Class.
:Book a owl:Class.
:Person a owl:Class.
[ ] a owl:AllDisjointClasses; owl:members (:Book :Car :Person).
d. owl:propertyDisjointWith
There are no subject-object pair connected simultaneously by both disjoint
properties
:hasSon a owl:ObjectProperty.
:hasDaughter a owl:ObjectProperty.
:hasSon owl:propertyDisjointWith :hasDaughter.
e. owl:IrreflexiveProperty
It is impossible for every individual to be connected to itself by irreflexive
properties
:hasFriend a owl:ObjectProperty,
owl:IrreflexiveProperty.
f. owl:AsymmetricProperty
There are no subject-object pairs connected symmetrically by asymmetric
property
:hasParent a owl:ObjectProperty,
owl:AsymmetricProperty.

23. NEGATIVEPROPERTYASSERTION: APPLICATION


A negative property assertion as defined in the upcoming OWL 2 states that a
given individual i is never connected to a given individual j by a given
property expression P.

In other words, asserting that I is connected to j by P results in an inconsistent


ontology. In this sense this assertion can be considered as a constraint that should
not be violated.

:np1 a owl:NegativePropertyAssertion;
owl:sourceIndividual :Bill;
owl:assertionProperty :hasDaughter;
owl:targetIndividual :Susan .
:np2 a owl:NegativePropertyAssertion;
owl:sourceIndividual :Jack;
owl:assertionProperty :hasAge ;
owl:targetValue "53"^^xsd:integer.

We can activate and deactivate:

:np2 a owl:NegativePropertyAssertion;
owl:sourceIndividual :Jack;
owl:assertionProperty :hasAge ;
owl:targetValue "53"^^xsd:integer;
:hasState ”Active”;
:hasActivationCond :np1.
24. DOTNETRDF / OWLAPI / RDFLIB LIBRARIES USAGE
a. dotNetRDF:
- dotNetRDF is a .Net library written in C# designed to provide a simple but
powerful API for working with Resource Description Framework (RDF)
data. As such it provides a large variety of classes for performing all the
common tasks from reading & writing RDF data to querying over it.
-The Library is designed to be highly extensible and allow for users to add in
support for additional features (e.g. custom RDF Triple Stores) as required.
-The Library operates primarily at the level of Triples, Graphs and Triple
Stores and provides very limited support for Inference and no direct
support for OWL (see How To: Load OWL).
- The core classes of the Library can be found in the VDS.RDF namespace.
-Interfaces: INode(IBlankNode,ILiteralNode,IUriNode), IGraph, ITripleStore..

Example: Graph g = new Graph();Notation3Parser np = new Notation3Parser();


np.load(g,”path”);
b. owlAPI:
The OWL API is a Java API for creating, manipulating and serializing OWL
Ontologies.
 The latest version of the API supports OWL 2.
 It is available under Open Source licenses (LGPL and Apache).
The following components are included:
 An API for OWL 2 and an in-memory reference implementation
 RDF/XML parser and writer
 OWL/XML parser and writer
 OWL Functional Syntax parser and writer
 Turtle parser and writer
Example: Load Ontology From File1
OWLOntologyManager man = OWLManager.createOWLOntologyManager();
File file = new File("C:\\pizza.owl.xml");
OWLOntology o =man.loadOntologyFromOntologyDocument(file);
System.out.println(o);

c. Rdflib:
-RDFLib is a Python library for working with RDF, a simple yet powerful
language for representing information. Through this library, Python is one
of the main RDF manipulation languages.
-This library contains parsers/serializers for almost all of the known RDF
serializations, such as RDF/XML, Turtle, N-Triples, & JSON-LD.

Example: >>> from rdflib import Namespace


>>> SDO = Namespace("https://schema.org/")
>>> SDO.Person
https://schema.org/Person
>>> SDO['url']
https://schema.org/url
for subject, predicate, object_ in someGraph.triples((None,URIRef
("https://schema.org/name"), None)):
print("{} has name {}".format(s, o));
//https://schema.org/name

25. INDUCTION AND DEDUCTION


a. Induction – reasoning from the specific to the general
A process of reasoning (arguing) which infers a general conclusion
based on individual cases, examples, specific bits of evidence, and other
specific types of premises.
Guidelines for logical and valid induction:
1. When a body of evidence is being evaluated, the conclusion about
that evidence that is the simplest but still covers all the facts is the best
conclusion.
2. The evidence needs to be well-known and understood.
3. The evidence needs to be sufficient. When generalizing from a
sample to an entire population, make sure the sample is large enough
to show a real pattern.
4. The evidence needs to be representative. It should be typical of the
entire population being generalized.

b. Deduction – reasoning from the general to the specific


A process of reasoning that starts with a general truth, applies that
truth to a specific case (resulting in a second piece of evidence), and
from those two pieces of evidence (premises), draws a specific
conclusion about the specific case.
Example: Free access to public education is a key factor in the success
of industrialized nations like the United States. (major premise) India is
working to become a successful, industrialized nation. (specific case)
Therefore, India should provide free access to public education for its
citizens. (conclusion) Thus, deduction is an argument in which the
conclusion is said to follow necessarily from the premise.
Guidelines for logical and valid deduction:
1. All premises must be true.
2. All expressions used in the premises must be clearly and consistently
defined.
3. The first idea of the major premise must reappear in some form as
the second idea in the specific case.
4. No valid deductive argument can have two negative premises.
5. No new idea can be introduced in the conclusion

26. KNOWLEDGE INFERENCE TASK AND ALGORITHM


Knowledge inference refers to acquiring new knowledge from existing facts based
on certain rules and constraints. One way of representing these rules and
constraints is through the use of logic rules, formally known as knowledge
representation.

Tasks
rdfs:label : is an instance of rdf:Property that may be used to provide a human-
readable version of a resource's name.
rdfs:comment : A description of the subject resource
rdfs:subClassOf : The property rdfs:subClassOf is an instance of rdf:Property that
is used to state that all the instances of one class are instances of another. A triple
of the form: C1 rdfs:subClassOf C2. states that C1 is an instance of rdfs:Class , C2
is an instance of rdfs:Class and C1 is a subclass of C2.
owl:Class : Like RDF classes, every OWL class is associated with a set of
individuals, called the class extension. The individuals in the class extension are
called the instances of the class. A class has an intensional meaning (the
underlying concept) which is related but not equal to its class extension.

owl:ObjectProperty: DatatypeProperty and ObjectProperty, describe what kind


of values a triple with the property should have object properties relate
individuals to other individuals. hasMother would be an object property, since a
mother is another individual.
owl:DatatypeProperty :. Datatype properties relate individuals to literal data
(e.g., strings, numbers, datetimes, etc.). Something like hasAge would typically be
a datatype property, since an age is a number,

Algorithm
1. Query from knowledge base the rule you want to run to get new
knowledge – you will get result_1
2. Basing on result_1 form dynamic query for the statements, which can be
used to create new triples

27. RDFS CONTENT FOR KNOWLEDGE INFERENCE TASK


rdfs:subClassOf
rdfs:subPropertyOf
Examples: :Robot rdfs:subClassOf :Equipment.
:hasManufacturer rdfs:subPropertyOf :hasCreator.
rdfs:domain (of a property) – describes classes of triple’s subject when that
property is a predicate;
rdfs:range (of a property) – describes classes of triple’s object when that property
is a predicate.
Examples:
:hasManufacturer rdfs:domain :Product.
:hasManufacturer rdfs:range :Enterprise.
Axiom:
:hasManufacturer rdfs:domain :Product.
Fact:
:iPhone :hasManufacturer :AppleCom.
We can get new statement:
:iPhone a :Product

28. OWL CONTENT FOR KNOWLEDGE INFERENCE TASK

A. owl:SymmetricProperty
A symmetric property is a property for which holds that if the pair (x,y) is an
instance of P, then the pair (y,x) is also an instance of P. Syntactically, a
property is defined as symmetric by making it an instance of the built-in OWL
class owl:SymmetricProperty, a subclass of owl:ObjectProperty.
A popular example of a symmetric property is the friendOf relation:
If p(a,b) then p(b,a)
:hasFriend a owl:ObjectProperty
owl:SymmetricProperty.

B. owl:TransitiveProperty
When one defines a property P to be a transitive property, this means that if
a pair (x,y) is an instance of P, and the pair (y,z) is also instance of P, then we
can infer the the pair (x,z) is also an instance of P.
Syntactically, a property is defined as being transitive by making it an
instance of the the built-in OWL class owl:TransitiveProperty, which is
defined as a subclass of owl:ObjectProperty.
If p(a,b) and p(b,c) then p(a,c)
:isPartOf a owl:ObjectProperty,
owl:TransitiveProperty.
C. owl:inverseOf
Properties have a direction, from domain to range. In practice, people often
find it useful to define relations in both directions: persons own cars, cars are
owned by persons. The owl:inverseOf construct can be used to define such
an inverse relation between properties.
Syntactically, owl:inverseOf is a built-in OWL property with owl:ObjectProperty as its
domain and range. An axiom of the form P1 owl:inverseOf P2 asserts that for every pair (x,y)
in the property extension of P1, there is a pair (y,x) in the property extension of P2, and vice versa.
Thus, owl:inverseOf is a symmetric property.

D. owl:propertyChain
Z is the composition of properties x and y:
If x(a,b) and y(b,c) then z(a,c)
:chain1 rdfs:subPropertyOf :hasUncle;
owl:propertyChain(:hasFather :hasBrother ) .

E. owl:unionOf
The owl:unionOf property links a class to a list of class descriptions. An
owl:unionOf statement describes an anonymous class for which the class
extension contains those individuals that occur in at least one of the class
extensions of the class descriptions in the list.
Individual of each class from list (object of the rule) is also individual of
class (subject of the rule)
:Book a owl:Class.
:Novela owl:Class.
:Poetry a owl:Class.
:Book owl:unionOf (:Novel :Poetry).
F. owl:intersectionOf
The owl:intersectionOf property links a class to a list of class descriptions. An
owl:intersectionOf statement describes a class for which the class extension
contains precisely those individuals that are members of the class extension
of all class descriptions in the list.
Individual of simultaneously all the classes from list (object of the rule) is
also individual of class (subject of the rule)
:Book a owl:Class.
:ThingsInStore a owl:Class.
:BooksInStore a owl:Class;
owl:intersectionOf ( :Book :ThingsInStore).
G. owl:FunctionalProperty
A functional property is a property that can have only one (unique) value y
for each instance x, i.e. there cannot be two distinct values y1 and y2 such
that the pairs (x,y1) and (x,y2) are both instances of this property. Both
object properties and datatype properties can be declared as "functional".
For this purpose, OWL defines the built-in class owl:FunctionalProperty as a
special subclass of the RDF class rdf:Property.
Functional property means the only object of statement.
:hasDeveloper a owl:ObjectProperty,
owl:FunctionalProperty.

H. owl:equivavalentClass
A class axiom may contain (multiple) owl:equivalentClass statements.
owl:equivalentClass is a built-in property that links a class description to
another class description. The meaning of such a class axiom is that the two
class descriptions involved have the same class extension (i.e., both class
extensions contain exactly the same set of individuals).
:Class1 owl:equivalentClass :Class2.

I. owl:sameAs
The built-in OWL property owl:sameAs links an individual to an individual.
Such an owl:sameAs statement indicates that two URI references actually
refer to the same thing: the individuals have the same "identity".
:ind1 owl:sameAs :ind2.

29. PROPERTIES TYPES FOR INCONSISTENCY CHECKING OR


KNOWLEDGE INFERENCE
rdfs:domain
a. describes classes of triple’s subject when that property is a predicate;
For a property one can define (multiple) rdfs:domain axioms. Syntactically,
rdfs:domain is a built-in property that links a property (some instance of the class
rdf:Property) to a class description. An rdfs:domain axiom asserts that the
subjects of such property statements must belong to the class extension of the
indicated class description.
rdfs:range
a. describes classes of triple’s object when that property is a predicate.
For a property one can define (multiple) rdfs:range axioms. Syntactically,
rdfs:range is a built-in property that links a property (some instance of the class
rdf:Property) to either a class description or a data range. An rdfs:range axiom
asserts that the values of this property must belong to the class extension of the
class description or to data values in the specified data range.
owl:propertyDisjointWith
There are no subject-object pair connected simultaneously by both disjoint
properties
:hasSon a owl:ObjectProperty.
:hasDaughter a owl:ObjectProperty.
:hasSon owl:propertyDisjointWith :hasDaughter.
owl:IrreflexiveProperty
It is impossible for every individual to be connected to itself by irreflexive
properties
:hasFriend a owl:ObjectProperty,
owl:IrreflexiveProperty.
owl:AsymmetricProperty
There are no subject-object pairs connected symmetrically by asymmetric property
:hasParent a owl:ObjectProperty,
owl:AsymmetricProperty.
30. NEURAL NETWORK / FORMULAE AND ITS DESCRIPTION IN
KNOWLEDGE BASE

 neural network (NN) component – is used to run NN (for classification or


for finding special patterns) and to train NN;
 We can use neural network for getting rules.
 formulae component – is used to run formulae (to compute), to parse
formulae, to change them and to save;
 We use formulae in order to make the system more convenient. Every
formula can be changed at any moment. A variable can be calculated using
different formula in different conditions.
Rules getting
●Neural training and machine learning
●Induction (using the hypotheses)
●Getting from another agent
●Rules activation
Neural getting
Unsupervised neural training
●We do not show correct answers, do not set rules
●Networks automatically form the neural classification rules, actually: experience
generalization
Unsupervised machine learning finds all kind of unknown patterns in data
Unsupervised learning is a machine learning technique, where you do not
need to supervise the model
Reinforcement learning
This kind of machine learning can do without neural networks
●We should specify the goal for learning
●A system learns the action methods (rules), best leading to the goal
Reinforcement learning architecture that enables software-defined agents to
learn the best actions possible in virtual environment in order to attain their goals.
Rules receiving
●We need to receive also the information about the form of the rule we are being
sent
●We also need to create the handler of the rule. This handler should provide fast
knowledge base integration of the rule
Rules activation
●Knowledge base can contain the rules, but their state can be deactivated
Activation methods:
●The result (message) from neural network activates rule
●A fact in KB and a rule in KB activate another rule
Activation (NN)
●Neural network returns a message (for example, current state evaluation)
●Knowledge base contains a list of those messages and rules about actions
required in case of the messages receiving (for example, activate some rules)
31. DATABASE AND ITS DESCRIPTION IN KNOWLEDGE BASE

Data base (DB) management system – is used to store data (for example, from
sensors), query, to check, to modify DB, to save changes; to find relations between
data and to understand the characteristics of the data.

32. SWIMLANES AND SEQUENCE DIAGRAMS APPLICATION

A swimlane diagram is a type of flowchart that describes who does what in a


process. Using the metaphor of lanes in a pool, a swimlane diagram provides
clarity and accountability by placing process steps within the horizontal or vertical
“swimlanes” of a particular employee, work group or department.

UML Sequence Diagrams are interaction diagrams that detail how operations are
carried out. They capture the interaction between objects in the context of a
collaboration. Sequence Diagrams are time focus and they show the order of the
interaction visually by using the vertical axis of the diagram to represent time what
messages are sent and when.

-A sequence diagram shows object interactions arranged in time sequence.


-It depicts the objects and classes involved in the scenario and the sequence of
messages exchanged between the objects needed to carry out the functionality of
the scenario.
-Sequence diagrams are sometimes called event diagrams or event scenarios.
Purpose of Sequence Diagram

 Model high-level interaction between active objects in a system


 Model the interaction between object instances within a collaboration that realizes a use case
 Model the interaction between objects within a collaboration that realizes an operation
 Either model generic interactions (showing all possible paths through the interaction) or specific
instances of a interaction (showing just one path through the interaction)

33. DBPEDIA KNOWLEDGE BASE AND ITS APPLICATION

DBpedia structured information resembles an open knowledge graph (OKG) which is


available for everyone on the Web

DBpedia knowledge base are playing an increasingly important role in enhancing the
intelligence of Web and enterprise search and in supporting information integration.
The DBpedia knowledge base allows you to ask quite surprising queries against Wikipedia
34. FACTS AND RULES

Fact – statement on properties of specific entity

Fact checking is the task of determining if a given claim holds. Several algorithms
have been developed to check facts with reference information in the form of
knowledge bases.

Rule – statement on properties of the set of entities, having specific features

The knowledge base contains the domain. Knowledge useful for problem solving.
In a rule- based expert system, the knowledge is represented as a set of rules. Each
rule specifies a relation, recommendation, directive, strategy or heuristic and has
the IF (condition) THEN (action) structure.

Rules application
● Knowledge base inconsistency checking
● New facts inference
● Making decision related with actions (classification, control, monitoring...)
● Experiments running
● Inference / checking / changing of other rules
● Rules activation

35. RULES APPLICATION WITHIN KNOWLEDGE BASED SYSTEMS

Rules application
● Knowledge base inconsistency checking
● New facts inference
● Making decision related with actions (classification, control, monitoring...)
● Experiments running
● Inference / checking / changing of other rules
● Rules activation
Rules for inconsistency checking:
:hasManufacturer a owl:ObjectProperty,
owl:IrreflexiveProperty.
●Rules for fact inference:
:isPartOf a owl:ObjectProperty,

owl:TransitiveProperty .
36. SEMANTIC WEB RULES

Rules representation
●Semantic model:
axioms: RBox, TBox
others
A TBox is a set of “schema” axioms (sentences)
Doctor subset of person
R, called an Rbox, is a finite set of role inclusion axioms of the form R⊑S and transitive
role declarations of the form Trans(R), with R,S atomic roles
RBox is the set of axioms that describe the equivalence and subsumption between relations,
denoted by R=S and R c s respectively.

●Neural model - here the rules are implicitly encoded. It classifies some things
then it apply some implicit rule
●Program code part – here like IF –Else applied rules in program
●Text file part – Rules can be stored in text files also.
37. INDUCTION USAGE WITHIN KNOWLEDGE BASES

Induction (KB)
●We find statement (fact)
●Analyze other properties of the statement“s subject
●Suppose, that every individual having this property (or properties) also
correspond to the statement (like it is a general rule) – hypothesis
●Find facts, rejecting this hypothesis
●If they cannot be found, then the hypothesis is true until we find rejecting facts

38. INDUCTION USAGE WITHIN DATABASES

Induction (DB): Induction is a new kind of tool designed for understanding and
communicating relationships in data. Explore rows and columns, query to get
exactly what you want, and visualize that data in powerful ways.
●Choose several events / situations happened
●Suppose they have a causal relation (one is a consequence of another) or more
complex relation
●Look through the data archive, trying to find information, rejecting this
hypothesis
●If they cannot be found, then the hypothesis is true until we find rejecting facts

39. RULES RECEIVING IMPLEMENTATION


Rules receiving
●We need to receive also the information about the form of rule we are being sent
●We also need to create the handler of the rule. This handler should provide fast
knowledge base integration of the rule
-Knowledge base can contain the rules, but their state can be deactivated
Activation methods:
●The result (message) from neural network activates rule
●A fact in KB and a rule in KB activate another rule

40. RULES ACTIVATION USAGE (WITH NEURAL NETWORKS)

Knowledge base can contain the rules, but their state can be deactivated
Activation methods:
● The result (message) from neural network activates rule
● A fact in KB and a rule in KB activate another rule
Activation (NN)
●Neural network returns a message (for example, current state evaluation)
●Knowledge base contains a list of those messages and rules about actions
required in case of the messages receiving (for example, activate some rules)
Neural network returns the message about pressure fast increase
●Knowledge base contains a rule about rule5:
[] a test:RuleActivationReason;
test:keyText “Pressure fast increase”;
test:activatesRule test:rule5.
●SPARQL: which rule is activated by reason, having this text?

41. RULES ACTIVATION USAGE (WITH FACTS AND OTHER RULES)

Activation (fact)
●A fact in form of rdf:Statement is being activated (by some rule), for example
test:nonStability form in below:
Rules states storage
test:rule5 a test:Rule, rdf:Statement;
rdf:subject {if unstability exists};
rdf:predicate test:activates;
rdf:object test:rule6;
test:ruleStatus “deactivated”.
{if unstability exists} :
test:nonStability a test:State, rdf:Statement;
rdf:subject test:Equipment6
rdf:predicate test:h6sState
rdf:object test:unstableState;
test:statementStatus “deactivated”.
●Knowledge base contains the rule about rule5

:test:nonStability test:activatesRule test:rule5

●SPARQL: which rule should be activated by this fact?

You might also like