You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Jeffrey Kenneth Tyzzer <jk...@ucdavis.edu.INVALID> on 2020/12/04 19:53:03 UTC

Representing reciprocal blank node relationships in abbreviated syntax

Hi, Group.

Consider this small model:

a --relates--> b
b --relates--> c
b <--relatedBy-- c

Note that the b to c relationship is reciprocal.

I’d like to represent b and c as blank nodes. Using the label form, it’s seemingly straightforward (I’ve added a couple of additional rdfs:type triples to fill-out a bit what I show next):

a ex:relates _:b
_: b rdfs:type ex:foo
_:b ex:relates _:c
_:c rdfs:type ex:bar
_:c ex:relatedBy _:b

Using the abbreviated form, though, doesn’t seem possible :

a ex:relates [ rdfs:type ex:foo ; ex: relates [ rdfs:type ex:bar ; ex:relatedBy <what would go here to refer to the first (outer) blank node?> ] ].

I suppose I’m asking if something can be both the container and contained, but perhaps there’s some syntactic sugar/legerdemain (or Jena-specific syntax) I’m not aware of that makes this possible.

Thanks.

--Jeff

Re: Representing reciprocal blank node relationships in abbreviated syntax

Posted by Jeffrey Kenneth Tyzzer <jk...@ucdavis.edu.INVALID>.
Thank you Andy, Dan, and Martynas for confirming this--much appreciated.

--Jeff

On 12/5/20, 4:28 AM, "Andy Seaborne" <an...@apache.org> wrote:

    unlabelled [] form on its own can only represent a tree.
    A node in such a graph can't have two "in" arcs.

    Nothing specific to RDF syntax here - see JSON and XML. Any sharing 
    needs a pointer in some way. Applies to DAGs and cycles.

    You can mix labelled and unlabelled forms.

    Jena pretty prints your example using one label:

    <a>
             ex:relates  _:b0 .

    _:b0    ex:relates  [ ex:relatedBy  _:b0 ;
                           rdf:type     ex:bar
                         ] ;
             rdf:type   ex:foo .

    	Andy

    On 04/12/2020 20:54, Dan Brickley wrote:
    > see also
    > https://www.w3.org/TR/turtle/#unlabeled-bnodes
    > 
    > 
    > 
    > On Fri, 4 Dec 2020 at 20:20, Martynas Jusevičius <ma...@atomgraph.com>
    > wrote:
    > 
    >> I don't think you can use the [ ] form to create cycles.
    >>
    >> On Fri, Dec 4, 2020 at 8:53 PM Jeffrey Kenneth Tyzzer
    >> <jk...@ucdavis.edu.invalid> wrote:
    >>>
    >>> Hi, Group.
    >>>
    >>> Consider this small model:
    >>>
    >>> a --relates--> b
    >>> b --relates--> c
    >>> b <--relatedBy-- c
    >>>
    >>> Note that the b to c relationship is reciprocal.
    >>>
    >>> I’d like to represent b and c as blank nodes. Using the label form, it’s
    >> seemingly straightforward (I’ve added a couple of additional rdfs:type
    >> triples to fill-out a bit what I show next):
    >>>
    >>> a ex:relates _:b
    >>> _: b rdfs:type ex:foo
    >>> _:b ex:relates _:c
    >>> _:c rdfs:type ex:bar
    >>> _:c ex:relatedBy _:b
    >>>
    >>> Using the abbreviated form, though, doesn’t seem possible :
    >>>
    >>> a ex:relates [ rdfs:type ex:foo ; ex: relates [ rdfs:type ex:bar ;
    >> ex:relatedBy <what would go here to refer to the first (outer) blank node?>
    >> ] ].
    >>>
    >>> I suppose I’m asking if something can be both the container and
    >> contained, but perhaps there’s some syntactic sugar/legerdemain (or
    >> Jena-specific syntax) I’m not aware of that makes this possible.
    >>>
    >>> Thanks.
    >>>
    >>> --Jeff
    >>
    > 


Re: Representing reciprocal blank node relationships in abbreviated syntax

Posted by Andy Seaborne <an...@apache.org>.
unlabelled [] form on its own can only represent a tree.
A node in such a graph can't have two "in" arcs.

Nothing specific to RDF syntax here - see JSON and XML. Any sharing 
needs a pointer in some way. Applies to DAGs and cycles.

You can mix labelled and unlabelled forms.

Jena pretty prints your example using one label:

<a>
         ex:relates  _:b0 .

_:b0    ex:relates  [ ex:relatedBy  _:b0 ;
                       rdf:type     ex:bar
                     ] ;
         rdf:type   ex:foo .

	Andy

