0% found this document useful (0 votes)
15 views6 pages

Sedna With Java

Sedna is an XML database that allows the creation of databases and collections to store XML documents. It provides various update statements for inserting, renaming, replacing, and deleting nodes and attributes, along with examples for each operation. Additionally, it outlines how to connect to the database using the Sedna Java API and execute queries while managing transactions.

Uploaded by

Jonah Arthur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views6 pages

Sedna With Java

Sedna is an XML database that allows the creation of databases and collections to store XML documents. It provides various update statements for inserting, renaming, replacing, and deleting nodes and attributes, along with examples for each operation. Additionally, it outlines how to connect to the database using the Sedna Java API and execute queries while managing transactions.

Uploaded by

Jonah Arthur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SEDNA XML DATABASEº

Favorites

Notebook Data Access

Tags

Last edited time @December 14, 2024 1:55 PM

Archive

Created time @December 8, 2024 9:00 PM

INTRODUCTION
Sedna allows the creation of databases that also holds collections in them. The
Collections can hold xml documents. In Sedna to find the path to your database
document the syntax goes by the following doc(’nameofDocument’,’nameofcollection’)

doc('[Link]','economia')

Update Statements In Sedna


Insert - One or various nodes into one or more various
nodes

update insert (nodeAInserir | seqüènciaNodes)


(into | following | preceding) onInserir

SEDNA XML DATABASEº 1


In case of sequence of nodes, each must go between parenthesis separated by
commas.
Example: Insert A Node

update insert (
<dept codi="d50">
<nom>RRHH</nom>
<localitat>Igualada</localitat>
</dept>
) following doc('[Link]','economia')//dept[@codi="d40"]

Insert - One or various attributes into one or more


nodes

update insert (attribute nomAtribut {'valor'},...)


(into | following | preceding) onInserir

The claus following and preceding are used to place attributes after and before a
specified attribute

EXAMPLE: Insert An Attribute

update insert (attribute pais {'ES'}, attribute tel {'938030000'})


into doc('[Link]','economia')//dept[@codi="d50"]

Insert - One or more Nodes and Attributes into one or


moe nodes

update insert (seqüènciaAtributs, seqüènciaNodes)


(into | following | preceding) onInserir

SEDNA XML DATABASEº 2


The attributes must be inserted before the nodes. Sedna controls them but

existdb doesn’t. So the order should be followed! The preceding and following
seems to not work so its better to use into
EXAMPLE: Insert A Node and An Attribute

update insert ( attribute fax {'938040000'},


<adreça>
<carrer>Av. Emili Vallès, 4</carrer>
<cp>08700</cp>
</adreça>)
into doc('[Link]','economia')//dept[@codi = 'd50']

Rename - Rename a node or attribute

update rename nodeOAtributAReanomenar on nouNom

Example: Rename a node and an attribute

update rename doc('[Link]','economia')//dept[@codi = 'd50']/adreça on d

update rename doc('[Link]','economia')//dept[@codi = 'd50']/@tel on telè

Replace Value - Substitute The Value Of


Nodes/Attributes
❗ Does not exist in sedna ! Should substitute node or attribute in the whole

Replace - Nodes/Attributes

update replace $n in nodeOAtribut with nouNodeONouAtribut

SEDNA XML DATABASEº 3


To indicate the new attribute, following the norm indicated in the insert instruction
EXAMPLE: THE DEPARTMENT RRHH WILL MOVE TO codi="d99", nom="Festes",
localitat="Marbella" i sense fax, ni telèfon ni país

update replace $n in doc('[Link]','economia')//dept[nom = 'RRHH'] with


<dept codi="d99">
<nom>Festes</nom>
<localitat>Marbella</localitat>
</dept>

Delete - Delete nodes/attributes

update delete nodeOAtributAEliminar

EXAMPLE : Delete department Festes

update delete doc('[Link]','economia')//dept[nom= "Festes"]

SEDNA JAVA API


Making A Connection
In sedna in order to connect to the database you need the SednaConnection
interface and inject it with a databaseManager class.

SednaConnection con = [Link](host + ":" + port,datab

The essential keys needed in the property files are the

SEDNA XML DATABASEº 4


Host

Port

Database

User

Password

The exceptions thrown by Sedna are the DriverException

Making A Query
To make a query in sedna you need the SednaStatement interface and you inject it

with the connection’s createStatement() method. In sedna you cant make a query or
transaction to the Db while one is in progress, for that reason, you must check if a
transaction is in progress before proceding to the next. Then you execute the
query with the execute(query) method of the sednaStatement. the
getSerializedResult().next() returns the result of the query

SednaStatement q = [Link]();
[Link]();
transOn = true;
[Link](path + "/empresa/nom/string()");
String name = [Link]().next();
transOn = false;

❗Sedna does not have a method to close a query.


Nombres De APIS
XQJ

JDom_2.0.6.1

XQJ_BaseX

XQJ_eXist-db

SEDNA XML DATABASEº 5


XQJ_Sedna

Apache_Xerces_2.12.2

SEDNA XML DATABASEº 6

You might also like