/*
 * Copyright 2013 Thomas Matthews <thomas.matthews@phac-aspc.gc.ca>.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package ca.corefacility.bioinformatics.irida.model;

import ca.corefacility.bioinformatics.irida.model.roles.Auditable;
import ca.corefacility.bioinformatics.irida.model.roles.Identifiable;
import ca.corefacility.bioinformatics.irida.model.roles.impl.Audit;
import ca.corefacility.bioinformatics.irida.model.roles.impl.Identifier;
import ca.corefacility.bioinformatics.irida.repositories.sesame.dao.RdfPredicate;

/**
 *
 * @author Thomas Matthews <thomas.matthews@phac-aspc.gc.ca>
 */
public class Relationship implements Auditable<Audit>, Identifiable<Identifier>, Comparable<Relationship>{

    Identifier identifier;
    
    Identifier subject;
    RdfPredicate predicate;
    Identifier object;
    
    public Relationship(){
        audit = new Audit();
    }
    
    private Audit audit;

    public Identifier getSubject() {
        return subject;
    }

    public RdfPredicate getPredicate() {
        return predicate;
    }

    public Identifier getObject() {
        return object;
    }

    public void setSubject(Identifier subject) {
        this.subject = subject;
    }

    public void setPredicate(RdfPredicate relationship) {
        this.predicate = relationship;
    }

    public void setObject(Identifier object) {
        this.object = object;
    }

    @Override
    public Audit getAuditInformation() {
        return audit;
    }

    @Override
    public void setAuditInformation(Audit audit) {
        this.audit = audit;
    }

    @Override
    public Identifier getIdentifier() {
        return identifier;
    }

    @Override
    public void setIdentifier(Identifier identifier) {
        this.identifier = identifier;
    }

    @Override
    public int compareTo(Relationship o) {
        return audit.compareTo(o.audit);
    }


    
}

@@ -1052,52 +1052,191 @@
 *%0A *
-%0A * @author Thomas Matthews %3Cthomas.matthews
+ Modelling a relationship between two different entities in the database.%0A *%0A * @author Thomas Matthews %3Cthomas.matthews@phac-aspc.gc.ca%3E%0A * @author Franklin Bristow %3Cfranklin.bristow
 @pha
@@ -1358,16 +1358,17 @@
 ionship%3E
+ 
 %7B%0A%0A    I
@@ -1389,21 +1389,16 @@
 tifier;%0A
-    %0A
     Iden
@@ -1464,24 +1464,45 @@
 object;%0A    
+private Audit audit;%0A
 %0A    public 
@@ -1515,16 +1515,17 @@
 onship()
+ 
 %7B%0A      
@@ -1557,49 +1557,52 @@
   %7D%0A
-    
 %0A    p
-rivate Audit audit;%0A%0A    public
+ublic Relationship(Identifier subject,
  Ide
@@ -1613,19 +1613,14 @@
 ier 
-getSu
+o
 bject
-(
 ) %7B%0A
@@ -1631,96 +1631,76 @@
     
-return subject
+this()
 ;%0A    
-%7D%0A%0A
     
-public RdfPredicate getPredicate() %7B%0A        return predicate
+this.subject = subject;%0A        this.object = object
 ;%0A  
@@ -1729,17 +1729,18 @@
 fier get
-O
+Su
 bject() 
@@ -1756,17 +1756,18 @@
  return 
-o
+su
 bject;%0A 
@@ -1852,32 +1852,106 @@
 subject;%0A    %7D%0A%0A
+    public RdfPredicate getPredicate() %7B%0A        return predicate;%0A    %7D%0A%0A
     public void 
@@ -2030,32 +2030,98 @@
 ionship;%0A    %7D%0A%0A
+    public Identifier getObject() %7B%0A        return object;%0A    %7D%0A%0A
     public void 
@@ -2684,11 +2684,6 @@
 %7D%0A%0A%0A
-    %0A
 %7D%0A

Add constructor to specify both parts of the relationship.