[ 
https://issues.apache.org/jira/browse/MAHOUT-705?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13044295#comment-13044295
 ] 

Fernando Tapia Rico commented on MAHOUT-705:
--------------------------------------------

Hi Sean, 
one of my tests didn't run: if the identifiers are not ObjectIDs, I'm not 
getting any exception when I try to add an empty user/item. I don't know if 
it's the desired behavior (I guess not). A couple of constraints should be 
added at checkData:

private void checkData(String userID,
                       Iterable<List<String>> items,
                       boolean add) throws NoSuchUserException, 
NoSuchItemException {
  Preconditions.checkNotNull(userID);
  Preconditions.checkNotNull(items);
  Preconditions.checkArgument(userID.length() > 0);
  for (List<String> item : items) {
    Preconditions.checkNotNull(item.get(0));
    Preconditions.checkArgument(item.get(0).length() > 0);
  }
  Preconditions.checkNotNull(items);
  if (userIsObject && !ID_PATTERN.matcher(userID).matches()) {
    throw new IllegalArgumentException();
  }
  for (List<String> item : items) {
    if (itemIsObject && !ID_PATTERN.matcher(item.get(0)).matches()) {
      throw new IllegalArgumentException();
    }
  }
  if (!add && !isIDInModel(userID)) {
    throw new NoSuchUserException();
  }
  for (List<String> item : items) {
    if (!add && !isIDInModel(item.get(0))) {
      throw new NoSuchItemException();
    }
  }
}

> MongoDB DataModel support
> -------------------------
>
>                 Key: MAHOUT-705
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-705
>             Project: Mahout
>          Issue Type: Improvement
>          Components: Integration
>    Affects Versions: 0.4, 0.5
>            Reporter: Fernando Tapia Rico
>            Assignee: Sean Owen
>            Priority: Minor
>              Labels: datamodel, features, mongo, patch
>             Fix For: 0.6
>
>         Attachments: MAHOUT-705.patch
>
>
> Support for mongoDB in taste DataModels

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to