Repeatedly posting the same question will not get a response sooner. Remember that people are busy!

On 15/01/13 17:49, hlel emna wrote:
hi,

how I can added une relation n_ary with jena (3-ary).
OntClass f = m.createClass(ns+ "femme" );
      OntClass h = m.createClass(ns+ "homme" );
OntClass hh = m.createClass(ns+ "date" );

ObjectProperty ma = m.createObjectProperty(ns + "marier" );


First, study the suggestion from Joshua Taylor. He proposes an anonymous resource - a bnode - to represent the instance of the n-ary relation, and then predicates connecting that bnode to the members of the relationship.

I'm going to generalise the example slightly, to allow for civil partnerships and same-sex marriages (I know that's politically correct, but it's my example code so I can :). So let's assume that a marriage is between two people, partner1 and partner2, and that it must have a date that it started, and it may have a date on which it ended. Code here:

https://gist.github.com/4543371

Output:

[]    a       eg:Marriage ;
      eg:partner1 eg:fred ;
      eg:partner2 eg:wilma ;
      eg:started "-500-01-01"^^xsd:date .

Ian




--
____________________________________________________________
Ian Dickinson                   Epimorphics Ltd, Bristol, UK
mailto:[email protected]        http://www.epimorphics.com
cell: +44-7786-850536              landline: +44-1275-399069
------------------------------------------------------------
Epimorphics Ltd.  is a limited company registered in England
(no. 7016688). Registered address: Court Lodge, 105 High St,
              Portishead, Bristol BS20 6PT, UK

Reply via email to