expressive query answering for semantic wikis (20min)

22
Expressive Query Answering For Semantic Wikis Jie Bao, Rensselaer Polytechnic Institute [email protected], http://www.cs.rpi.edu/~baojie

Upload: jie-bao

Post on 19-Jan-2015

1.649 views

Category:

Technology


3 download

DESCRIPTION

A 20 minutes version of the talk

TRANSCRIPT

Page 1: Expressive Query Answering For  Semantic Wikis (20min)

Expressive Query Answering For Semantic Wikis

Jie Bao, Rensselaer Polytechnic Institute

[email protected], http://www.cs.rpi.edu/~baojie

Page 2: Expressive Query Answering For  Semantic Wikis (20min)

Semantic Wiki as a Data Store

May 10, 20112

Wiki DB Triple Store Online dataData Layer

Map Data EvaluationPublication

Management

Still many not yet

mentioned…

Wiki Layer

App.Layer

(Semantic) Wiki Scripting

Semantic Template

Semantic Query

(PHP, Javascript) Wiki Extensions

HaloExtension

Parser Function

Concept Modeling: RDF, Relational Modeling, Rules

Semantic Forms

ProjectManagement

Remote SemWiki

Group Info. Management

Page 3: Expressive Query Answering For  Semantic Wikis (20min)

Semantic Media Wiki (SMW) Low-cost solution for light-weight semantic

applications Dozens of extensions to build apps.

Integrated environment for modeling and querying SMW-ML (Modeling language):

subclass/subproperty SMW-QL (Query language): disjunctive query

with subquery

(detailed SMW expressivity in the backup slides)May 10, 20113

Page 4: Expressive Query Answering For  Semantic Wikis (20min)

However, we often need more expressivity

Modeling Inverse property: “has author” <-> “author of” Transitive property: “part of” …

Query Negation: find cities that are not capitals Counting: find professors who advise more than 5

students

May 10, 20114

Page 5: Expressive Query Answering For  Semantic Wikis (20min)

Desired Expressivity Balance between expressiveness and

simplicity

Modeling Language: OWL Prime [1]

rdfs:subClassOf, subPropertyOf, domain, range owl:TransitiveProperty, SymmetricProperty,

FunctionalProperty, InverseFunctionalProperty, inverseOf owl:sameAs, equivalentClass, equivalentProperty

Query Language: SMW-QL, plus Negation as failure Cardinality (aggregation) May 10, 20115

[1] http://www.w3.org/2007/OWL/wiki/OwlPrime

Page 6: Expressive Query Answering For  Semantic Wikis (20min)

Formalization

Note: Semantic Wiki is NOT an open world (as oppose to OWL)

Formalizing OWL Prime with CWA using datalog Descriptive, closed-world semantics Well-understood complexity and mature tool

support

May 10, 20116

Page 7: Expressive Query Answering For  Semantic Wikis (20min)

SMW-ML+

[[Domain::C]] [[Range::C]] [[Type::Transitive]] [[Type::Symmetric]] [[Type::Functional]] [[Type::InverseFuncti

onal]] [[Inverse of::Q]]

C(x) :- P(x,y) C(y) :- P(x,y) P(x,y) :- P(x,z), P(z,y) P(x,y) :- P(y,x) SameAs(x,y) :-

P(z,x),P(z,y) SameAs(x,y) :-

P(x,z),P(y,z) Q(x,y) :- P(y,x)

May 10, 20117

On page “Property:P”

Not

owl:sameAs!

Page 8: Expressive Query Answering For  Semantic Wikis (20min)

Translation Rules for SMW-QL

