Writing Mappings/Templates: Difference between revisions

From DBpedia Mappings
Jump to navigationJump to search
(Redirected page to How to edit DBpedia Mappings)
 
(12 intermediate revisions by 5 users not shown)
Line 1: Line 1:
The full [http://dbpedia.svn.sourceforge.net/viewvc/dbpedia/trunk/extraction/doc/mapping%20language/DBpedia%20Mapping%20Language.docx documentation] on writing mappings can be found via the DBpedia SVN Repository.
#REDIRECT [[How to edit DBpedia Mappings]]
 
== How to map a Wikipedia template ==
 
* Get the encoded template page name from Wikipedia.
** ''Example'': For the Wikipedia template [http://en.wikipedia.org/wiki/Template:Infobox_musical_artist Infobox musical artist] use <code>Infobox_musical_artist</code>.
* Create a wiki page in this wiki in the Mapping namespace, using the encoded Wikipedia template page name.
** ''Example'': For the Wikipedia template [http://en.wikipedia.org/wiki/Template:Infobox_musical_artist Infobox musical artist] create the wiki page [[Mapping:Infobox_musical_artist]].
* Decide on the ontology class you would like to map the template to.
** ''Example'': Ontology classes belong to the Class namespace. A list of existing ontology classes can be found via the sidebar ([http://mappings.dbpedia.org/index.php?title=Special%3AAllPages&from=&to=&namespace=100 Ontology Classes]).
* Write a [[Template:TemplateMapping]] or [[Template:ConditionalMapping]] to map the Wikipedia template to an ontology class.
 
== Template to Ontology Mapping Language ==
 
When mapping a Wikipedia template to an ontology class and mapping template properties to ontology properties for this template, users will have to edit the corresponding template documentation page in MediaWiki.
 
The following templates cover the template to ontology schema mapping:
* [[#Template_Mapping|TemplateMapping]] Mapping from Wikipedia templates to ontology classes.
* [[#Property_Mapping|PropertyMapping]] Mapping from Wikipedia template properties to ontology properties.
* [[#Intermediate_Node_Mapping|IntermediateNodeMapping]] For extracting multiple values from a single property it is necessary to introduce an intermediate node. The IntermediateNodeMapping allows to express mappings from Wikipedia template properties to ontology properties on an additional node and to connect the additional node to the mapped instance.
* [[#Conditional_Mapping|ConditionalMapping]]
* [[#Custom_Mappings|Custom mappings]]
** To cover specific, more complex mapping cases, the DBpedia extraction framework can be extended with custom parsers which have to implement a specific PHP interface. These parsers are invoked using custom mappings.
 
=== Template Mapping ===
 
The [[Template:TemplateMapping|TemplateMapping]] template offers the following template parameters:
* ''mapToClass''
** Templates are mapped to ontology classes. The template parameter mapToClass allows one DBpedia ontology class as a value.
* ''correspondingClass'', ''correspondingProperty''
** In the case that different templates are used on the same page (for instance Automobile and Automobile Generation), the instance resulting from the second grade template (Automobile Generation) can be connected to the instance of the first grade template (Automobile) using a corresponding property. Thus, if an instance of type correspondingClass is found on the same page, it will be connected to the instances of the mapped template by correspondingProperty.
* ''mappings''
** Mappings map template properties to ontology properties, they have to be defined by using PropertyMapping or IntermediateNodeMapping. Custom, user-defined, mappings like the GeocoordinatesMapping can also be defined.
 
=== Property Mapping ===
 
The [[Template:PropertyMapping|PropertyMapping]] template offers the following template parameters:
* ''ontologyProperty''
** A template property to ontology property mapping should list one ontology property.
* ''templateProperty''
** A template property to ontology property mapping should list one template property which is to be mapped.
* ''unit''
** If a template property containing a numerical value and a unit is mapped, the unit has to be defined. If a template property has no default unit defined, e.g. its values can contain different units of the same dimension, the dimension has to be defined for usability as well as validation reasons. Possible dimensions are Length or Mass.
 
=== Intermediate Node Mapping ===
 
The [[Template:IntermediateNodeMapping|IntermediateNodeMapping]] template offers the following template parameters:
* ''nodeClass'', ''correspondingProperty''
** Creates an additional node of the type nodeClass, which will be connected to the instance extracted from template by the property provided by correspondingProperty.
* ''mappings''
** Mappings map template properties to ontology properties, they have to be defined by using PropertyMapping, IntermediateNodeMapping, or a CustomMapping.
 
=== Conditional Mapping ===
 
 
 
=== Custom Mappings ===
 
For specific tasks, such as extracting durations or calculating a geo-location-ID based on multiple properties, we allow the DBpedia extraction framework to be extended with custom value parsers and allow the definition of DBpedia custom mapping templates. The name of a custom mapping template has to be equal to the name of the corresponding DBpedia parser class.
As examples of custom mapping, we define the DateIntervalMapping and the GeocoordinatesMapping.
 
The [[Template:DateIntervalMapping|DateIntervalMapping]] template provides an exact mapping from start and end dates of a template property value to ontology properties. It offers the following template parameters:
* ''templateProperty''
* ''startDateOntologyProperty''
* ''endDateOntologyProperty''
 
The [[Template:GeocoordinatesMapping|GeocoordinatesMapping]] template offers the following template parameters:
* ''coordinates''
** Use the coordinates parameter if the geo coordinates are covered by one template property.
 
* ''latitude''
* ''longitude''
 
* ''latitudeDirection''
* ''latitudeDegrees''
* ''latitudeMinutes''
* ''latitudeSeconds''
* ''longitudeDirection''
* ''longitudeDegrees''
* ''longitudeMinutes''
* ''longitudeSeconds''
 
* ''ontologyProperty''
 
The [[Template:CombineDateMapping|CombineDateMapping]] template offers the following template parameters:
* ''templateProperty1''
* ''unit1''
* ''templateProperty2''
* ''unit2''
* ''templateProperty3''
* ''unit3''
* ''ontologyProperty''
 
The [[Template:CalculateMapping|CalculateMapping]] template offers the following template parameters:
* ''operation''
* ''templateProperty1''
* ''unit1''
* ''templateProperty2''
* ''unit2''
* ''ontologyProperty''

Latest revision as of 12:09, 7 July 2011