Principles of Ontology Storage, Reasoning and Query. 马 力 MALLI@cn.ibm.com IBM China Research Lab. A Review of Previous Class. What we have learned about triple store? What reasoning algorithms did you learn before? What is SPARQL? How does it work?. Objectives of This Class.
01 / 118Principles of Ontology Storage, Reasoning and Query
1 / 17
Télécharger la présentation
Principles of Ontology Storage, Reasoning and Query
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation
Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement.Téléchargez la présentation en cliquant sur ce lien.Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.
A Review of Previous Class • What we have learned about triple store? • What reasoning algorithms did you learn before? • What is SPARQL? • How does it work?
Objectives of This Class • Master methods to store RDF and OWL data; • Learn optimization schemes for triple store; • Learn basic methods for ontology reasoning; • Learn schemes to scale up classic DL reasoner; • Learn a method to extend DLs with constraints; • Understand the semantics and complexity of SPARQL; • Learn a relational algebra for SPARQL • Learn how these three parts work together in a commercial system
Outline • Ontology Storage • Dimension table • Jena’s property table • Binary store vs Improved Generic Store • Ontology Reasoning • Rule Inference • Forward chaining • Backward chaining • An Efficient Scheme to scale up classic DL reasoner • A method to extend DLs with constraint • Ontology Query • Semantics and Complexity of SPARQL • Relational algebra for SPARQL • A Complete System: Oracle RDF Store
Triple Store: RDF Data Model • Data model for expressing knowledge • basic building block: statement <person001> <name> “Jeen” . • groups of statements form graphs name Jeen person001 email j.broekstra@tue.nl worksIn projectMemberEmail name project001 SOR
Triple Store: RDFS rdfs:Class • RDF Schema is a Vocabulary Description Language • it allows specification of domain vocabulary and a way to structure it • Class, Property, subClassOf, subPropertyOf, domain, range • Formal semantics add simple reasoning capabilities: • class and property subsumption • domain and range inference rdf:type rdf:Property Person rdf:type rdfs:domain rdfs:subClassOf name Researcher rdf:type person001
Triple Store: Generic Storage Model Triples table • A triple table of three relational columns, (Subject, Property, Object) • A Resource table to encode all URIs. • Features: • efficient in space • retrieval requires 3-way join Symbols table
Triple Store: Binary Storage Model • Each class and property has a separate table. • Features • Higher performance by avoiding a huge triple table. • An ontology with hundreds of thousands classes and properties creates overhead to RDBMS.
Jena’s Property Table A table that stores patterns of RDF statements • n-column prop table stores n-1 statements (1 col per prop) • Augments, doesn’t replace, triple store • Partitioned statements a statement is stored in TS or a prop table, never both • Partitioned properties all values for a given property are in TS or a prop table
Property Table • Advantages • efficiencies in storage and access • transparent to application • enables access to legacy relational tables (which can be modeled as property tables) • bridges the RDF-relational divide • Disadvantages • exhaustive search if property unknown (“Tony Blair”, -, -) • queries don’t compile to single SQL statement • loss of flexibility: fixed schema, typed property values
subject obj1 obj2 objn subject object type subject obj1 obj2 objn Types of Property Tables Single-valued property table–stores several single-valued properties for a subject Multi-valued property table–stores one multi-valued property for a subject Property-class table– stores class membershiprdf:type – only property allowed in multiple tables
Property Table Column Encoding Issue: how to encode values in columns? • Option1: Jena encoding or symbol id’s “::en:http://www.hp.com/ex#foo” or 1234 • Option2: native db encoding “foo” Choice: support both Option2 needed to access legacy database tables
Property Table Creation Property tables are • user-defined • sharable across graphs • created when graph is created • specified in a meta-graph (RDF stmts) table name, type, column descriptors, etc.
Storage Experiments • Experiments on the Avnet data set • T Box: 117 classes, 232 properties: 179 datatype/53 object properties • A Box: • First experiments performed on 1 millions products (25 millions triples) • Improve vertical storage • Leverage MDC (Multidimensional Clustering) of DB2 to reduce I/O cost and improve performances • Choose best indexes • Use of hash codes to improve string search. • Add binarytables for searchable attributes. • desktop computer, 2.66G Hz, 2G memory • New version of SOR tested with 4.2 millions products, representing by 120 millions of triples • IBM Blade Server, Intel Xeon 2.8 G Hz, 4G memory
Storage Experiments: Queries • Queries on properties • Q1: Retrieve one item according to its ID • SELECT * WHERE {?x test:PartKey '34389'} • Q2: Retrieve all items made by a given supplier • SELECT ?x WHERE {?x test:hasSupplier test:MUR} • Queries involving relationships • Q3: Retrieve all items whose parent item is made by a given supplier • SELECT * WHERE {?x test:hasParent ?y . ?y test:hasSupplier test:MUR} • Q4: Q3 and SOSCode !=‘S’ • SELECT * WHERE {?x test:hasParent ?y . ?y test:hasSupplier test:MUR . ?x test:SOSCode ?b FILTER (?b != 'S')} • Queries where predicate (property) is not defined • Q5: Retrieve all information about a given item • SELECT * WHERE {?x?y?z . ?x test:PartKey '34389'} • Q6: Retrieve all items and relationships to a given company • SELECT * WHERE {?x?y test:MUR} • Queries on the class structure • Q7: Retrieve all items belonging at the same time to category C1 and C2 • SELECT ?x {?x a test:C1 . ?x a test:C2} • Q8: Q7 and manufacturer != supplier • SELECT ?x {?x a test:C1 . ?x a test:C2 . ?x test:hasSupplier ?y . ?x test:hasManufacturer ?z FILTER (?y != ?z)}
Normal tables • Dimension tables Storage experiments: Value of dimensions • Few changes on simple query (Q1) which stays around 1 second Time (ms) No. of Individuals • Similar results for simple queries (e.g. one triple)
Normal tables • Dimension tables Storage experiments: Value of dimensions (2) • Large improvement on complex query with several joins (here example of Q4) Time (ms) No. of individuals
Impacts of binary tables • Define one table for every searchable attribute • (SubjectID, ObjectID, ObjectValue) • Binary tables very efficient when query involves only one property. • Binary tables also efficient when selectivity is high. • Dimensioned vertical table scales when the number of join increases.
Summary and Questions • Optimization of Triple Stores: • Jena’s property table • Multi-Dimensional clustering • Binary store vs Generic Store
Outline • Ontology Storage • Dimension table • Jena’s property table • Binary store vs Improved Generic Store • Ontology Reasoning • Rule Inference • Forward chaining • Backward chaining • An Efficient Scheme to scale up classic DL reasoner • A method to extend DLs with constraint • Ontology Query • Semantics and Complexity of SPARQL • Relational algebra for SPARQL • A Complete System: Oracle RDF Store
Rules and Inference • Rules are really statement in logic • About what we believe to be true • About what should occur • Form • IF antecedent THEN conclusion • IF condition THEN action • IF antecedent THEN goal • Interpreters • Backward chaining • Trigger on conclusion/goal • Forward chaining • Trigger on antecedent/condition
Forward Chaining • Rules • R1: IF may_rain THEN should_take_umbrella • R2: IF cloudy THEN may_rain • “What should I do if it is cloudy?” • “What do the rules indicate I should do if it is cloudy?” • Is there a rule that applies when it is cloudy? • R2: antecedent: cloudy • What do I conclude from that antecedent, ‘cloudy’ • R2: conclusion: may_rain • Is there a rule that applies when it may_rain? • R1: antecedent: may_rain • What do I conclude from that antecedent: ‘may_rain’ • R1: conclusion: should_take_umbrella
Forward Chaining Fact_1 Fact_1 Fact_2 Fact_2 Fact_3 rules Direction of reasoning Fact_3 Fact_4 Fact_4 Fact_5 Action=Fact_5
Forward Chaining • Fire any rule whose premises are satisfied in the KB. • Add its conclusion to the KB until query is found.
Backward Chaining • Motivation: Need goal-directed reasoning in order to keep from getting overwhelmed with irrelevant consequences • Main idea: • Work backwards from query q • To prove q: • Check if q is known already • Prove by backward chaining all premises of some rule concluding q
Backward Chaining • Rules • R1: IF may_rain THEN should_take_umbrella • R2: IF cloudy THEN may_rain • “Should I take an umbrella?” • “Do the rules indicate I should take an umbrella? • Is there a rule about “taking umbrellas”? • R1: goal: should_take_umbrella • How can I prove that goal? • What has to be true for r1 to hold? • may_rain is the antecedent of r1 • Can I prove that it may_rain? • R2: goal: may_rain • How can I prove that goal2 • What has to be true for r2 to hold • cloudy is the antecedent of r2 • How can I prove ‘cloudy’?
Backward Chaining Goal_1 Goal_2 Goal_2 Goal_3 rules Direction of reasoning Goal_3 Goal_4 Goal_4 Goal_5 Question
Backward Chaining • Rules • R1: IF may_rain THEN should_take_umbrella • R2: IF cloudy THEN may_rain • R3: IF may_be_intense_sun THEN should_take_umbrella • R4: IF summer AND in_tropics THEN may_be_intense_sun • “Should I take an umbrella?” • “Do the rules indicate I should take an umbrella? • Is there are rule about “taking umbrellas”? • R1: goal: should_take_umbrella • What is antecedent for r1? • R1:antecedent may_rain • Can I prove that it may_rain? • R2: goal: may_rain • How can I prove may_rain • R2:antecedent: cloudy • BUT NOT CLOUDY!
Backward Chaining: Backtracking • Rules • R1: IF may_rain THEN should_take_umbrella • R2: IF cloudy THEN may_rain • R3: IF may_be_intense_sun THEN should_take_umbrella • R4: IF summer AND in_tropics THEN may_be_intense_sun • “Should I take an umbrella?” • Are there any other rules about umbrellas? • R3: goal: should_take_umbrella • What is antecedent of R3? • R3:antecedent: summer AND in tropics