The XperienCentral JCR browser is a tool to explore a Java Content Repository (JCR). The tool allows you to browse through the repository by expanding or collapsing sub trees. With JCR tree items, you can perform the following operations:
- With nodes you can create, move and delete.
- With properties you can create, edit and delete.
Due to node type definitions, the JCR browser cannot perform any operation on any node. If you try to create an improper child node or property, the JCR browser will give a constraint error.
In addition, the JCR browser enables you to create and perform queries. With queries you can search for specific content and read it. The JCR browser supports the XPath and SQL syntaxes.
In This Topic
Introduction to JCR
Using the XperienCentral JCR Browser
To start and use the JCR browser, do the following:
- Select menu Configure -> JCR browser. A ‘JCR browser’ window pops up.
- Select the [JCR Browser] tab and then the [JCR Tree] sub tab.
- Browse through the tree by expanding or collapsing node sub trees. To expand click ‘+’ (plus) and to collapse click ‘–’ (minus).
- To select a node, click on its icon or name. The attributes of the selected node and the properties it contains, are shown at the right.
Display Tree Property
Basically, in the tree view for each node the ‘Name’ attribute of the node is listed. However, in certain cases the actual node name may be irrelevant and is not what you like to see. For these cases, you can view a property of the node instead of its name. The property is given by the ‘Display tree property’ field. By default it is set to wm:name. This means that for each node the tree viewer tries to find a wm:name property. If the property is present, the value of this property will be shown. If not, the actual node name will be shown.
For example: when you execute the XPath query ‘//element(*, wo:global)’, the result may be a node that is labeled as follows:
- If the ‘Display tree property’ field is empty, you may get ‘751b14124e9caf40ed6c7822d6de’. If you expand the tree, you may get a child node ‘wo:edit’.
- If the ‘Display tree property’ field is set to wm:name, you may get ‘global’. If you expand the tree, you may get a child node ‘edit’.
Sort by Name
Check ‘Sort by name’ to view the nodes in the tree in alphabetical order.
Following a Tree Reference
If a property is a reference in the JCR tree, its value is shown as a link.
- Click on the link to navigate to the referenced node in the JCR tree.
Operations with Nodes
Creating a Node
- Select the node in which the new (sub) node is to be created.
- Press the [Add node] button. The ‘Create node’ dialog is added to the screen.
- From the pull-down menu, select the node type to be created.
- Enter the node name.
- Press the [Create node] button. The node is added.
Moving a Node
- Select the node to be moved.
- Press the [Cut] button.
- Select the destination node.
- Press the[Paste] button. The node including its properties and subtrees is moved to the destination.
Deleting a Node
- Select the node to be deleted.
- In the ‘Actions’ dialog, press the[Delete]button. You are prompted to confirm.
- Press [OK]. The node including its properties and subtrees is deleted.
Operations with Properties
Creating a Property
- Select the node in which the property is to be created.
- Press the [Add property] button. The ‘Add property’ dialog is added to the screen.
- From the pull-down menu, select the definition of the property to be created.
- Enter the name of the property.
- From the pull-down menu, select the type of the property to be created.
- To define a multi-value property, check ‘Multiple’ (see also: Multi-value properties). The [Add value] button will be added.
- Enter the (first) value of the property.
- Press the [Add] button. The property is added.
- In the case of a multi-value property: to add an other value (instance), enter the other value and press [Add value]. The other value is added.
Editing a Property
- Press the Edit button of the property to be edited. The ‘Edit property’ dialog is added to the screen.
- Make the desired changes.
- Press [Set]. The property is changed.
By pressing [Add value] instead of [Set] you create a new instance of the property.
Deleting a Property
- Check the Delete checkbox of the property to be deleted.
- Press the[Delete]button. You are prompted to confirm.
- Press [OK]. The property is deleted.
Using JCR Queries
By way of example, the JCR browser is provided with a list of preprogrammed XPath and SQL queries. To this list, you can add your own queries. Your queries are saved and you can edit them afterwards. To execute a query, you just select one from the list, make some adaptations if you like and then execute it.
Creating or Editing a Query
- Select the JCR Queries tab.
- From the Queries pull-down menu, select ‘New query’, or an existing query. Notice that you cannot edit preprogrammed queries.
- Enter or change the name of the query.
- Select the query syntax type ‘Xpath’ or ‘SQL’.
- Enter or change the actual query. See also: Query examples: SQL versus XPath)
- Press [Apply] to save the query on the list.
Query Examples: SQL Versus XPath
SQL | XPath |
---|---|
SELECT * FROM nt:base | //* |
SELECT * FROM my:type | //element(*, my:type) |
SELECT my:title FROM my:type | //element(*, my:type)/@my:title |
SELECT my:title, my:text FROM my:type | //element(*, my:type)/ (@my:title | @my:text) |
SELECT * FROM my:type WHERE jcr:path LIKE '/nodes[%]/%' | /jcr:root/nodes// element(*, my:type) |
SELECT * FROM my:type WHERE my:title='JSR 170' | //element(*, my:type) [@my:title = 'JSR 170'] |
SELECT * FROM my:type WHERE my:title <> 'JSR 170' | //element(*, my:type) [@my:title != 'JSR 170'] |
SELECT * FROM my:type WHERE my:title = 'JSR 170' AND my:author = 'David' | //element(*, my:type) [@my:title = 'JSR 170' and @my:author = 'David'] |
SELECT * FROM my:type WHERE NOT (my:title = 'JSR 170') | //element(*, my:type) [not(@my:title = 'JSR 170')] |
SELECT * FROM my:type WHERE my:title IS NOT NULL | //element(*, my:type) [@my:title] |
SELECT * FROM my:type WHERE my:title IS NULL | //element(*, my:type) [not(@my:title)] |
SELECT * FROM my:type WHERE my:title LIKE 'JSR 170%' | //element(*, my:type) [jcr:like(@my:title, 'JSR 170%')] |
SELECT * FROM my:type WHERE CONTAINS(*, 'JSR 170') | //element(*, my:type) [jcr:contains(., 'JSR 170')] |
SELECT * FROM my:type WHERE jcr:path LIKE'/some[%]/nodes[%]' | /jcr:root/some/ element(nodes, my:type) |
SELECT * FROM my:type WHERE jcr:path = '/some/nodes' | /jcr:root/some[1]/element(nodes, my:type)[1] |
SELECT * FROM my:type WHERE jcr:path LIKE '/some[%]/nodes[%]/%' AND NOT jcr:path LIKE '/some[%]/nodes[%]/%/%' | /jcr:root/some/nodes/ element(*, my:type) |
SELECT * FROM my:type WHERE jcr:path LIKE '/some/nodes/%' AND NOT jcr:path LIKE '/some/nodes/%/%' | /jcr:root/some[1]/nodes[1]/ element(*, my:type) |
SELECT * FROM my:type WHERE jcr:path LIKE '/some[%]/nodes[%]/%' | /jcr:root/some/nodes// element(*, my:type) |
SELECT * FROM my:type WHERE jcr:path LIKE '/some/nodes/%' | /jcr:root/some[1]/nodes[1]// element(*, my:type) |
SELECT * FROM my:type WHERE jcr:path LIKE '/some[%]/nodes[%]' OR jcr:path LIKE '/some[%]/nodes[%]/%' | /jcr:root/some/nodes// element(*, my:type) |
SELECT * FROM my:type WHERE jcr:path = '/some/nodes' OR jcr:path LIKE '/some/nodes/%' | /jcr:root/some[1]/nodes[1]// element(*, my:type) |
Deleting a Query from the List
- Select the JCR Queries tab.
- From the Queries pull-down menu, select the query you want to delete. Notice that you cannot delete preprogrammed queries.
- Press [Delete query]. The query is removed from the list.
Executing a Query
- Select the JCR Browser tab.
- Press the [More] button. The ‘Query execution’ dialog is added to the screen.
- From the pull-down menu, select the query, for instance ‘MyNodeTypes XPath’.
- If desired, adapt the query to your needs.
- Press the [Execute query] button. The results appear on the Query results tab.