Presentation is loading. Please wait.

Presentation is loading. Please wait.

CobWeb – A Constraint Based Extension of XML

Similar presentations


Presentation on theme: "CobWeb – A Constraint Based Extension of XML"— Presentation transcript:

1 CobWeb – A Constraint Based Extension of XML
Srivatsava Shanker Sangeetha Raghavan Tim Mckernan Dr. Bharat Jayaraman

2 Motivation XML defines structure of websites using document type definitions (DTDs). Essentially, CobWeb = DTDs + Constraints Constraints specify semantic integrity conditions on the website, whereas DTDs specify syntactic ‘well-formedness’ and ‘validity’ conditions. CobWeb can be used for website specifications and also for B2B applications.

3 CobWeb Syntax Constraint_expr ::= [NOT] Constraint (Lop Constraint)*
Constraint_expr ::= [NOT] Constraint (Lop Constraint)* Lop ::= AND|OR Constraint ::= Complex_id (Rop Complex_id)* Rop ::= ge|gt|le|lt|= Complex_id ::= Simple_id(.Simple_id)* [:attribute| :href(Complex_id)] Simple_id ::= identifier | identifier ‘[‘ index ‘]’ Index ::= first | last | positive_integer Aggregate_constraint ::= Agg_term Rop Agg_term | constraint Agg_op (Complex_id) Agg_term ::= Complex_id | Agg_func ( Complex_id) Constraint ::= Complex_id (Rop Agg_func Complex_id)* Agg_op ::= Agg_func | Agg_pred Agg_func ::= SUM |AVE |COUNT Agg_pred ::= ASCENDING|DESCENDING Quantified constraint ::= [EVERY | EXIST] (x:Complex_id) Constraint_expr

