5
Fuzzy XML with Implementation Goran Pani´ c Ðure Jakši´ ca 87 23323 I ¯ doš Serbia [email protected] Miloš Rackovi´ c Faculty of Science Trg Dositeja Obradovi´ ca 4 21000 Novi Sad Serbia [email protected] Srdjan Škrbi´ c Faculty of Science Trg Dositeja Obradovi´ ca 4 21000 Novi Sad Serbia [email protected] ABSTRACT Standard XML format does not allow for imprecise or incom- plete values. This is one of the requests imposed on this for- mat by many real-word usages. Using fuzzy logic in order to introduce indefiniteness in XML has been researched in sev- eral different papers in the last decade. While these papers were mostly focused on setting up theories and the syntax, this paper has practical usage as its main goal. Application called ’Fuzzy XML editor’ was created and described in this research. This editor is intended to work with fuzzy XML and to support XSD and DTD schemas. Categories and Subject Descriptors H.4.m [Information Systems Applications]: Miscella- neous; D.2.8 [Software Engineering]: Metrics—Complex- ity measures, Performance measures General Terms Theory Keywords Applications, information sciences, fuzzy databases, infor- mation retrieval 1. INTRODUCTION XML (Extensible Markup Language) has revolutionized fields of data storage and transfer in the last decade. There are many positive sides to XML which made it de facto a standard for many different uses. Values stored in XML elements and attributes are absolutely in accordance with their definition. Also, the whole structure of XML file is predefined and non-changeable. However, in reality, most information comes in the form of imprecise or incomplete values (e.g. fast car, tall building). Storing imprecise in- formation is not one of the things standard XML supports. Fuzzy sets and fuzzy logic are theories used in many dif- ferent fields where the use and processing of imprecise and incomplete information were needed. Adding fuzzy logic on Corresponding author, tel. +381 64 289 8959 BCI’12, September 16–20, 2012, Novi Sad, Serbia. Copyright c 2012 by the paper’s authors. Copying permitted only for private and academic purposes. This volume is published and copyrighted by its editors. Local Proceedings also appeared in ISBN 978-86-7031-200-5, Faculty of Sciences, University of Novi Sad. top of standard XML would result in XML containing in- sufficiently defined and imprecise information. Several papers dated to previous decade can be found, discussing the use of fuzzy logic in defining XML indefinite- ness. However, the published papers focus mostly on set- ting up theories and defining syntax. There are only a small number of papers that deal with the implementation pro- cess and practical usage. Some simplistic implementations were presented, limited to a restricted set of instructions which often do not meet the needed functionality for any sort of practical use. Without practical usage, it is hard to get a clear view of actual possibilities of different theo- ries. Also, the performance and complexity of implementing seemingly good syntax solutions do not always have to be satisfactory. In order to overcome these problems, this pa- per focuses on practical solutions in real-world environment. This is achieved by implementing to a level of usable ap- plications. For numerical computation, MATLAB (Matrix laboratory) software was used (for the sake of simplicity and good performance). MSSQL (Microsoft SQL Server) is used as underlying database with XQuery queries. Fuzzy priori- ties and thresholds will be used and implemented in XQuery queries for the first time. However, prioritized fuzzy XQuery is out of scope and will be left for a subsequent paper. Second chapter provides an overview of existing papers, in the field of fuzzy logic usage with XML. Chapter 3 ex- plains XML indefiniteness, presenting extended XSD (XML Schema Definition) and DTD (Document Type Definition) schemas for indefinite XML. The features of application specif- ically developed for this paper are presented in details in Chapter 4. 2. RELATED WORK Related research presented in this paper was conducted in the last five years at the University of Novi Sad. The main topic was implementation of system capable of using priority fuzzy logic with relational databases. In addition, complete fuzzy relational database application solution was designed and implemented [1, 2, 3]. The use of fuzzy logic in indefinite XML is an area where multiple papers have been presented in the last decade. Most influential research topics are: defining indefiniteness in XML values and defining indefiniteness in XML structure. For defining indefiniteness in XML structure usually XPath and XQuery languages were extended by the authors. Pre- sented solutions find elements in XML documents whose po- sitions are not exactly stated. Examples of such solutions are given in: [4, 5, 6, 7, 8, 9]. 58

