mujer_esponja
May 16th, 2011, 07:45 AM
Hello!
Reading this documentation (http://static.springsource.org/spring-data/data-graph/snapshot-site/reference/html/#cross-store), I tryed to apply to my code in this way:
Triple
@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;
}
Concept
@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
3779
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:
@RelatedTo(type = "conceptUriSubject", elementClass = Concept.class)
correct to
@RelatedTo(type = "conceptUriSubject", elementClass = (Class<? extends NodeBacked>) Concept.class)
And then, the problem is not solved, and gives me the nex message
Multiple 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>
Any ideas¿¿ I am new on this, so I am quite lost. Thanks in advance
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 (https://github.com/SpringSource/spring-data-graph-examples) I found in Internet, I can't see the different between them and my example. Any help please??
Reading this documentation (http://static.springsource.org/spring-data/data-graph/snapshot-site/reference/html/#cross-store), I tryed to apply to my code in this way:
Triple
@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;
}
Concept
@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
3779
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:
@RelatedTo(type = "conceptUriSubject", elementClass = Concept.class)
correct to
@RelatedTo(type = "conceptUriSubject", elementClass = (Class<? extends NodeBacked>) Concept.class)
And then, the problem is not solved, and gives me the nex message
Multiple 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>
Any ideas¿¿ I am new on this, so I am quite lost. Thanks in advance
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 (https://github.com/SpringSource/spring-data-graph-examples) I found in Internet, I can't see the different between them and my example. Any help please??