List Node

3 views
Skip to first unread message

Anna Lu

unread,
Jun 25, 2010, 7:53:00 AM6/25/10
to jenabe...@googlegroups.com
Hi,

I have some problem now and pls help me if you have any idea.

If I defined a class Person{
...
List<Person> parents = new ArrayList<Person> ();
...
}

I created an instance of Person and added his parents. Then a rdf:Seq node was created, linking to two nodes representing his parents.
But when I want to infer that two people have the same parents are siblings with Jena rules, I have the problem.
With only Jena, the rule looks like
(?a hasParent ?p) (?b hasParent ?p)
notEqual(?a, ?b)
->
(?a sibling ?b)

With Jenabean, the Seq nodes for ?a and ?b are not the same, so it is impossible to know if they have the same parent.

The same problem exists when apply complex SPARQL queries on the data.

Do you have any suggestion?

Taylor Cowan

unread,
Jun 25, 2010, 11:37:51 AM6/25/10
to jenabe...@googlegroups.com
Hi Anna,

Sounds like we don't want that sequence, but instead a simple plural
property. Would you be willing to share the full person class as an
attachment or code past? That'll help me figure out how to help.

Taylor

> --
> You received this message because you are subscribed to the Google Groups
> "jenabean-dev" group.
> To post to this group, send email to jenabe...@googlegroups.com.
> To unsubscribe from this group, send email to
> jenabean-dev...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/jenabean-dev?hl=en.
>

uoc

unread,
Jun 25, 2010, 9:57:30 AM6/25/10
to jenabe...@googlegroups.com, Anna Lu
Is the model you are reading triples/classes with JenaBean created with an ontology ?

For example ?

ontModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF);
RDF2Bean reader = new RDF2Bean( ontModel );
item = reader.loadDeep(Sibling.class, id);

I've not needed to try this on my system yet, but can do Class->Subclass inferencing. In essence, JenaBean doesnt care, the way the model is constructed is the key part.

Taylor Cowan

unread,
Jun 25, 2010, 2:05:35 PM6/25/10
to jenabe...@googlegroups.com
In can be. For example, if you are working with an inferencing model
with transitive or inverse relationships, you'll get back more info
that you originally added.

There are some test cases along those lines (Apples.java, Oranges.java
are used in an inverse relationship example).

So it's up to you, you can bind the reader to an inferencing or
non-inferencing model, your call. Jenabean does not assist...it stays
out of the way. The idea is that it should make it easier to read
what's in the model, inferences and all, as well as write to the
model.

Taylor Cowan

unread,
Jun 27, 2010, 9:16:09 PM6/27/10
to jenabe...@googlegroups.com
Anna,
If you want your person type to create a hasParent relation, use Collection<person>

List is telling jb to create a seq.

There are some "person" examples in the project test cases

Sent from my HTC



From: Anna Lu <lyc....@gmail.com>
Sent: 25 June 2010 6:53 AM
To: jenabe...@googlegroups.com
Subject: List Node

Anna Lu

unread,
Jun 30, 2010, 4:32:59 AM6/30/10
to jenabe...@googlegroups.com
Yes! Thanks Taylor!

Taylor Cowan

unread,
Jun 30, 2010, 6:55:27 PM6/30/10
to jenabe...@googlegroups.com
Good to hear...keep us posted on how it goes. I always like to hear
how JenaBean is being used.
Reply all
Reply to author
Forward
0 new messages