{{#ask: [[Category:City]] [[capital of::+]] }}

result(x) :- City(x), capital_of(x, y) .

May 10, 20118

Other constructs: for conjunction, disjunction, subquery, property chain etc, see backup slides

Page 9: Expressive Query Answering For  Semantic Wikis (20min)

SMW-QL+ : Negations

{{#askplus: [[<>Category:C]] [[Category:D]]}}

{{#askplus: [[Category:C]] [[<>P::+]]}}

result(x) :- D(x), not C(x) .

result(x) :- C(x), #count{x: P(x,y)}<=0 .

Why not “C(x), not P(x,y)” ?

May 10, 20119

Page 10: Expressive Query Answering For  Semantic Wikis (20min)

SMW-QL+: (Non)qualified Cardinality

{{#askplus: [[>=3#P::+]]}}

{{#askplus: [[>=3#P::

<q>[[Category:D]]</q>]]

}}

result(x) :- thing(x),#count{x: P(x,y)}>=3 .

result(x) :- thing(x),#count{x: P(x,y),D(x)}>=3 .

May 10, 201110

For safeness

Page 11: Expressive Query Answering For  Semantic Wikis (20min)

Implementation Using DLV as the reasoner

Other LP solvers may be used as well

Two work modes File-based: reasoning based on a static dump

(snapshot) of wiki semantic data. Database-based:  reasoning based on a

shadow database via ODBC; Real-time changes of instance data will be updated.

Optimization Caching

May 10, 201111

Download: http://www.mediawiki.org/wiki/Extension:SemanticQueryPlus

Page 12: Expressive Query Answering For  Semantic Wikis (20min)

Example:

May 10, 201112

Inverse property

Transitive property

Caching

Page 13: Expressive Query Answering For  Semantic Wikis (20min)

Scalability: Data Complexity

Test machine: 2 * Xeon 5365 Quad 3.0GHz 1333MHz /16G / 2 * 1TB

Dataset: part of DBLP, 10,396 pages, 100,736 triplesMay 10, 201113

10k 20k 30k 40k 50k 60k 70k 80k 90k 100k0.0000.2000.4000.6000.8001.0001.2001.400

Query time(s)Query time(s)

Dataset size (triples)

Almost linear

{{#askplus: [[Category:Person]] }}

Page 14: Expressive Query Answering For  Semantic Wikis (20min)

Scalability: Query Complexity

1 2 3 4 5 6 7 8 9 100.000

0.200

0.400

0.600

0.800

1.000

1.200

1.400

Query time(s)Query time(s)

Subquery depth

May 10, 201114

Almost constant

{{#askplus: [[Knows::<q>[[Knows::<q>[[Knows::<q>…</q>]]</q>]]</q>]] }}

Dataset: DBLP 100k triples

Page 15: Expressive Query Answering For  Semantic Wikis (20min)

The SemanticQueryRDFS++ extension

May 10, 201115

http://www.mediawiki.org/wiki/Extension:SemanticQueryRDFS++

Page 16: Expressive Query Answering For  Semantic Wikis (20min)

Some other work on SMW by us Semantic History – tracking provenance of

semantics http://www.mediawiki.org/wiki/Extension:SemanticHistory

Tetherless Map – query-based map generation http://www.mediawiki.org/wiki/Extension:Tetherless_Map

DBLP Import – bibtex to semantic wikihttp://www.mediawiki.org/wiki/Extension:DBLP_Import

Array Extension – operate on arrayshttp://www.mediawiki.org/wiki/Extension:ArrayExtension

RDFa Extension – RDFa <-> Wikihttp://www.mediawiki.org/wiki/Extension:ArrayExtension

Joint work with Li Ding, Jin Zheng, Rui Huang May 10, 201116

Page 17: Expressive Query Answering For  Semantic Wikis (20min)

Summary Formalizing SMW using datalog allows us to

extend SMW for an expressive subset of OWL. implement a SMW query engine that is scalable

good for typical uses. analyze the reasoning complexity of SMW (not

mentioned in the talk)

Future Work Incremental reasoning Customized reasoning rules SPARQL <-> SMW-QL+ translations

May 10, 201117

Page 18: Expressive Query Answering For  Semantic Wikis (20min)

Backup

May 10, 201118

Page 19: Expressive Query Answering For  Semantic Wikis (20min)

Expressivity (SMW 1.5.4) SMW-ML (Modeling Language)

category instantiation e.g., [[Category:C]] property instantiation e.g., [[P::v]] subclass, e.g., [[Category:C]] (on a category page) subproperty, e.g., [[Subpropety of:Property:P]] (on a property page)

SMW-QL (Query Language) conjunction: e.g., [[Category:C]][[P::v]] disjunction: e.g., [[Category:C]] or [[P::v]], [[A||B]] or [[P::v||w]] property chain: e.g., [[P.Q::v]] property wildcat: e.g., [[P::+]] subquery: e.g., [[P::<q>[[Category:C]]</q>]] inverse property e.g., [[-P::v]] value comparison, e.g. [[P::>3]][[P::<7]][[P::!5]]

May 10, 201119

Page 20: Expressive Query Answering For  Semantic Wikis (20min)

Translation Rules for SMW-ML

Subproperty Subclass Class instance Property instance Redirection

P(x,y) :- Q(x,y) .

C(x) :- D(x) . C(a) . P(a,b) . a=b.

May 10, 201120

Page 21: Expressive Query Answering For  Semantic Wikis (20min)

Translation Rules for SMW-QL

{{#ask: [[Category:A]][[p3::category:B]] or

[[p.p1.p2::<q>

[[Category:D]] or [[p1::<q>[[SomePage]]</q>]]

</q> ||!v ||<q>[[Category:E]]</q> ]]}}

result(x) :- _tmp0(x). _tmp0(x) :- A(x),

p3(x,x0), x0=category:B. _tmp0(x) :- p(x,x2),

p1(x2,x3), p2(x3,x1), _tmp9(x1).

_tmp9(x1) :- _tmp12(x1). _tmp12(x1) :- D(x1). _tmp12(x1) :- p1(x1,x4),

x4=SomePage. _tmp9(x1) :- thing(x), x !

=v. _tmp9(x1) :- E(x1).

Conjunction

Disjunction

Subquery

Inequality

Property chain

May 10, 201121

Page 22: Expressive Query Answering For  Semantic Wikis (20min)

Theoretical Complexity

May 10, 201122

SMW RDF

SMW-ML NL-complete • NP-complete;• P-complete for grounded graph [Bruijn and

Heymans 2007]SMW-ML+ NL-complete

SMW-QL P-complete• In L without subqueries

(SPARQL) P-complete [Perez et al 2006]

SMW-QL+ P-complete

Recall that L NL P NP