WebId

open class WebId : SolidRDFResource

Represents a Solid WebID identity document — both for reading profile data and for constructing or updating it.

A WebID document is an RDF resource that describes an agent. It MUST contain:

  • rdf:type foaf:Agent

  • pim:preferencesFile pointing to the agent's preferences file

It MAY contain:

  • pim:storage (one or more storage roots)

  • ldp:inbox (notification inbox)

  • rdfs:seeAlso (extended profile documents)

  • foaf:isPrimaryTopicOf

  • solid:oidcIssuer (OIDC identity provider)

  • FOAF name / given name / family name / photo

  • foaf:knows (social graph)

  • acl:trustedApp (trusted client applications)

  • cert:key (public key for WebID-TLS)

Use getMetadata (from SolidRDFResource) to access the ETag, ACL URI, and allowed methods returned by the server — useful for conditional PUT updates.

Spec: https://solid.github.io/webid-profile/

Constructors

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

Types

Link copied to clipboard
object Companion

Functions

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 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 a snapshot copy of all triples held by this resource.

Link copied to clipboard

Returns all cert:key public-key URIs listed in this profile.

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
open override fun getEntity(): InputStream

Returns the resource representation as a byte stream.

Link copied to clipboard

Returns the foaf:familyName literal, or null if not declared.

Link copied to clipboard

Returns the foaf:givenName literal, or null if not declared.

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 the ldp:inbox URI, or null if not declared.

Link copied to clipboard

Returns all foaf:knows WebID URIs listed in this profile.

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(): String?

Returns the foaf:name literal, or null if not declared.

Link copied to clipboard

Returns all solid:oidcIssuer URIs declared in this profile.

Link copied to clipboard

Returns the foaf:img photo URI, or null if not declared.

Link copied to clipboard

Returns the pim:preferencesFile URI, or null if not declared.

Link copied to clipboard

Returns all foaf:isPrimaryTopicOf document URIs.

Link copied to clipboard

Returns the solid:privateTypeIndex URI, or null if not declared.

Link copied to clipboard

Returns the solid:publicTypeIndex URI, or null if not declared.

Link copied to clipboard

Returns all rdfs:seeAlso (extended profile) document URIs.

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

Returns all pim:storage root URIs declared in this profile.

Link copied to clipboard

Returns all acl:trustedApp URIs listed in this profile.

Link copied to clipboard

Returns all rdf:type values declared in this profile.

Link copied to clipboard
fun setInbox(webId: String, storage: String, uri: String = "/inbox/")

Adds an ldp:inbox triple to this profile document.

Link copied to clipboard
fun setOidcIssuer(webId: String, issuerUri: String)

Adds a solid:oidcIssuer triple to this profile document.

Link copied to clipboard
fun setPreferencesFile(webId: String, storage: String, uri: String = "/settings/prefs.ttl")

Adds a pim:preferencesFile triple to this profile document.

Link copied to clipboard
fun setPrivateTypeIndex(webId: String, storage: String, uri: String = "/settings/privateTypeIndex")

Adds a solid:privateTypeIndex triple to this profile document.

Link copied to clipboard
fun setPublicTypeIndex(webId: String, storage: String, uri: String = "/settings/publicTypeIndex")

Adds a solid:publicTypeIndex triple to this profile document.

Link copied to clipboard
fun setStorage(webId: String, storageUri: String)

Adds a pim:storage triple to this profile document.

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