Fuzzy XML with Implementation

Embed Size (px)

Citation preview

Page 1: Fuzzy XML with Implementation

Fuzzy XML with Implementation

Goran Panic∗

Ðure Jakšica 87 23323 IdošSerbia

[email protected]

Miloš RackovicFaculty of Science

Trg Dositeja Obradovica 421000 Novi Sad

[email protected]

Srdjan ŠkrbicFaculty of Science

Trg Dositeja Obradovica 421000 Novi Sad

[email protected]

ABSTRACT

Standard XML format does not allow for imprecise or incom-plete values. This is one of the requests imposed on this for-mat by many real-word usages. Using fuzzy logic in order tointroduce indefiniteness in XML has been researched in sev-eral different papers in the last decade. While these paperswere mostly focused on setting up theories and the syntax,this paper has practical usage as its main goal. Applicationcalled ’Fuzzy XML editor’ was created and described in thisresearch. This editor is intended to work with fuzzy XMLand to support XSD and DTD schemas.

Categories and Subject Descriptors

H.4.m [Information Systems Applications]: Miscella-neous; D.2.8 [Software Engineering]: Metrics—Complex-ity measures, Performance measures

General Terms

Theory

Keywords

Applications, information sciences, fuzzy databases, infor-mation retrieval

1. INTRODUCTIONXML (Extensible Markup Language) has revolutionized

fields of data storage and transfer in the last decade. Thereare many positive sides to XML which made it de facto astandard for many different uses. Values stored in XMLelements and attributes are absolutely in accordance withtheir definition. Also, the whole structure of XML file ispredefined and non-changeable. However, in reality, mostinformation comes in the form of imprecise or incompletevalues (e.g. fast car, tall building). Storing imprecise in-formation is not one of the things standard XML supports.Fuzzy sets and fuzzy logic are theories used in many dif-ferent fields where the use and processing of imprecise andincomplete information were needed. Adding fuzzy logic on

∗Corresponding author, tel. +381 64 289 8959

BCI’12, September 16–20, 2012, Novi Sad, Serbia.

Copyright c© 2012 by the paper’s authors. Copying permitted only for private and

academic purposes. This volume is published and copyrighted by its editors.

Local Proceedings also appeared in ISBN 978-86-7031-200-5, Faculty of Sciences,

University of Novi Sad.

top of standard XML would result in XML containing in-sufficiently defined and imprecise information.

Several papers dated to previous decade can be found,discussing the use of fuzzy logic in defining XML indefinite-ness. However, the published papers focus mostly on set-ting up theories and defining syntax. There are only a smallnumber of papers that deal with the implementation pro-cess and practical usage. Some simplistic implementationswere presented, limited to a restricted set of instructionswhich often do not meet the needed functionality for anysort of practical use. Without practical usage, it is hardto get a clear view of actual possibilities of different theo-ries. Also, the performance and complexity of implementingseemingly good syntax solutions do not always have to besatisfactory. In order to overcome these problems, this pa-per focuses on practical solutions in real-world environment.This is achieved by implementing to a level of usable ap-plications. For numerical computation, MATLAB (Matrixlaboratory) software was used (for the sake of simplicity andgood performance). MSSQL (Microsoft SQL Server) is usedas underlying database with XQuery queries. Fuzzy priori-ties and thresholds will be used and implemented in XQueryqueries for the first time. However, prioritized fuzzy XQueryis out of scope and will be left for a subsequent paper.

Second chapter provides an overview of existing papers,in the field of fuzzy logic usage with XML. Chapter 3 ex-plains XML indefiniteness, presenting extended XSD (XMLSchema Definition) and DTD (Document Type Definition)schemas for indefinite XML. The features of application specif-ically developed for this paper are presented in details inChapter 4.

2. RELATED WORKRelated research presented in this paper was conducted

in the last five years at the University of Novi Sad. Themain topic was implementation of system capable of usingpriority fuzzy logic with relational databases. In addition,complete fuzzy relational database application solution wasdesigned and implemented [1, 2, 3].

The use of fuzzy logic in indefinite XML is an area wheremultiple papers have been presented in the last decade. Mostinfluential research topics are: defining indefiniteness in XMLvalues and defining indefiniteness in XML structure.

