ContactRDF

RDF representation of a single Solid contact (vcard:Individual).

Wraps the quads of one contact document on a pod and exposes typed accessors and mutators. Construct from a pod response by passing the parsed quads, or create a new empty instance by supplying only the identifier.

All mutator methods update the in-memory quad list; call the contacts data module to persist the change to the pod.

Constructors

Link copied to clipboard
constructor(identifier: String, contentType: String? = null, quads: List<RdfQuad>? = null, headers: SolidHeaders? = null)

Functions

Link copied to clipboard

Adds a postal address on a counter-labelled blank node (_:addr{n}), always typed vcard:Address plus vcard:Home/vcard:Work when classified. Does nothing and returns false when entry has no non-blank part.

Link copied to clipboard
fun addEmail(address: String, type: EmailType = EmailType.OTHER): Boolean

Adds a typed vcard:hasEmail entry on a counter-labelled blank node (_:email{n}). EmailType.OTHER entries are written without a type triple. Does nothing and returns false when address is blank or already present.

Link copied to clipboard
fun addImpp(handle: String, type: ImType = ImType.OTHER): Boolean

Adds a typed vcard:hasInstantMessage entry on a counter-labelled blank node (_:im{n}). ImType.OTHER entries are written without a type triple. The handle is stored verbatim as an xsd:string value — instant-messaging identifiers span many schemes and bare forms, so it is kept exactly as provided. Does nothing and returns false when handle is blank or already present.

Link copied to clipboard
fun addPhone(number: String, type: PhoneType = PhoneType.OTHER): Boolean

Adds a typed vcard:hasTelephone entry on a counter-labelled blank node (_:phone{n}). PhoneType.OTHER entries are written without a type triple, byte-compatible with legacy writers. Does nothing and returns false when number is blank or already present.

Link copied to clipboard
fun addQuad(subject: String, predicate: String, obj: String, maxNumber: Int = 1)

Adds a triple whose object is an IRI (or blank node).

Link copied to clipboard
fun addQuadLiteral(subject: String, predicate: String, value: String, datatype: String? = XSD.STRING, language: String? = null, maxNumber: Int = 1)

Adds a triple whose object is a literal.

Link copied to clipboard
fun addUrl(type: URLType, url: String): Boolean

Adds url to this contact as a typed vcard:url entry.

Link copied to clipboard
fun clearProperties(predicate: String, subject: String = itselfSubject)

Removes every triple with the given predicate for subject.

Link copied to clipboard
open override fun close()
Link copied to clipboard
open override fun describeContents(): Int
Link copied to clipboard
fun ensureType(subject: String, typeIri: String)

Ensures subject carries an rdf:type triple with typeIri, preserving any other type triples already present.

Link copied to clipboard

Returns the object values of every triple with the given predicate, across all subjects.

Link copied to clipboard

Returns the object values of every triple matching the given subject and predicate.

Link copied to clipboard
fun findProperty(predicate: String): String?

Returns the object value of the first triple with the given predicate, or null if none.

Link copied to clipboard
fun findPropertyForSubject(subject: String, predicate: String): String?

Returns the object value of the first triple matching subject and predicate, or null.

Link copied to clipboard

Returns all postal addresses (vcard:hasAddress). Nodes missing the vcard:Address class type still parse; entries with no address part are skipped.

Link copied to clipboard

Returns a snapshot copy of all triples held by this resource.

Link copied to clipboard

Returns the contact's anniversary (vcard:anniversary) raw lexical value, or null.

Link copied to clipboard

Returns the contact's birthday (vcard:bday) as its raw lexical value, or null if absent.

Link copied to clipboard

The contact's category tags (vcard:hasCategory literals).

Link copied to clipboard
open override fun getContentType(): String

The media type of the resource representation (the value of its Content-Type).

Link copied to clipboard

The creation time in epoch milliseconds, from this resource's own dcterms:created (then stat:ctime) triple, or null when neither is present.

Link copied to clipboard

Returns all email addresses with their vCard classification. Untyped legacy nodes read as EmailType.OTHER; a leading mailto: scheme is stripped from the value.

Link copied to clipboard
open override fun getEntity(): InputStream

Returns the resource representation as a byte stream.

Link copied to clipboard

Returns the contact's formatted display name (vcard:fn).

Link copied to clipboard

The contact's gender (vcard:hasGender, an ontology gender-class IRI), or null.

Link copied to clipboard

The contact's geographic positions (vcard:hasGeo), as stored IRIs — typically geo: URIs. An entry stored on a blank node by a foreign writer is read through its vcard:value.

Link copied to clipboard
open override fun getHeaders(): SolidHeaders

The HTTP headers associated with this resource (empty when constructed locally).

Link copied to clipboard
open override fun getIdentifier(): String

The URI that identifies this resource on the pod.

Link copied to clipboard

Returns all instant-messaging handles (vcard:hasInstantMessage) with their vCard classification. Untyped legacy nodes read as ImType.OTHER.

Link copied to clipboard

Returns the contact's job title (vcard:title), or null if absent.

Link copied to clipboard

The contact's languages (vcard:hasLanguage entry nodes' vcard:language tags), in stored order.

Link copied to clipboard

The last-modified time in epoch milliseconds. Prefers this resource's own dcterms:modified (then stat:mtime) triple and falls back to the Last-Modified header. null when none is present.

