Github user meiercaleb commented on a diff in the pull request:

    https://github.com/apache/incubator-rya/pull/153#discussion_r133737467
  
    --- Diff: 
extras/indexing/src/main/java/org/apache/rya/indexing/entity/storage/mongo/MongoEntityStorage.java
 ---
    @@ -242,4 +281,46 @@ private static Bson makeExplicitTypeFilter(final 
RyaURI typeId) {
     
             return Stream.of(dataTypeFilter, valueFilter);
         }
    +
    +    private boolean detectDuplicates(final Entity entity) throws 
EntityStorageException {
    +        boolean hasDuplicate = false;
    +        if (duplicateDataDetector.isDetectionEnabled()) {
    +            if (mongoTypeStorage == null) {
    +                mongoTypeStorage = new MongoTypeStorage(mongo, 
ryaInstanceName);
    +            }
    +            final Builder builder = new Builder();
    +            builder.setSubject(entity.getSubject());
    +            boolean abort = false;
    +            for (final RyaURI typeRyaUri : entity.getExplicitTypeIds()) {
    +                Optional<Type> type;
    +                try {
    +                    type = mongoTypeStorage.get(typeRyaUri);
    +                } catch (final TypeStorageException e) {
    +                    throw new EntityStorageException("Unable to get entity 
type: " + typeRyaUri, e);
    +                }
    +                if (type.isPresent()) {
    +                    final ConvertingCursor<TypedEntity> cursor = 
search(Optional.empty(), type.get(), Collections.emptySet());
    +                    while (cursor.hasNext()) {
    --- End diff --
    
    I'm not quite following what you are doing with the Entity Builder here.  
It seems like you are using it primarily to convert each TypedEntity returned 
in this loop to an Entity.   If that is the case, you should be creating a new 
Builder for each TypedEntity and then doing your duplicate comparison within 
this loop.  As it is currently written, it seems like you are just overwriting 
properties as you iterate through the TypedEntities.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to