For defining indefiniteness in XML structure usually XPathand XQuery languages were extended by the authors. Pre-sented solutions find elements in XML documents whose po-sitions are not exactly stated. Examples of such solutionsare given in: [4, 5, 6, 7, 8, 9].

58

Page 2: Fuzzy XML with Implementation

Most significant form of XML indefiniteness is the indef-initeness in XML values. For structural definitions of fuzzyXML documents, XML schemas are usually used. However,in some works schema graphs were used for the same pur-pose. Such examples are presented in: [10, 11, 12, 13, 14,15, 16].

XML documents are often stored into databases that sup-port XML. Papers related to this subject discuss extendingdatabase models by introducing fuzzy types or extending theSQL and XQuery syntax by using fuzzy elements. See moreon this topic in following papers: [17, 18, 19, 20, 21, 22, 23,24, 25].

In this paper implementation of indefiniteness in XMLvalues is researched. This assume definition of XML modelthat allows storing of fuzzy values. The main focus is on theimplementation of practical fuzzy XML applications.

3. FUZZY XML SYNTAXBest solutions presented in related works were combined

and new model for XML fuzzy data storage was developed.For instance, [6] describes the most general solution to theproblem of storage of fuzzy XML documents. To definedthe syntax for indefinite XML, XSD and DTD schemas areused. The focus of this paper was on the allowing fuzzyconstructs in XML element values. The indefiniteness inthe XML structure was out of scope for this paper and isleft for the future work.

Membership function is most important when it comes tofuzzy set usage. It is not an easy task to define membershipfunction, while its storage and processing leverage the levelof complexity of the implementation. There are two waysof building such solution. The first is that fuzzy set shouldinclude certain number of simple and well-known functiontypes (e.g. increasing, decreasing, triangular, trapezoidal).In choosing groups of fuzzy sets to implement, one needsto pay special attention to the choice of sets. The purposeis to cover as many real systems as possible. Still, regard-less of how many fuzzy sets are introduced, they are stillrestricted. So, cases whose functions are not described arestill unreachable to such solutions.

The second option is to define syntax which can modelthe fuzzy set. In this paper, this option was selected due toits versatility. XML is metalanguage, intended to offer ex-pandability, so there was no need to specifically change XMLlanguage syntax to support fuzzy logic. Still, in order to de-sign XML structure flexible enough to enable defining widevariety of fuzzy sets, there are certain conditions. These arepresented below.

For example, there is an XML element, <temperature>,which is undefined and is of a fuzzy type. The element cancontain an arbitrary number of<fuzzy> elements which rep-resent fuzzy sets. All fuzzy sets are uniquely named usingthe name attribute, such as <fuzzy name=”cold”>. Fuzzysets are further defined by <function> - membership func-tions which can vary in number. Membership functionscan be constrained by supplying minValue and maxValueattributes. As presented here: <function minValue=”0”maxValue=”10”>; this cannot overlap within a single fuzzyset. The default values of these attributes are maxValue:plus infinity, minValue: minus infinity. The value of the<function> element defines the membership function forcertain area defined by the minValue and maxValue at-tributes. In this value x is a variable that collects values

from given intervals. The level of membership is taken fromthe interval [0,1]. Text used to define the value has a stan-dardized format so that parser is able to transform it into thecorresponding mathematical function. For example, func-tions are defined as this: A*x + B . Membership will beset to zero if there are intervals with undefined membershipfunction.

The easiest way to define the previously described fuzzytype is to use some of the existing XML schemas. XSDschema which defines the described fuzzy type is presentedbelow. The element containing function describes part ofthe membership function limited by minValue and maxValueconstraints. The functions element classifies function partsinto a complex membership function. The fuzzy element is afuzzy set which is defined by a set of membership functions.Fuzzy XSD schema is presented in listing 1

Listing 1: XSD schema for fuzzy element1 <xs:schema id=”Fuzzy ” elementFormDefault=”

q u a l i f i e d ” xmlns:xs=”h t tp : //www.w3 . org /2001/XMLSchema”>

2 <xs:complexType name =”fuzzy ”>3 <xs : s e quenc e>4 <xs : e l ement name =”fuzzy ” minOccurs =”1”

