Understanding IRI in RDF/SPARQL

An IRI is one of the most fundamental concepts in RDF and SPARQL and is critical in understanding how the ontology is used in the construction of graphs.

What is an IRI?

An IRI (Internationalized Resource Identifier) is the globally unique identifier used to name anything in an RDF graph—classes, properties, individuals, datasets, even abstract concepts.

The IRI is everywhere in your ontology — every class, every property, every individual is identified by an IRI.

It’s the RDF/SPARQL equivalent of a URL, but with support for Unicode. In SPARQL, IRIs appear whenever you use a prefix or a full URI.

Examples:

  • http://www.w3.org/2002/07/owl#Class
  • https://banking-ontology.example.org/def/Account
  • http://example.org/customer/12345

Role of an IRI

IRIs play three different roles in an ontology:

Ontology namespace

The ontology declares a base namespace, and every term in the ontology lives inside that namespace.

Example from the loaded banking-ontology:

PREFIX bank: <https://banking-ontology.example.org/def/>

This means:

Every term beginning with bank: expands to an IRI inside that namespace. In this aspect, IRI helps to name the term in uniquely.

For example, bank:owns becomes:

https://banking-ontology.example.org/def/owns

Ontology Vocabulary

Inside the ontology file (usually an OWL or RDF file), IRIs are used to define:

  • Classes (e.g., bank:Account, bank:Regulation)
  • Properties (e.g., bank:owns, bank:hasAccount, bank:compliesWith)
  • Individuals (e.g., bank:Regulation123)

These IRIs are declared using RDF/OWL constructs such as:

Subject Predicate Object
--------- ----------- ---------
bank:Account rdf:type owl:Class .
bank:owns rdf:type owl:ObjectProperty .

Instance Data

Where actual data is stored, IRIs identify real-world entities:

<http://example.org/customer/123> bank:owns <http://example.org/account/456> .

In the case noted above, the IRIs are not defined in the ontology—they are created in the query or your data source dynamically. The ontology only defines the vocabulary used to describe them.

IRI vs URI vs Literal

An IRI and a URI both identify resources. A literal represents data values. Only IRIs/URIs can appear as subjects or predicates in RDF; literals can only appear as objects.

IRI — Internationalized Resource Identifier

An IRI is a globally unique identifier for anything in RDF: classes, properties, individuals, datasets. It is the modern, Unicode‑friendly version of a URI. IRIs can identify:

  • Classes → bank:Customer
  • Properties → bank:owns
  • Individuals → e.g., <http://example.org/customer/123>
  • Ontologies themselves

URI — Uniform Resource Identifier

A URI is the older standard. Technically, every IRI is a URI, except that IRIs allow Unicode characters. In practice:

  • RDF 1.1 uses IRI everywhere
  • SPARQL uses IRI everywhere
  • Ontology tools treat URI and IRI as synonyms

So the ontology uses IRIs, even though many people still say “URI.”

Literal — Data value, not an identifier

A literal is a value, not a resource. From example, from our ontology:

"Financial Institution"
"2024-01-01"^^xsd:date
42
true

Literals CANNOT be subjects, predicates or objects. Literals represent:

  • Text
  • Numbers
  • Dates
  • Booleans
  • Typed values ("123"^^xsd:int)
Figure 1: What forms IRI and Literal

In Figure 1, the two triples means two different things:

1. Triple A expresses a real-world relationship

This triple asserts a semantic relationship defined in your ontology: A Customer owns an Account.

bank:Customer bank:owns bank:Account .

This triple uses IRIs in all three positions:

  • Subject: bank:Customer → an IRI identifying a class
  • Predicate: bank:owns → an IRI identifying an object property
  • Object: bank:Account → an IRI identifying a class

2. Triple B expresses a human-readable annotation

This triple does not define a relationship in the domain. It simply gives a text label for UI or documentation: “The human-readable name of this class is ‘Customer’.”

bank:Customer rdfs:label “Customer” .

This triple uses:

  • Subject: bank:Customer → an IRI
  • Predicate: rdfs:label → an IRI
  • Object: "Customer" → a literal

Comments

Leave a Reply

Check also

View Archive [ -> ]

Discover more from ANALYTI

Subscribe now to keep reading and get access to the full archive.

Continue reading