4 Aggregate Constraints
Since many web pages contain collections of entities, we often wish to express a constraint in terms of the aggregate value of some collection. In the example below, we show a constraint that makes use of the average value of a set of student grades. <?xml encoding="US-ASCII"?> <!ELEMENT class (course, average, student+)> <!ELEMENT course (#PCDATA)> <!ELEMENT student (name, grade)> <!ELEMENT name (#PCDATA)> <!ELEMENT grade (#REAL)> <!ELEMENT average (#REAL)> <!CONSTRAINT (average = AVERAGE(student.grade))> The other Rop operators that are available are SUM, COUNT, etc.

5 Tree Structure of an XML document
class class.student[30].grade= “A-” course student “ CSE605” student[1] student[30] name grade name grade “ZsaZsa” “A-” “Aaron” “B+”

6 Quantified Constraints
<!CONSTRAINT (EXIST (x : Complex_id) constraint_expr)> <!CONSTRAINT (EVERY (x : Complex_id) constraint_expr)> <!ELEMENT member (name, rank)> <!ELEMENT name (#PCDATA)> <!ELEMENT rank (#INTEGER)> Every faculty member in the promotion committee must be a professor: <!ELEMENT promotion_committee (member*)> <!CONSTRAINT EVERY(x:hiring_committee.member.rank ) x = “professor”> At least one member of the Graduate Affairs Committee must be a graduate student: <!ELEMENT graduate_affairs (member*)> <!CONSTRAINT EXIST(x:graduate_affairs.member.rank) x = “graduate student”>

7 Inheritance <?Xml encoding="US-ASCII"?>
<!ELEMENT student (student-id,name, transcript)> <!ELEMENT transcript (student-id,course-list)> <!ELEMENT course-list (course-id,semester,grade)+> <!ELEMENT student-id (#PCDATA)> <!ELEMENT name (#PCDATA)> <!ELEMENT grade (#PCDATA)> <!ELEMENT semester (#PCDATA)> <!ELEMENT course-id (#PCDATA)> <!CONSTRAINT (student .transcript .course-list.course-id .grade!= ”F”)> <!ELEMENT TA :: student (work, stipend)> <!ELEMENT work (#PCDATA) default = ’grade students’> <!ELEMENT stipend (#REAL)> <!CONSTRAINT (TA.transcript.course-list.course-id.grade ge “B+”) > <!ELEMENT RA :: student (work, stipend)> <!ELEMENT work (#PCDATA) default = ’research project’> <ELEMENT stipend (#REAL)> <!CONSTRAINT (RA.transcript.course-list.course-id.grade ge “A-”) >

8 Online-Brochure CobWeb can be used as a solution to a common problem in websites: verifying data content and links across multiple, interconnected web pages.

9 <?xml encoding="US-ASCII"?>
<!ELEMENT toc (toc_section+, toc_loc)> <!ELEMENT toc_section (toc_description)> <!ATTLIST toc_section xmlns:xlink CDATA #FIXED " xlink:type (locator) #FIXED "locator" xlink:href CDATA #REQUIRED xlink:role CDATA #IMPLIED> <!ELEMENT toc_description (toc_number, toc_title)> <!ELEMENT toc_number (#INTEGER)> <!ELEMENT toc_title (#PCDATA)> <!ELEMENT toc_loc EMPTY> <!ATTLIST toc_loc xmlns:xlink CDATA #FIXED " xlink:type (locator) #FIXED "locator" xlink:href CDATA #REQUIRED xlink:role CDATA #FIXED "toc_loc" xlink:title CDATA #FIXED "Table of Contents"> <!CONSTRAINT (toc_section:href(section.toc_loc:href)=/toc_loc:href) > <!CONSTRAINT (toc_section.toc_description.toc_number = toc_section:href:(section.toc_description.toc_number))> <!CONSTRAINT (ASCENDING(toc_section.toc_description.toc_number)) >

10 <!ELEMENT section_data (#PCDATA)>
<!ELEMENT section (toc_description, section_data, toc_loc, prev_loc?, next_loc?)> <!ELEMENT section_data (#PCDATA)> <!ELEMENT prev_loc EMPTY> <!ATTLIST prev_loc xmlns:xlink CDAT #FIXED " xlink:type (locator) #FIXED "locator" xlink:href CDATA #REQUIRED xlink:role CDATA #FIXED "prev_loc" xlink:title CDATA #REQUIRED> <!ELEMENT next_loc EMPTY> <!ATTLIST next_loc xmlns:xlink CDATA #FIXED " xlink:role CDATA #FIXED "next_loc" <!CONSTRAINT ((section.prev_loc:href(section.toc_description.toc_number) + 1) = section.toc_description.toc_number)>  <!CONSTRAINT ((section.next_loc:href(section.toc_description.toc_number) - 1)

11 Simple Circuit Definition
<?xml encoding="US-ASCII"?> <!ELEMENT component > <!ATTLIST component voltage #REAL (#REQUIRED) current #REAL (#REQUIRED) resistance #REAL (#REQUIRED) > <!CONSTRAINT (voltage = current*resistance)> <!ELEMENT series::component (ser_comps)> <!ELEMENT ser_comps (component+)> <!CONSTRAINT voltage = SUM(ser_comps.component:voltage)> <!CONSTRAINT current = EVERY(ser_comps.component:current)> <!CONSTRAINT resistance = SUM(ser_comps.component:resistance)> <!ELEMENT parallel::component (par_comps)> <!ELEMENT par_comps (component+)> <!CONSTRAINT voltage = EVERY(ser_comps.component:voltage)> <!CONSTRAINT current = SUM(ser_comps.component:current)> <!CONSTRAINT 1/resistance = SUM(1/(ser_comps.component:resistance))> <!ELEMENT Battery > <!ATTLIST Battery voltage #REAL (#REQUIRED)>  <!ELEMENT connect (battery, component)> <!CONSTRAINT battery:voltage = component:voltage)> Here only some of the information is given by the XML document , the others are found out by solving constraints The circuit example illustrates how to construct series and parallel circuits, using attributes current, voltage and resistance. The constraints used in Parallel circuit- 1/R= 1/R1 +1/R2+… Series circuit- R=R1+R2+…

12 Conclusions and Status
CobWeb views the web as a database, and constraints help specify conditions for database integrity. New features include inheritance, aggregation, quantified constraints, etc. A prototype implementation of most of the CobWeb features has been developed using an extension of the IBM XML4J parser. Full implementation and applications under consideration.


Download ppt "CobWeb – A Constraint Based Extension of XML"

Similar presentations


Ads by Google