Help:Datamodel

From semantic-mediawiki.org
Jump to: navigation, search

The most essential architectural choice of SMW is in its data model. This specifies the way in which semantic information is represented within the system – actually it specifies what semantic information is in SMW. The main concepts of this agree with the view of SMW users:

Data in SMW is represented by property-value pairs that are assigned to objects.

For example:

Dresden (object) has a population (property) of 517,052 (value).

We can elaborate this schema with additional facts:

  • The described objects are normally wiki pages.
  • Properties can be used everywhere. They do not belong to specific wiki pages, categories, etc.
  • Values can be of different types (numbers, dates, other wiki pages, ...).
  • The datatype is part of the value's identity (values of different types are different, even if they are based on the same user input).
  • Objects can have zero, one, or many values for any property.
  • A semantic fact is completely specified by its object, property, and value. For instance, it does not matter who specified a fact (in contrast to tagging systems where each user can have individual tags for the same thing).
  • Facts are either given or not given, but they cannot be given more than once (again in contrast to tagging systems where we count how often a tag has been given to a resource).
  • "Object" is a very general term, so we often use "subject" when we want to emphasize that a thing is the subject of a property-value assignment in a fact.

These ideas are reflected in the basic data model. All elements of a fact are represented by PHP objects of (subclasses of) the class SMWDataItem. Sets of semantic facts in turn are represented by objects of type SMWSemanticData. The main concepts of both are described below, details are explained in the source code documentation.

 Has description
DataItemrepresents the system perspective on the data to interact with a database in order to allow data to be managed, stored, and queried.
DataValuerepresents the user perspective on data which includes input and output specific rules.
SemanticData