maxOccurs =”unbounded” type=” func t i on s ”/>

5 </ x s : s e quenc e>6 </xs:complexType>7

8 <xs:complexType name =” func t i on s ”>9 <xs : s e quenc e>

10 <xs : e l ement r e f=”func t i on ” minOccurs =”1 ”maxOccurs=”unbounded”/>

11 </ x s : s e quenc e>12 <x s : a t t r i b u t e name=”name” type=” x s : s t r i n g ”/>13 </xs:complexType>14

15 <xs : e l ement name=” func t i on ”>16 <xs:complexType>17 <xs : s impleContent>18 <x s : e x t e n s i o n base=” x s : s t r i n g ”>19 <x s : a t t r i b u t e name=”minValue” type=”

x s : s t r i n g ” />20 <x s : a t t r i b u t e name=”maxValue” type=”

x s : s t r i n g ” />21 </ x s : e x t e n s i o n>22 </ xs : s impleContent>23 </xs:complexType>24 </ xs : e l ement>25 </xs:schema>

So, by referencing Fuzzy.xsd schema in a XML documentand using Fuzzy type for element type, indefinite fuzzy XMLcan be written. An example of this is given in listing 2.

Listing 2: Using Fuzzy XSD schema1 <?xml ve r s i on=”1 . 0 ” encoding=”utf−8”?>2 <xs:schema id=”Test ” elementFormDefault=” q u a l i f i e d

” xmlns:xs=”h t tp : //www.w3 . org /2001/XMLSchema”>3 <x s : i n c l u de schemaLocation =”Fuzzy . xsd ”/>4 <xs : e l ement name=”measurement”>5 <xs:complexType>6 <xs : s e quenc e>7 <xs : e l ement name=”name” type=” x s : s t r i n g ”/>8 <xs : e l ement name=” lo c a t i o n ” type=” x s : i n t ”/

>

9 <xs : e l ement name=”time ” type=”xs:dateTime”/>

10 <xs : e l ement name=”temperature ” type=”fuzzy”/>

11 </ x s : s e quenc e>12 </xs:complexType>13 </ xs : e l ement>14 </xs:schema>

59

Page 3: Fuzzy XML with Implementation

Same can be achieved by using other types of XML schemadocuments. Using DTD schema for the same task is pre-sented in listing 3.

Listing 3: DTD schema for fuzzy element1 <?xml ve r s i on=”1 . 0 ” encoding=”UTF−8”?>2 < !ELEMENT measurement ( temperature )>3 < !ELEMENT temperature ( fuzzy+)>4 < !ELEMENT fuzzy ( f unc t i on+)>5 < !ATTLIST fuzzy name CDATA #REQUIRED>6 < !ELEMENT func t i on (#PCDATA)>7 < !ATTLIST func t i on8 minValue CDATA #REQUIRED9 maxValue CDATA #REQUIRED>

Full example of fuzzy XML documents defined in accor-dance to presented syntax, storing air temperature measure-ments are given in listing 4.

Listing 4: Fuzzy XML example1 <measurement>2 <name>New s t a t i o n</name>3 <l o c a t i o n>41</ l o c a t i o n>4 <time>2012−02−03 10 : 30</ time>5 <temperature>6 <fuzzy name=”co ld ”>7 <f un c t i on maxValue=”0 ”>1</ func t i on>8 <f un c t i on minValue=”0 ” maxValue=”10 ”>−1/(Max

−Min)∗x + Max/(Max−Min)</ func t i on>9 </ fuzzy>

10 <fuzzy name=”hot ”>11 <f un c t i on minValue=”10 ” maxValue=”20 ”>1/(Max

−Min)∗x − Min/(Max−Min)</ func t i on>12 <f un c t i on minValue=”20 ”>1</ func t i on>13 </ fuzzy>14 </ temperature>15 </measurement>

The value of fuzzy elements can include real text, the socalled linguistic definitions. They start with a# sign. Thesevariables are predefined fuzzy sets. Example of such defini-tion can be found in listing 5.

Listing 5: Linguistic definition example1 <fuzzy name=”co ld ”>#Maybe</ fuzzy>

4. FUZZY XML EDITORApplication ’Fuzzy XML editor’ is implemented to demon-

