Hello!
Reading this documentation, I tryed to apply to my code in this way:
Triple
ConceptCode:@Entity @Table(name = "triple") @NodeEntity public class TripleDBMoldelNeoImpl implements TripleDBModel{ protected List<Annotation> annotations; @RelatedTo(type = "subject", elementClass = (Class<? extends NodeBacked>) Concept.class) //This is the suggestion Eclipse gives me public Concept subject; @RelatedTo(type = "object", elementClass = Concept.class) public Concept object; @RelatedTo(type = "predicate", elementClass = Concept.class) public Concept predicate; @ManyToMany( cascade={CascadeType.ALL }, fetch=FetchType.LAZY ) @JoinTable(name = "triple_has_annotation", joinColumns={@JoinColumn(name="uri_concept_subject"), @JoinColumn(name="uri_concept_object"), @JoinColumn(name="uri_concept_predicate") }, inverseJoinColumns=@JoinColumn(name="annotation_id") ) public List<Annotation> getAnnotations() { return annotations; } public void setAnnotations(List<Annotation> annotations) { this.annotations = annotations; } @Id @Column(name = "subject", length = 100) public Concept getSubject() { return subject; } public void setSubject(Concept subject) { this.subject = subject; } @Id @Column(name = "object", length = 100) public Concept getObject() { return object; } public void setObject(Concept object) { this.object = object; } @Id @Column(name = "predicate", length = 100) public Concept getPredicate() { return predicate; } public void setPredicate(Concept predicate) { this.predicate = predicate; }
Code:@NodeEntity(partial = true) public class ConceptNeoImpl implements java.io.Serializable, Concept { private static final long serialVersionUID = 1L; private String uri; private String label; private String ontologyElement; private List<Annotation> annotations; @RelatedTo(type = "conceptSub", elementClass = TripleDBModel.class) private TripleDBModel triple; public TripleDBModel getTriple() { return triple; } public void setTriple(TripleDBModel triple) { this.triple = triple; }
The use I want to is explained on the image below
usercase.jpg
Then, the table triple will be using neo4j and concept will be using jpa and neo4j. I am programming using Eclipse IDE and it gives me suggestions to correct the errors. The first one is:
correct toCode:@RelatedTo(type = "conceptUriSubject", elementClass = Concept.class)
And then, the problem is not solved, and gives me the nex messageCode:@RelatedTo(type = "conceptUriSubject", elementClass = (Class<? extends NodeBacked>) Concept.class)
Any ideas¿¿ I am new on this, so I am quite lost. Thanks in advanceMultiple markers at this line
- The value for annotation attribute RelatedTo.elementClass must be a class literal
- Type safety: Unchecked cast from Class<Concept> to Class<? extends
NodeBacked>
- The value for annotation attribute RelatedTo.elementClass must be a class literal
- Type safety: Unchecked cast from Class<Concept> to Class<? extends
NodeBacked>
EDIT
The image attached is not clear. I try to explain with words:
TRIPLE -> the id is composed by 3 concept.id
CONCEPT -> is related to TRIPLE by a triple relation. 3 concepts will be related with one TRIPLE
Even checking more exaplnes I found in Internet, I can't see the different between them and my example. Any help please??


Reply With Quote
