The **_Time-indexed Value in Context pattern (TVC)_** is an Ontology Design Pattern for the description of scenarios that involve entities having some value during a particular time and within a particular context.

Sometimes, we need to describe scenarios in which someone (e.g., a person) has a value (e.g., a particular role) during a particular time and for a particular context.
Four different things are involved in these kinds of scenarios:
1. the _entity_ having some value, e.g. a person or a document possessing a role or a status;
2. the _value_ had by someone, e.g. a role or a status;
3. the _time period_ during which the entity has that value, e.g. from April 2008 to September 2008;
4. the particular _context_ that characterises the act of having that value, e.g. being a member of an institution or an editor of a particular journal.
Thought as a natural extension of the [_Time-indexed Situation pattern_](http://ontologydesignpatterns.org/wiki/Submissions:TimeIndexedSituation), TVC is able to describe these kinds of scenarios.
## Examples of use
In the following subsections, we introduce some examples to showcase how to use TVC.
The prefixes that are used in all the examples provided below are defined as follows:
@prefix : <http://www.sparontologies.net/example/> .
@prefix tvc: <http://www.essepuntato.it/2012/04/tvc/> .
@prefix ti: <http://www.ontologydesignpatterns.org/cp/owl/timeinterval.owl#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
### Holding a role within a specific time frame
TVC easily allows one to model people's roles within certain contexts (e.g., organisations) and how these change through time, while keeping track of the fact that they all refer to the same entities.
The following example shows how to model the fact that a researcher holds the role of editor-in-chief for a scientific journal for a specific time interval.
:john-doe a foaf:Person ;
tvc:hasValue :editorial-role-situation .
:editorial-role-situation a tvc:ValueInTime ;
tvc:withValue :editor-in-chief ;
tvc:withinContext :journal-of-semantics ;
tvc:atTime :tenure-interval .
:tenure-interval a ti:TimeInterval ;
ti:hasIntervalStartDate "2020-01-01"^^xsd:date ;
ti:hasIntervalEndDate "2024-12-31"^^xsd:date .
:journal-of-semantics a foaf:Organization .
## Competency Questions
TVC can be used for answering several questions related to values that change in time, according to some context.
In the following subsections, some of them are introduced together with their respective SPARQL queries.
The prefixes that are used in all the SPARQL queries provided below are defined as follows:
PREFIX : <http://www.sparontologies.net/example/>
PREFIX tvc: <http://www.essepuntato.it/2012/04/tvc/>
PREFIX ti: <http://www.ontologydesignpatterns.org/cp/owl/timeinterval.owl#>
### CQ1
What value did a specific entity hold, within which context, and during what time interval?
SELECT ?value ?context ?startDate ?endDate WHERE {
:john-doe tvc:hasValue ?sit .
?sit tvc:withValue ?value ;
tvc:withinContext ?context ;
tvc:atTime ?interval .
OPTIONAL { ?interval ti:hasIntervalStartDate ?startDate . }
OPTIONAL { ?interval ti:hasIntervalEndDate ?endDate . }
}
### CQ2
Which entities held a specific value within a given context?
SELECT ?entity ?sit WHERE {
?entity tvc:hasValue ?sit .
?sit tvc:withValue :editor-in-chief ;
tvc:withinContext :journal-of-semantics .
}