Пример #1
0
 /**
  * Compare two N-Quads. The implementation and exection of the comparison depends on the mode
  * settings.
  */
 @Override
 public int compare(NQuad quad1, NQuad quad2) {
   int result = 0;
   switch (this.mode) {
     case NQuadSorting.SUBJECT_SORT:
       result = quad1.subject.compareTo(quad2.subject);
       break;
     case NQuadSorting.PREDICATE_SORT:
       result = quad1.predicate.compareTo(quad2.predicate);
       break;
     case NQuadSorting.OBJECT_SORT:
       result = quad1.object.compareTo(quad2.object);
       break;
     case NQuadSorting.CONTEXT_SORT:
       result = quad1.context.compareTo(quad2.context);
       break;
   }
   if (result == 0) {
     // backup: default comparator if equal values
     result = quad1.compareTo(quad2);
   }
   return result;
 }
Пример #2
0
 @Override
 protected NQuad fromLine(String line) {
   return NQuad.fromString(line);
 }
Пример #3
0
 @Override
 protected String toLine(NQuad object) {
   return object.toString();
 }