Link copied to clipboard
open override fun getMetadata(): SolidMetadata
Link copied to clipboard
fun getName(): Name?

Returns the contact's structured name (vcard:hasName) as a Name, or null if the contact has no structured-name node.

Link copied to clipboard

Returns the contact's nickname (vcard:nickname), or null if absent.

Link copied to clipboard
fun getNote(): String?

Returns the contact's note (vcard:note), or null if absent.

Link copied to clipboard

Returns the contact's organization name (vcard:organization-name), or null if absent.

Link copied to clipboard

Returns the contact's organizational unit (vcard:organization-unit), or null.

Link copied to clipboard

Returns all phone numbers with their vCard classification. Untyped legacy nodes and nodes carrying unrecognized types read as PhoneType.OTHER; a leading tel: scheme is stripped from the value.

Link copied to clipboard

Returns the URL of the contact's photo (vcard:hasPhoto), or null if absent.

Link copied to clipboard
fun getRole(): String?

Returns the contact's role (vcard:role), or null if absent.

Link copied to clipboard
fun getSize(): Long

The size of this resource in bytes (its Content-Length), or 0 when the server did not report one.

Link copied to clipboard
fun getUid(): String?

Returns the contact's persistent identifier (vcard:hasUID), or null.

Link copied to clipboard

Returns all typed URLs as UrlEntry values (wrapper over getUrls).

Link copied to clipboard

Returns all URLs associated with this contact (vcard:url), each paired with its URLType classification. URLs without a recognized type default to URLType.Home.

Link copied to clipboard
fun removeEmailAddress(emailAddress: String): Boolean

Removes the vcard:hasEmail entry for emailAddress from this contact's quad list.

Link copied to clipboard
fun removePhoneNumber(phoneNumber: String): Boolean

Removes the vcard:hasTelephone entry for phoneNumber from this contact's quad list.

Link copied to clipboard

Removes the contact's photo link (vcard:hasPhoto).

Link copied to clipboard

Removes the vcard:url entry whose value is url from this contact's quad list.

Link copied to clipboard
fun setAnniversary(anniversary: String?)

Sets (or clears, when null) the contact's anniversary (vcard:anniversary), typed xsd:dateTime when the value contains a time component and xsd:date otherwise.

Link copied to clipboard
fun setBirthday(birthday: String?)

Sets (or clears, when null) the contact's birthday (vcard:bday).

Link copied to clipboard
fun setCategories(categories: List<String>)

Replaces the contact's category tags with categories (trimmed, de-duplicated, blanks dropped).

Link copied to clipboard

Rewrites this contact's writable state from data with replace semantics: every multi-valued entry (phones, emails, instant messages, addresses, URLs) and every optional literal is replaced by the snapshot's content; properties absent from data are removed. The photo link (vcard:hasPhoto) is left untouched.

Link copied to clipboard
fun setFullName(name: String)

Sets the contact's formatted display name.

Link copied to clipboard
fun setGender(gender: Gender?)

Sets (or clears, when null) the contact's gender (vcard:hasGender, an IRI).

Link copied to clipboard
fun setGeos(geos: List<String>)

Replaces the contact's geographic positions with geos (trimmed, de-duplicated, blanks dropped). Each entry is stored as a direct IRI object per the W3C vCard ontology (vcard:hasGeo <geo:…>); a bare lat,lng pair is prefixed with the geo: scheme so the stored object is always a valid IRI.

Link copied to clipboard
fun setJobTitle(jobTitle: String?)

Sets (or clears, when null) the contact's job title (vcard:title).

Link copied to clipboard
fun setLanguages(languages: List<String>)

Replaces the contact's languages with languages (BCP-47 tags; trimmed, de-duplicated case-insensitively, blanks dropped). Each tag lives on a counter-labelled blank node (_:lang{n}) carrying vcard:language, the W3C vCard ontology mapping of the vCard 4.0 LANG property.

Link copied to clipboard
fun setName(name: Name?)

Sets (or clears) the contact's structured name (vcard:hasName).

Link copied to clipboard
fun setNickname(nickname: String?)

Sets (or clears, when null) the contact's nickname (vcard:nickname).

Link copied to clipboard
fun setNote(note: String?)

Sets (or clears, when null) the contact's note (vcard:note).

Link copied to clipboard
fun setOrganizationName(organizationName: String?)

Sets (or clears, when null) the contact's organization name (vcard:organization-name).

Link copied to clipboard

Sets (or clears, when null) the contact's organizational unit.

Link copied to clipboard
fun setPhoto(photoUri: String)

Sets the contact's photo link (vcard:hasPhoto) to photoUri.

Link copied to clipboard
fun setRole(role: String?)

Sets (or clears, when null) the contact's role (vcard:role).

Link copied to clipboard
fun setUid(uid: String?)

Sets (or clears, when null) the contact's persistent identifier (vcard:hasUID, IRI). A value that is already an absolute IRI (urn:uuid:…, https://…) is stored verbatim; anything else (e.g. a bare UID from a .vcf import) is wrapped as urn:uid:{percent-encoded value} so the stored object is always a valid IRI.

Link copied to clipboard

Reads this contact's complete writable state into a ContactData snapshot.

Link copied to clipboard
open override fun writeToParcel(dest: Parcel, flags: Int)