We should have a consistent interface to tagging between the registry and
mashup server. Basically we need to have a consistent strategy for:
1) what characters are allowed in a tag,
2) to what extent the tag is normalized upon entry, and
3) how much freedom there is in searching for a tag (e.g. whitespace
differences, case differences).
It sounds like you've answered these points as:
1) any character is allowed, including whitespace, but disallowing commas.
2) comma separated lists are split into individual tags. Whitespace is
normalized (in the xml sense) I hope?
3) Case insensitive matches?
That's slightly different than I had planned for the mashup server:
1) non-punctuation characters allowed only (no whitespace), plus maybe a few
useful symbols like "_".
2) cases are folded (lowercase), whitespace-separated lists are split into
individual tags (unless quoted e.g. 'wso2 "open source"' --> {"wso2",
"opensource"}, whitespace and punctuation stripped ('"Chathura's party"' -->
{"chathurasparty"}).
3) searching is an exact match of the normalized search string with the
normalized tag value.
Both approaches are coherent, and appear successful on the web. The first
approach maximally preserves the user's input at the expense of making matching
tags harder to implement and possibly a bit more fragile. The second approach
makes searching more robust and predictable at the expense of preserving the
user's input.
Maybe there's even a middle approach that we could bake further down into the
registry - store the tag value in two fields in the table - one preserving the
users input, and one containing a heavily normalized version that we can easily
search on. Normalize the input to getTags, but also expose the utility
normalizing function so that executeQuery users can still do good tag matches.
P.S. we have similar issue with user names - right now one searches for mashups
from a particular user by their username (e.g. admin) rather than their formal
name (Jonathan Marsh) even though the username only appears in the UI in urls.
And we don't enforce unique formal names at present which could result in name
conflicts or even spoofing attacks.
Jonathan Marsh - http://www.wso2.com - http://auburnmarshes.spaces.live.com
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:registry-dev-
> [EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
> Sent: Saturday, December 15, 2007 6:04 AM
> To: [email protected]
> Subject: [Registry-dev] svn commit r11161 -
> trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc
>
> Author: chathura
> Date: Sat Dec 15 06:04:21 2007
> New Revision: 11161
>
> Log:
>
>
> Now multiple tags has to be separeted using commas.
> That means, you can apply tags with spaces in them (e.g. Sri Lanka)
>
>
>
> Modified:
>
> trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/JDBCRe
> gistry.java
>
> Modified:
> trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/JDBCRe
> gistry.java
> =======================================================================
> =======
> ---
> trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/JDBCRe
> gistry.java (original)
> +++
> trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/JDBCRe
> gistry.java Sat Dec 15 06:04:21 2007
> @@ -444,8 +444,8 @@
>
> String userID = User.getCurrentUser();
>
> - // break the space separated words into multiple tags
> - String[] tags = tag.split(" ");
> + // break the comma separated words into multiple tags
> + String[] tags = tag.split(",");
>
> try {
> conn.setAutoCommit(false);
> @@ -458,6 +458,8 @@
>
> for (int i = 0; i < tags.length; i++) {
>
> + tags[i] = tags[i].trim();
> +
> if (tags[i].length() == 0 || tags[i].equals(" ")) {
> continue;
> }
> @@ -504,7 +506,7 @@
> public TaggedResourcePath[] getResourcePathsWithTag(String tag)
> throws RegistryException {
>
> // break the tags from spaces
> - String[] tags = tag.trim().split(" ");
> + String[] tags = tag.trim().split(",");
>
> //List pathList = new ArrayList();
> List taggedPaths = new ArrayList();
> @@ -521,6 +523,7 @@
> taggedResourcePath.setResourcePath(path);
>
> for (int i = 0; i < tags.length; i++) {
> + tags[i] = tags[i].trim();
> long count = tagsDAO.getTagCount(path, tags[i],
> conn);
> taggedResourcePath.addTagCount(tags[i], count);
> }
>
> _______________________________________________
> Registry-dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/registry-dev
_______________________________________________
Registry-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/registry-dev