A phone, specified using fully qualified tel: URI scheme.
foaf:phone is one of the few FOAF properties whose definition dictates the value format. A phone is to be specified using a fully qualified tel: URI, and the object of the property is that URI, not a free-text string. Published FOAF data often ignores this, which is exactly why it is worth getting right.
The tel: URI in brief
The tel: scheme is defined in RFC 3966. A global number starts with + and the country calling code, followed by the national number. Visual separators (hyphens, dots, parentheses) are permitted and ignored when the number is compared.
| Written as | tel: URI |
|---|---|
| +44 20 7946 0000 | tel:+44-20-7946-0000 |
| 555-0142, extension 27, in the US | tel:+1-555-0142;ext=27 |
| internal 4410 at example.org | tel:4410;phone-context=example.org |
“Fully qualified” in the FOAF definition points at the first two forms. A local number without context is ambiguous outside its own building, and the third form is rarely appropriate in published data.
Spaces are not allowed inside a URI, so tel:+44 20 7946 0000 is malformed. Hyphens are the common substitute.
Numbers that start with a national trunk prefix need it removed before the country code is added. A London number written locally as 020 7946 0000 becomes +44-20-7946-0000, without the leading zero. Italy is the well-known exception, where the leading zero of landline numbers is kept after +39. Converting a list of local numbers by blindly stripping zeros will break every Italian landline in it.
Why a URI and not a string
Using a URI has two practical effects. First, the value is directly actionable: browsers and phones open tel: links in a dialer, so any interface built on the data gets click-to-call without extra parsing. Second, it makes matching possible. Two records with tel:+1-555-0142 refer to the same number, while the strings “555-0142”, “(555) 0142” and “+1 555 0142” need normalization first.
In RDF/XML the property therefore takes rdf:resource, as in the example. In Turtle the value goes in angle brackets: foaf:phone <tel:+1-555-0142>. Writing it in quotes makes it a literal, which is the error most validators report.
Where phone numbers appear in collection data
Archival and library data sets rarely publish personal phone numbers, and for good reason: contact details for living people are personal data under privacy laws such as the GDPR. The usual legitimate use is for organizations: reading rooms, repositories, departments. That is what the example shows, a foaf:name and a public switchboard number on an organization.
When historical records contain phone numbers (a 1960s correspondence file, for instance) those numbers are part of the content, not contact metadata, and should not be lifted into foaf:phone at all. Old numbers have been reassigned many times since, and publishing them as contact data would send calls to strangers.
Neighboring properties and alternatives
FOAF’s contact properties are few: foaf:mbox for mailboxes (as mailto: URIs), foaf:phone, and account properties for online services. There is no built-in way to say a number is a fax or a mobile line. The W3C vCard ontology fills that gap with vcard:hasTelephone and typed values, and many current profiles prefer it for detailed contact information.
The country code inside a tel: URI is an ITU calling code, not an ISO 3166 country code. +1 covers the United States, Canada and much of the Caribbean, and +7 covers both Russia and Kazakhstan. Deriving a country from a phone number is unreliable, so country data should be recorded separately.
Example in RDF
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:foaf="http://xmlns.com/foaf/0.1/">
<foaf:Organization rdf:about="https://example.org/id/org/reading-room">
<foaf:name>Example Reading Room</foaf:name>
<foaf:phone rdf:resource="tel:+1-555-0142"/>
</foaf:Organization>
</rdf:RDF>
Questions about foaf:phone
What value does foaf:phone expect?
A resource identified by a tel: URI, such as tel:+44-20-7946-0000. The FOAF definition asks for a fully qualified tel: URI, which means an international number beginning with a plus sign and the country calling code.
Can I write foaf:phone as a plain string?
Many published FOAF files do, but it is not what the specification describes. A literal like '020 7946 0000' cannot be dialed by software without knowing the country, and it does not match other data that uses tel: URIs.
Which standard defines the tel: URI?
The tel: URI scheme is defined in RFC 3966, published by the IETF in 2004. It specifies global numbers with a leading plus and country code, optional visual separators such as hyphens, and local numbers that need a phone-context parameter.
How do I add an extension number?
RFC 3966 provides an ext parameter, for example tel:+1-555-0142;ext=27. The extension is part of the URI, so no separate property is needed. Software that dials the number from a link will usually pause and send the extension once the call connects.
Is there an alternative to foaf:phone for contact details?
The W3C vCard ontology offers vcard:hasTelephone, which can also distinguish types such as work, home or fax. Projects that need typed contact details often use it alongside or instead of foaf:phone.