Reification (computer science)
Reification is the process by which an abstract idea about a
Reflective programming languages
In the context of
- The C programming language reifies the low-level detail of memory addresses.Many programming language designs encapsulate the details of memory allocation in the compiler and the run-time system. In the design of the C programming language, the memory address is reified and is available for direct manipulation by other language constructs. For example, the following code may be used when implementing a memory-mapped device driver. The buffer pointer is a proxy for the memory address 0xB8000000.
char* buffer = (char*) 0xB8000000; buffer[0] = 10;
- lambda-calculus reify the concept of a procedure abstraction and procedure application in the form of the Lambda expression.
- The continuations(approximately, the call stack).
- In C#, reification is used to make parametric polymorphism implemented in the form of generics as a first-class feature of the language.
- In the Java programming language, there exist "reifiable types" that are "completely available at run time" (i.e. their information is not erased during compilation).[2]
- REBOLreifies code as data and vice versa.
- Many languages, such as Lisp, JavaScript, and Curl, provide an
eval
orevaluate
procedure that effectively reifies the language interpreter. - The Logtalk framework for Prolog offers a means to explore reification in the context of logic programming.
- Smalltalk and Actor languages permit the reification of blocks and messages,[3] which are equivalent of lambda expressions in Lisp, and
thisContext
in Smalltalk, which is a reification of the current executing block. - Homoiconic languages reify the syntax of the language itself in the form of an abstract syntax tree, typically together with
eval
.
Data reification vs. data refinement
Data reification (
Data reification is the terminology of the Vienna Development Method (VDM) that most other people would call data refinement. An example is taking a step towards an implementation by replacing a data representation without a counterpart in the intended implementation language, such as sets, by one that does have a counterpart (such as maps with fixed domains that can be implemented by arrays), or at least one that is closer to having a counterpart, such as sequences. The VDM community prefers the word "reification" over "refinement", as the process has more to do with concretising an idea than with refining it.[4]
For similar usages, see
In conceptual modeling
Reification is widely used in
IsMemberOf(member:Person, Committee)
. An instance of IsMemberOf
is a relationship that represents the fact that a person is a member of a committee. The figure below shows an example population of IsMemberOf
relationship in tabular form. Person P1 is a member of committees C1 and C2. Person P2 is a member of committee C1 only. ![](http://upload.wikimedia.org/wikipedia/commons/thumb/7/74/Reification_example1.png/500px-Reification_example1.png)
IsMemberOf
relationship in tabular form. Person P1 is a member of committees C1 and C2. Person P2 is a member of committee C1 only.The same fact, however, could also be viewed as an entity. Viewing a relationship as an entity, one can say that the entity reifies the relationship. This is called reification of a relationship. Like any other entity, it must be an instance of an entity type. In the present example, the entity type has been named Membership
. For each instance of IsMemberOf
, there is one and only one instance of Membership
, and vice versa. Now, it becomes possible to add more information to the original relationship. As an example, we can express the fact that "person p1 was nominated to be the member of committee c1 by person p2". Reified relationship Membership
can be used as the source of a new relationship IsNominatedBy(Membership, Person)
.
For related usages see Reification (knowledge representation).
In Unified Modeling Language (UML)
![](http://upload.wikimedia.org/wikipedia/commons/thumb/d/d0/Reification_example2.png/400px-Reification_example2.png)
UML provides an association class construct for defining reified relationship types. The association class is a single model element that is both a kind of association[6] and a kind of class.[7]
The association and the entity type that reifies are both the same model element. Note that attributes cannot be reified.
On Semantic Web
RDF and OWL
In Semantic Web languages, such as Resource Description Framework (RDF) and Web Ontology Language (OWL), a statement is a binary relation. It is used to link two individuals or an individual and a value. Applications sometimes need to describe other RDF statements, for instance, to record information like when statements were made, or who made them, which is sometimes called "provenance" information. As an example, we may want to represent properties of a relation, such as our certainty about it, severity or strength of a relation, relevance of a relation, and so on.
The example from the conceptual modeling section describes a particular person with URIref person:p1
, who is a member of the committee:c1
. The RDF triple from that description is
person:p1 committee:isMemberOf committee:c1 .
Consider to store two further facts: (i) to record who nominated this particular person to this committee (a statement about the membership itself), and (ii) to record who added the fact to the database (a statement about the statement).
The first case is a case of classical reification like above in UML: reify the membership and store its attributes and roles etc.:
committee:Membership rdf:type owl:Class .
committee:membership12345 rdf:type committee:Membership .
committee:membership12345 committee:ofPerson person:p1 .
committee:membership12345 committee:inCommittee committee:c1 .
person:p2 committee:nominated committee:membership12345 .
Additionally, RDF provides a built-in vocabulary intended for describing RDF statements. A description of a statement using this vocabulary is called a reification of the statement. The RDF reification vocabulary consists of the type rdf:Statement
, and the properties rdf:subject
, rdf:predicate
, and rdf:object
.[8]
Using the reification vocabulary, a reification of the statement about the person's membership would be given by assigning the statement a URIref such as committee:membership12345
so that describing statements can be written as follows:
committee:membership12345Stat rdf:type rdf:Statement .
committee:membership12345Stat rdf:subject person:p1 .
committee:membership12345Stat rdf:predicate committee:isMemberOf .
committee:membership12345Stat rdf:object committee:c1 .
These statements say that the resource identified by the URIref committee:membership12345Stat
is an RDF statement, that the subject of the statement refers to the resource identified by person:p1
, the predicate of the statement refers to the resource identified by committee:isMemberOf
, and the object of the statement refers to the resource committee:c1
. Assuming that the original statement is actually identified by committee:membership12345
, it should be clear by comparing the original statement with the reification that the reification actually does describe it. The conventional use of the RDF reification vocabulary always involves describing a statement using four statements in this pattern. Therefore, they are sometimes referred to as the "reification quad".[8]
Using reification according to this convention, we could record the fact that person:p3
added the statement to the
database by
person:p3 committee:addedToDatabase committee:membership12345Stat .
It is important to note that in the conventional use of reification, the subject of the reification triples is assumed to identify a particular instance of a triple in a particular RDF document, rather than some arbitrary triple having the same subject, predicate, and object. This particular convention is used because reification is intended for expressing properties such as dates of composition and source information, as in the examples given already, and these properties need to be applied to specific instances of triples.
Note that the described triple (subject predicate object)
itself is not implied by such a reification quad (and it is not necessary that it actually exists in the database). This allows also to use this mechanism to express which triples do not hold.
The power of the reification vocabulary in RDF is restricted by the lack of a built-in means for assigning URIrefs to statements, so in order to express "provenance" information of this kind in RDF, one has to use some mechanism (outside of RDF) to assign URIs to individual RDF statements, then make further statements about those individual statements, using their URIs to identify them.[8]
In Topic Maps
In an
n-ary relations
In Semantic Web languages, such as RDF and OWL, a property is a binary relation used to link two individuals or an individual and a value. However, in some cases, the natural and convenient way to represent certain concepts is to use relations to link an individual to more than just one individual or value. These relations are called
A more general approach to reification is to create an explicit new class and n new properties to represent an n-ary relation, making an instance of the relation linking the n individuals an instance of this class. This approach can also be used to represent provenance information and other properties for an individual relation instance.[10]
:p1
a :Person ;
:has_membership _:membership_12345 .
_:membership_12345
a :Membership ;
:committee :c1;
:nominated_by :p2 .
Vs. quotation
It is also important to note that the reification described here is not the same as "quotation" found in other languages. Instead, the reification describes the relationship between a particular instance of a triple and the resources the triple refers to. The reification can be read intuitively as saying "this RDF triple talks about these things", rather than (as in quotation) "this RDF triple has this form." For instance, in the reification example used in this section, the triple:
committee:membership12345 rdf:subject person:p1 .
describing the rdf:subject
of the original statement says that the subject of the statement is the resource (the person) identified by the URIref person:p1
. It does not state that the subject of the statement is the URIref itself (i.e., a string beginning with certain characters), as quotation would.
See also
![](http://upload.wikimedia.org/wikipedia/commons/thumb/9/99/Wiktionary-logo-en-v2.svg/40px-Wiktionary-logo-en-v2.svg.png)
- Denotational semantics
- Formal semantics of programming languages
- Meta-circular evaluator
- Metamodeling
- Metaobject
- Metaprogramming
- Normalization by evaluation
- Operational semantics
- Reflection (computer science)
- Resource Description Framework
- Self-interpreter
- Topic Maps
References
- ^ J. Malenfant, M. Jacques and F.-N. Demers, A Tutorial on Behavioral Reflection and its Implementation Archived 2010-05-28 at the Wayback Machine
- ^ The Java Language Specification, section 4.7, Java SE 7 Edition
- ^ "Smalltalk Blocks And Closures". C2.com. 2009-10-15. Retrieved 2010-10-09.
- ^ Formal Methods Europe, Frequently Asked Questions, part 13 Archived 2005-03-12 at the Wayback Machine.
- ^ Antoni Olivé, Conceptual Modeling of Information Systems, Springer Verlag, 2007.
- ^ "Associations". Unified Modeling Language 2.5.1. OMG Document Number formal/2017-12-05. Object Management Group Standards Development Organization (OMG SDO). December 2017. p. 199.
- ^ "Classes". Unified Modeling Language 2.5.1. OMG Document Number formal/2017-12-05. Object Management Group Standards Development Organization (OMG SDO). December 2017. p. 194.
- ^ a b c "RDF Primer". W3.org. Retrieved 2010-10-09.
- ^ Practical Introduction into Topic Maps Archived 2009-02-03 at the Wayback Machine.
- ^ "W3C Defining N-ary relations on Semantic Web". W3.org. Retrieved 2010-10-09.