240 likes | 354 Views
Semantic Search -- Ask the World using your own vocabulary. Arping. Keyword search. Google. Outline. Review PIL 0.1 PIL 0.2 version Semantic Extractor and Dumper Semantic Search. 1.名稱不同. 2.位置不同. 3.語言不同. 4.結構不同. 5.意義不同. Review: Problem.
E N D
Semantic Search-- Ask the Worldusing your own vocabulary Arping
Keyword search Google
Outline • Review PIL 0.1 • PIL 0.2 version • Semantic Extractor and Dumper • Semantic Search
1.名稱不同 2.位置不同 3.語言不同 4.結構不同 5.意義不同 Review: Problem <private security=“L112481632”> <name> Yuh-Pyng Shieh </name> <father> YeFu Shieh </father></private> <客戶資料> <姓名> 謝育平 </姓名></客戶資料> <person sex=“male”> <security>L112481632</security> <name> <first_name>Yuh-Pyng </first_name> <last_name> Shieh </last_name> </name> <father> L186619019 </father> <brother> An Shieh </brother></person>
XML world Semantic Extraction Language Logic world Logic Programming Language Review: Meaning of a XML <person sex=“male”> <security>L112481632</security> <name> <first_name>Yuh-Pyng </first_name> <last_name> Shieh </last_name> </name> <father> L186619019 </father> <brother> An Shieh </brother></person> male(A).person(A).security(#”L112481632”).person(A).name(#”Yuh-Pyng Shieh”).father(z,A):-person(z).security(#”L186619019”).brother(x,A):- father(z,x), father(z,A), male(x), person(x).name(#”An Shieh”).
3 1 2 Review: Reasoning Framework
Review: PIL 0.1 G (node label data link) label(node#data).label(node#data) person(na1) na1#”L112481632” person(#”L112481632”) person(na1#”L112481632”) na1.na4 person(na1#”L112481632”).name(na4#”Yuh-Pyng Shieh”).last_name(na12#”Shieh”) person(na1)..last_name(na12)
Review: constraints on PIL 0.1 • Every node has at most one label and one datum. • This means each object belongs to only one class. • Unary relation and label are confusing. • Make them the same. • The sense of Object Oriented Concept is not strong.
PIL 0.2 M (node data link) Entity Relation Model unary(node#data).binary.unary(node#data) person(na1#”L112481632”) (na1#”L112481632”) person(#”L112481632”) person(na1) person() (na1) (#”L112481632”) () person(na1#”L112481632”).name(na4#”Yuh-Pyng Shieh”).last_name(na12#”Shieh”) person(na1#”L112481632”).has.name(na4#”Yuh-Pyng Shieh”).has.last_name(na12#”Shieh”) person(na1).majorin.university (na6) person(na1)..last_name(na12)
Binary Connector • A(x).M.B(y) • A(x), M(x,y), B(y) • A(x), A_M_B(x,y), B(y) • A(x)_M_B(y) • A(x), A_M_B(x,y), B(y) • A(x)-M-B(y) • A(x), M(x,y), B(y)
The syntax of PIL 0.2 (1/3) • The syntax is constructed by (NV,DV,P,DF, NC). • NV is a set of variables for nodes. • DV is a set of variables for data. • P is a set of basic predicates. (P2’,P0,P1,P2, …) • e1P1, e2, ef P2, P2’={u1_b_u2| bP2, u1,u2P1} • DF is a set of data functions. • NC is a set of node constant (0-ary function). • Then, we are going to construct four sets: • a data term set T, • an argument set G, • a connector set C, • an atom set A, • and a sentence set S by induction.
The syntax of PIL 0.2 (2/3) • xT, if xDV. • f(t1,t2,t3,…,tk)T, if fDF, tiT, and arity(f)=k. • n#t, n, #t, egG, if nNVNC, and tT. • n, #t, eg not in the right hand side of :- are shorthands of n#ed, nc#t, nc#ed where ed is the empty data and nc is a new node symbol for each appearance. • n, #t, eg in the right hand side of :- are shorthands of n#z, x#t, y#w where x,y are new node variables and z,w are new data variables. • eg can be skipped in syntax.
The syntax of PIL 0.2 (3/3) • .b. , _b_ , -b- C, if bP2 • .e2. can be shortened as . • .ef. Can be shortened as .. • .b. is either _b_ or -b- by preprocessing definition. • u1(g1)c1u2(g2)c2…uk(gk)A, if ui P1, ciC, giG. • It is a shorthand of ui(gi) and uiciui+1(gi,gi+1), if ci is of case _b_ • b(gi,gi+1), if ci is of case -b- • p(g1,g2,g3,…,gk)A, if pP, giG and arity(p)=k. • a1,a2,a3,…,ak.S, if aiA. • d1,d2,d3,…,dm:-a1,a2,a3,…,ak.S, if di, aiA. • s1 s2 s3 … sk is a program, if siS.
Denotational Semantics (1/3) • The universe U of a model M of a program is (DU,NU), where • DU is a set of nodes, • NU is a set of data. • is a simple substitution if maps node variables to DU and data variables to NU instead of any term in T. • M maps n in NV to nM in NU, x in DV to xM in DU, but M maps n to nM=(n) and x to xM=(x).
Denotational Semantics (2/3) • M maps x in DV to xM in DU. • M maps f(t1,t2,t3,…,tk) T to fM(t1M,t2M,t3M,…,tkM) in DU. • M maps y in NV to yM in NU. • M maps n in NC to nM in NU. • M maps p to be a set pM(NU#DU)k. • M maps n#t to nM#tM • M╞p(g1,g2,…,gk)If (g1M,g2M,…,gkM)pM.
Denotational Semantics (3/3) • M╞e1(g) if M╞u(g) for some uP1. • M╞ef(g1,g2) if • M╞e2(g1,g2) or • M╞ef(g1,g) and M╞e2(g,g2) for some g. • M╞e2(g1,g2) if M╞b(g1,g2) for some bP2. • M╞b(g1,g2) if M╞u1_b_u2(g1,g2) for some u1, u2 in P1. • M╞e1_b_u2(g1,g2) if M╞u1_b_u2(g1,g2) for some u1 in P1. • M╞u1_b_e1(g1,g2) if M╞u1_b_u2(g1,g2) for some u2 in P1. • M╞e1_b_e1(g1,g2) if M╞u1_b_u2(g1,g2) for some u1, u2 in P1. • M╞a1,a2,a3,…,ak.if for any simple substitution , M╞ai. • M╞d1,d2,d3,…,dm:-a1,a2,a3,…,ak.if for any simple substitution , • M╞di for all i or M does not satisfy ai for some i. • M╞s1 s2 s3 … sk if M╞si for all i.
Operational Semantics • We transform programs in PIL into programs in Prolog. • Un-skipping and un-shortening everywhere. • n, #t, eg, . .. .b. u1(g1)c1u2(g2)c2…uk(gk) • Transform n#t into n,t • We assume that each fDF is a embedded function in Prolog. • Put e1(n,t) :- u(n,t) for each u in P1. • Put ef(n1,t1,n2,t2):- e2(n1,t1,n2,t2). • Put ef(n1,t1,n2,t2):- ef(n1,t1,n,t), e2(n,t,n2,t2). • Put e2(n1,t1,n2,t2) :- b(n1,t1,n2,t2) for each b in P2. • Put b(n1,t1,n2,t2):-u1_b_u2(n1,t1,n2,t2) for each u1,u2 in P2. • Put e1_b_u2(n1,t1,n2,t2):-u1_b_u2(n1,t1,n2,t2) for each u1 in P2. • Put u1_b_e1(n1,t1,n2,t2):-u1_b_u2(n1,t1,n2,t2) for each u2 in P2. • Put e1_b_e1(n1,t1,n2,t2):-u1_b_u2(n1,t1,n2,t2) for each u1,u2 in P2.
Advantage • Use different connectors {.b. _b_ -b-} to identify exactly meaning of path expression. • Each object can belong to not only one class (unary relation) and can have more than one datum. • Each class (unary relation) has its own relation member (binary relation) and its own data member (unary relation). • Use default relations {e1,e2,ef} to do fuzzy reasoning. • Use default arguments {nc,ed,eg} to shorten the path expression and reach human’s intuition.
Name Space • We can make an ontology above ontologies to do reasoning. • Butterfly.pil Animal.pil • Above.pil may have a following rule. • Animal::butterfly(x) :- Butterfly::butterfly(x)
3 1 2 Reasoning Framework
Extractor and Dumper XML World <=> Logic World. private.sem #convert private.dtd into person.pil private(X).@security(#Y) <=> person(X).security(#Y). private(X).@sex(#”male”) <=> male(X). private(X).name(Z#Y), fetch(Y,”[[a-zA-Z]*/F] [[a-zA-Z]/A][[ ]*]”)=> person(X).name(Z).last_name(#A), Z.first_name(#F). private(X).tel(Z#Y), fetch(Y,”0[[0-9]/A]-[[0-9]*/N]-[[0-9]*/E]”)=> person(X).telephone(Z#Y).nation_code(#”886”), Z.area_code(#A), Z.number(#N), Z.extension(#E). private(X).advisor(#Y) => advisor_of(X,Z):-person(Z).name(#Y). private(X).father(#Y) => father_of(X,Z):-person(Z).security(#Y).
Semantic Search • Ontologies and extractors/dumpers are built for local reasoning, not for global Semantic Search Project (SSP). SSP just reuse their components.
來喔! 來討論喔!!! 每個星期一晚上八點 招兵買馬 我來了!! 等等我!!! 我只要有竹筍吃就好了!! 再說一次!! 我沒聽到!