strate practical aspect of working with fuzzy XML syntax.This application enables creation and working with fuzzyXML, XSD and DTD documents, and has been developedspecifically for the needs of this paper. Main applicationwindow is presented on figure 1.

.NET framework and WPF technology were used in imple-mentation of this application. Fuzzy XML tool componentsand their mutual relations are presented in figure 2.

The application consists of several logical modules orga-nized according to the MVVM (Model View View-Model)pattern and its principles.

The Data layer is the lowest level, dealing with the datastorage. The storage options are: text files (file systemcomponent) and database (database component). MicrosoftSQL server 2008 R2 support was implemented in order towork with the database. Its potential for working with XMLis extended by fuzzy elements.

TheModel layer contains several components, where eachhas a task to communicate with certain object types. TheXML model supports working with fuzzy XML objects, while

Figure 1: Fuzzy XML editor.

the DTD and XSD models are in charge of working withfuzzy XML schemas. The XQuery model implements work-ing with fuzzy XQuery, and includes the support for priori-ties and thresholds. However, fuzzy XQuery is out of scopeof this paper. Each of the components can implement thepart for working with the fuzzy syntax apart from workingwith the standard language syntax.

The View-Model layer makes it possible to communi-cate with the layer below and consists of several modules.The Command group classifies modules for working withcommands that implement interfaces for model approach.The Syntax Validation component enables validation of doc-ument syntax. The Fuzzy group enables working with mem-bership functions and fuzzy linguistic variables. The Fuzzygroup relies on the Matlab module which is an interface toexternal application - MATLAB. Calculations of the mem-bership level are done using MATLAB libraries.

The View layer is the last layer. It implements the userinterface, so that the user can perform functionalities definedin the Command group. The Main Window component isthe main application window which includes the user con-trols from the Controls group and enables calling of the otherindependent dialogue windows from the Dialogs group.

Executable version and other data of the application canbe found at http://www.is.pmf.uns.ac.rs/fuzzydb.

5. CONCLUSIONThis paper successfully unites the process of defining syn-

tax and implementing it. An application solution that en-ables usage of the fuzzy logic constructs with XML datahas been provided. Users are given a possibility to definethe arbitrary membership functions, and their computationis achieved in real time with the usage of the MATLABsoftware. The practical side of this implementation and itssatisfactory performance has been demonstrated.

The presented application solution will be a basis for fur-ther development of XML indefiniteness. In future work,definition and implementation of the fuzzy XQuery inter-preter that allows the usage of priorities is planned. Also,the emphasis of future work is on improving the imple-mented functionalities and the syntax, further improvementof the performance and finally, introduction of indefinitenessin the XML structure.

60

Page 4: Fuzzy XML with Implementation

Figure 2: Application component block diagram.

6. ACKNOWLEDGMENTResearch was partially supported by the Ministry of Sci-

ence and Technological Development of Republic of Serbia,through project no. OI-174023 ’Intelligent techniques andtheir integration into wide-spectrum decision support’.

7. REFERENCES[1] S. Skrbic, M. Rackovic, and A. Takaci. The PFSQL

query execution process. Novi Sad J. Math,41(2):161–179, 2011.

[2] A. Takaci, and S. Skrbic. Data Model of FRDB withdifferent data types and PFSQL, in: J. Galindo (Ed.).Handbook of research on fuzzy information processingin databases, Information Science Reference, Hershey,PA, pages 407–434. 2008.

[3] S. Skrbic, M. Rackovic, and A. Takaci. Towards themethodology for development of fuzzy relationaldatabase applications. Comput. Sci. Inf. Syst.8(1):27–40, January 2011.

[4] A. Campi, E. Damiani, S. Guinea, S. Marrara, G. Pasi,and P. Spoletini. A fuzzy extension for the XPathquery language, J. Intell. Inf. Syst. 33:285–305,December 2009.

[5] E. Damiani, S. Marrara, and G. Pasi. FuzzyXPath:Using fuzzy logic an IR features to approximately queryXML documents, in: Proc. 12th Int. Fuzzy Syst.Assoc., Cancun, Mexico, pages 199–208. 2007.

[6] L. Yan, Z.M. Ma, and J. Liu. Fuzzy data modelingbased on XML schema, in: Proc. ACM Symp. Appl.Comput. New York, USA, pages 1563–1567. 2009.