On 04/12/2020 20:54, Dan Brickley wrote:
> see also
> https://www.w3.org/TR/turtle/#unlabeled-bnodes
> 
> 
> 
> On Fri, 4 Dec 2020 at 20:20, Martynas Jusevičius <ma...@atomgraph.com>
> wrote:
> 
>> I don't think you can use the [ ] form to create cycles.
>>
>> On Fri, Dec 4, 2020 at 8:53 PM Jeffrey Kenneth Tyzzer
>> <jk...@ucdavis.edu.invalid> wrote:
>>>
>>> Hi, Group.
>>>
>>> Consider this small model:
>>>
>>> a --relates--> b
>>> b --relates--> c
>>> b <--relatedBy-- c
>>>
>>> Note that the b to c relationship is reciprocal.
>>>
>>> I’d like to represent b and c as blank nodes. Using the label form, it’s
>> seemingly straightforward (I’ve added a couple of additional rdfs:type
>> triples to fill-out a bit what I show next):
>>>
>>> a ex:relates _:b
>>> _: b rdfs:type ex:foo
>>> _:b ex:relates _:c
>>> _:c rdfs:type ex:bar
>>> _:c ex:relatedBy _:b
>>>
>>> Using the abbreviated form, though, doesn’t seem possible :
>>>
>>> a ex:relates [ rdfs:type ex:foo ; ex: relates [ rdfs:type ex:bar ;
>> ex:relatedBy <what would go here to refer to the first (outer) blank node?>
>> ] ].
>>>
>>> I suppose I’m asking if something can be both the container and
>> contained, but perhaps there’s some syntactic sugar/legerdemain (or
>> Jena-specific syntax) I’m not aware of that makes this possible.
>>>
>>> Thanks.
>>>
>>> --Jeff
>>
> 

Re: Representing reciprocal blank node relationships in abbreviated syntax

Posted by Dan Brickley <da...@danbri.org>.
see also
https://www.w3.org/TR/turtle/#unlabeled-bnodes



On Fri, 4 Dec 2020 at 20:20, Martynas Jusevičius <ma...@atomgraph.com>
wrote:

> I don't think you can use the [ ] form to create cycles.
>
> On Fri, Dec 4, 2020 at 8:53 PM Jeffrey Kenneth Tyzzer
> <jk...@ucdavis.edu.invalid> wrote:
> >
> > Hi, Group.
> >
> > Consider this small model:
> >
> > a --relates--> b
> > b --relates--> c
> > b <--relatedBy-- c
> >
> > Note that the b to c relationship is reciprocal.
> >
> > I’d like to represent b and c as blank nodes. Using the label form, it’s
> seemingly straightforward (I’ve added a couple of additional rdfs:type
> triples to fill-out a bit what I show next):
> >
> > a ex:relates _:b
> > _: b rdfs:type ex:foo
> > _:b ex:relates _:c
> > _:c rdfs:type ex:bar
> > _:c ex:relatedBy _:b
> >
> > Using the abbreviated form, though, doesn’t seem possible :
> >
> > a ex:relates [ rdfs:type ex:foo ; ex: relates [ rdfs:type ex:bar ;
> ex:relatedBy <what would go here to refer to the first (outer) blank node?>
> ] ].
> >
> > I suppose I’m asking if something can be both the container and
> contained, but perhaps there’s some syntactic sugar/legerdemain (or
> Jena-specific syntax) I’m not aware of that makes this possible.
> >
> > Thanks.
> >
> > --Jeff
>

Re: Representing reciprocal blank node relationships in abbreviated syntax

Posted by Martynas Jusevičius <ma...@atomgraph.com>.
I don't think you can use the [ ] form to create cycles.

On Fri, Dec 4, 2020 at 8:53 PM Jeffrey Kenneth Tyzzer
<jk...@ucdavis.edu.invalid> wrote:
>
> Hi, Group.
>
> Consider this small model:
>
> a --relates--> b
> b --relates--> c
> b <--relatedBy-- c
>
> Note that the b to c relationship is reciprocal.
>
> I’d like to represent b and c as blank nodes. Using the label form, it’s seemingly straightforward (I’ve added a couple of additional rdfs:type triples to fill-out a bit what I show next):
>
> a ex:relates _:b
> _: b rdfs:type ex:foo
> _:b ex:relates _:c
> _:c rdfs:type ex:bar
> _:c ex:relatedBy _:b
>
> Using the abbreviated form, though, doesn’t seem possible :
>
> a ex:relates [ rdfs:type ex:foo ; ex: relates [ rdfs:type ex:bar ; ex:relatedBy <what would go here to refer to the first (outer) blank node?> ] ].
>
> I suppose I’m asking if something can be both the container and contained, but perhaps there’s some syntactic sugar/legerdemain (or Jena-specific syntax) I’m not aware of that makes this possible.
>
> Thanks.
>
> --Jeff