Use xmlaccess.sh to administer tags and ratings
You can use xmlaccess.sh to manage tagging and rating in the portal. For example, you can move tagspaces and ratings between portal versions or for staging purposes.
The XML resources related to tagging and rating are tag, rating, and custom-resource. Portal resources and custom resources are tagged and rated by different ways:
The XML resource tags and their attributes are listed in the following.
- To tag or rate portal resources, you use their object IDs directly.
- To represent custom resources, for example books, you use the XML resource custom-resource . The object ID of the custom-resource resource is used as the resourceref attribute in the tag and rating tags.
Notes:
- When creating tags, ratings, or custom resources you need to specify all attributes except the ones marked as optional.
- When you move tagspaces between portals, both the users who have applied the tags and the resources to which the tags have been applied must exist in the target portal.
tagUse the following attributes with the XML resource tag tag :
resourceref = "object_ID"Reference to the resource that is being tagged.
domain = "comm | cust"Database domain for the tagged resource. Possible values are:
custPrivate tags.
commPublic tags.
localeLocale of the tag. This attribute is optional. The default is null.
owner = "user"Owner of the tag.
ratingUse the following attributes with the XML resource tag rating :
resourceref = "object_ID"Reference to the resource that is being rated.
domain = "comm | cust"Database domain for the rated resource. Possible values are:
custPrivate ratings.
commPublic ratings.
value = "integer"Rating value.
owner = "user"Owner of the rating.
custom-resourceCustom resources, for example books. Use the following attribute with the XML resource tag custom-resource :
Refer to the following code samples.
uri = "string"URI that identifies the custom resource.
Use the following subtag with the XML resource tag custom-resource :
category-instanceUse the subtag category-instance to assign a category in the format of a string to a custom resource. You can assign several categories to a custom resource. Use the following attribute with the subtag category-instance :
name = "category_instance_name"Name for a category instance.
Example: Exporting tags and ratings<?xml version="1.0" encoding="UTF-8" ?> <request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PortalConfig_7.0.0.xsd" type="export"> <!-- This sample exports all custom resources, ratings, and tags. Related sample files: CreateTagsAndRatings.xml DeleteTagsAndRatings.xml --> <portal action="locate"> <custom-resource action="export" objectid="*"/> <rating action="export" objectid="*"/> <tag action="export" objectid="*"/> <!-- Export all tags with a specific locale in the system --> <!-- <tag action="export" objectid="*" locale="SPECIFIC_LOCALE"/> --> </portal> </request>
Example: Create tags and ratings<?xml version="1.0" encoding="UTF-8"?> <request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PortalConfig_7.0.0.xsd" type="update"> <!-- This sample creates ratings and tags. Related sample files: ExportTagsAndRatings.xml DeleteTagsAndRatings.xml NOTE: This sample file needs to be modified before execution. Update the value of the 'owner' attributes of the 'access-control', 'rating', and 'tag' tags, and specify an existing user. --> <portal action="locate"> <!-- Parent element under which a new page for this sample is inserted --> <content-node action="locate" objectid="parentPage" uniquename="ibm.portal.Home"/> <!-- A new empty page to which a tag and rating are assigned.--> <content-node action="update" objectid="samplePageOID" uniquename="ibm.portal.SamplePage.TagsAndRatings" ordinal="last" content-parentref="parentPage" active="true" create-type="explicit" type="page"> <supported-markup markup="html" update="set"/> <localedata locale="en"> <title>Sample page for tag and rating creation</title> </localedata> </content-node> <!-- A custom resource can be used to assign tags and ratings to resources that are not managed by XMLAccess, but can be identified by an URI --> <custom-resource action="update" objectid="CH_B1L68B1A00DO80IG7PCV0I1000" uri="book:mySampleBookURI"> <category-instance action="update" name="cookbook"/> <category-instance action="update" name="hardcover"/> </custom-resource> <!-- Assignment of a rating value of 5 by user wpsadmin to the sample page --> <rating action="update" objectid="CJ_B1L68B1A00DO80IG7PCV0I2000" resourceref="samplePageOID" domain="comm" value="5" owner="uid=wpsadmin,o=defaultwimfilebasedrealm" /> <!-- Assignment of a rating value of 5 to the custom resource --> <rating action="update" objectid="CJ_B1L68B1A00DO80IG7PCV0I3000" resourceref="CH_B1L68B1A00DO80IG7PCV0I1000" domain="comm" value="5" owner="uid=wpsadmin,o=defaultwimfilebasedrealm"/> <!-- Assignment of the tag 'sample' to the sample page --> <tag action="update" objectid="CI_B1L68B1A00DO80IG7PCV0I4000" resourceref="samplePageOID" domain="comm" owner="uid=wpsadmin,o=defaultwimfilebasedrealm" locale="en">sample</tag> <!-- Assignment of the tag 'sample' to the custom resource --> <tag action="update" objectid="CI_B1L68B1A00DO80IG7PCV0I5000" resourceref="CH_B1L68B1A00DO80IG7PCV0I1000" domain="comm" owner="uid=wpsadmin,o=defaultwimfilebasedrealm" locale="en">sample</tag> </portal> </request>
Example: Deleting tags and ratings<?xml version="1.0" encoding="UTF-8"?> <request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PortalConfig_7.0.0.xsd" type="update"> <!-- This sample deletes ratings and tags. Related sample files: CreateTagsAndRatings.xml ExportTagsAndRatings.xml NOTE: This sample assumes that the CreateTagsAndRatings.xml sample was executed before. --> <portal action="locate"> <!-- Delete the custom resource created by sample CreateTagsAndRatings.xml --> <custom-resource action="delete" objectid="CH_B1L68B1A00DO80IG7PCV0I1000"/> <!-- Delete all custom resources in the system --> <!-- <custom-resource action="delete" objectid="*"/> --> <!-- Delete the ratings created by sample CreateTagsAndRatings.xml --> <rating action="delete" objectid="CJ_B1L68B1A00DO80IG7PCV0I2000"/> <rating action="delete" objectid="CJ_B1L68B1A00DO80IG7PCV0I3000"/> <!-- Delete all ratings in the system --> <!-- <rating action="delete" objectid="*"/> --> <!-- Delete the tags created by sample CreateTagsAndRatings.xml --> <tag action="delete" objectid="CI_B1L68B1A00DO80IG7PCV0I4000"/> <tag action="delete" objectid="CI_B1L68B1A00DO80IG7PCV0I5000"/> <!-- Delete all tags in the system --> <!-- <tag action="delete" objectid="*"/> --> <!-- Delete all tags with a specific locale in the system --> <!-- <tag action="delete" objectid="*" locale="SPECIFIC_LOCALE"/> --> </portal> </request>
Move tags and ratings between portals by using xmlaccess.sh
To move tags and ratings between portals, for example for staging purposes, proceed as follows:
- Make sure that all users who have applied tags and ratings on the source portal also exist on the target portal.
- Make sure that all tagged and rated resources on the source portal also exist on the target portal.
- Use the provided XML sample script to export all tags and ratings from the source portal.
- Import the result file from the previous export step to the target portal.
Parent
Tagging and rating
Search for tagged content
xmlaccess.sh
How tagging and rating works in the portal
The tagging and rating user interface
Tag and rate for static pages
Allow own custom content to be tagged and rated
Configuration reference
Security for tagging and rating
Hints and tips for tagging and rating
XML configuration reference