Professional Documents
Culture Documents
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”
: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.
: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..
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.
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.
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
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.
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.
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.
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 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.
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
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
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
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?
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