[7] Z.M. Ma, J. Liu, and L. Yan. Fuzzy data modeling andalgebraic operations in XML. Int. J. Intell, Syst.25(9):925–947, September 2010.

[8] E.J.F. Thomson, and G.Radhamani. Fuzzy logic basedXQuery operations for native XML database systems.Int. J. Database Theor. App. 2(3):13–20, September2009.

[9] A. Lo, K. Kianmehr, M. Kaya, and R. Alhajj. WrappingVRXQuery with self-Adaptive fuzzy capabilities, in:Web Intelligence, IEEE/WIC/ACM Inter. Conf.Fremont, CA, pages 750–756. November 2007.

[10] B. Oliboni, and G. Pozzani. Representing Fuzzyinformation by using XML schema, in: Database andExpert Systems Application. DEXA Proc. 19th Inter.Conf. Database Expert Syst. App., Turin, Italy, pages683–687. September 2008.

[11] W. Hailong, Z.M. Ma, Y. Li, and C. Jingwei. A unifiedformalism for fuzzy data types representation, in:FSKD ’08. Fifth Inter. Conf., Shandong, China, pages167–171. October 2008.

[12] H. Enrique, P. Eduardo, J.M. Jose, A. Sergio, and A.Karina. A fuzzy linguistic model to evaluate the qualityof Web sites that store XML documents. Int. J.Approx. Reason. 46(1):226–253, January 2007.

[13] T. Chris, K. Wafa, and V. Toan. Universal fuzzysystem representation with XML. Comp. Stand. Inter.28(2):218–230, December 2005.

[14] C. Combi, B. Oliboni, and R. Rossato. Evaluatingfuzzy association rules on XML documents, in:Computational Intelligence, Theory and Applications,Advances in Soft Computing 33, Springer, Heidelberg,pages 435–448. 2005.

[15] E. Damiani, B. Oliboni, and L. Tanca. Fuzzytechiques for XML data smushing, in: Proc. Inter.Conf. 7th Fuzzy Days Computational Intell., Theor.App., Dortmund, Germany, pages 637–652. 2001.

[16] E. Damiani, L. Tanca, and F.A. Fontana. Fuzzy XMLqueries via context-based choice of aggregations.Kybernetika. 36(6):635–655, 2000.

[17] J. Seto, S. Clement, D. Duong, K. Kianmehr, and R.Alhajj. Fuzzy query model for XML documents. Lect.Notes Comput. Sc. 5788, pages 333–340. 2009.

[18] J. Ying, and S. Shidlagatta. A framework of fuzzytriggers for XML database systems, in: Proc. Inform.Reuse Integrat. IEEE International Conference, LasVegas, USA, pages 296–299. August 2009.

[19] A. Chan, N. Situ, K. Wong, K. Kianmehr, and R.Alhajj. Fuzzy querying of nested XML, in: Proc.Inform. Reuse Integrat. IEEE Inter. Conf. Las Vegas,USA, pages 238–243. July 2008.

[20] R.D. Rodrigues, A.J.O. Cruz, and R.T. Cavalcante. Aproposal for a fuzzy database architecture incorporatingXML. Fuzzy Set. Syst. 160(2):269–279, January 2009.

[21] G. Abhishek, and A. Reda. Incorporating fuzziness inXML and mapping fuzzy relational data into fuzzyXML, in: Proc. ACM Symp. Appl. Comput. New York,USA, pages 456–460. 2006.

[22] C.D. Barranco, J.R. Campana, J.M. Medina, Towardsa XML fuzzy structured query language, in: Proc.EUSFLAT Conf., Barcelona, Spain, pages 1188–1193.2005.

61

Page 5: Fuzzy XML with Implementation

[23] Z.M. Ma. Fuzzy database modeling with XML.Springer, New York, February 2005.

[24] Z.M. Ma, L. Yan, and F. Zhang. Modeling fuzzyinformation in UML class diagrams and object-orienteddatabase models. Fuzzy Set. Syst. 186(1):26–46,January 2012.

[25] M. Koyuncu. Intelligent fuzzy queries for multimediadatabases. Int. J. Intell. Syst. 26(10):930–951, Jul 2011.

62