Search code examples
relationshipcarddav

Can I create relationships between vCards on a CardDAV-server?


Quite surprised that I couldn't find a similar question around here.

I'm looking for a way to create relationships (father / sister / wife etc.) between people, preferably within the vCard. I could quite easily create a db that holds the relationships, but then the app will not adhere to a standard or recommendation.

Does anybody know a relevant standard or recommendation?


Solution

  • The RELATED property does exactly that (see RFC 6350 p.43). Quoting the specs, the purpose of this property is:

    To specify a relationship between another entity and the entity represented by this vCard.

    Its value can be either a URI or free-form text. Examples of useful URIs include website addresses, URLs pointing to a vCard, or URNs that reference the UID property of another vCard.

    It also has a TYPE parameter, which can optionally be used to define the type of relationship. The list of acceptable values for this parameter can be found in the vCard specs.

    RELATED;TYPE=parent:http://example.com/jeb-doe.vcf
    RELATED;TYPE=sibling:urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6
    RELATED;TYPE=spouse;VALUE=text:Jane Doe
    

    RELATED is supported in vCard version 4.0.