Help:Upgrading from 0.7 to 1.0

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


This page contains outdated information and is thus OBSOLETE!
Please use this page instead: Help:Upgrading from 0.7 to 1.0
This documentation page applies to all SMW versions from 0.7 to 0.7.
     

Help:Upgrading from 0.7 to 1.0 en 0.7 0.7


The INSTALL document in the SMW download describes how to upgrade from SMW 0.7 to SMW 1.0.

This page lists some of the changes between the two versions.

Before upgrading

  • Generate lists of all Attributes and Relations using their special pages. If any names overlap, change one of them. The attribute will "win" after the upgrade. You can use the script SMW_unifyProperties.php with the -c option to check if any pages overlap; the -v option will tell you which ones they are
  • Find all attributes that don't have a type, and give them one with [[has type::Type:sometype]]. To help find these, Special:Attributes will show any attribute without a page (thus it doesn't have a type) in red.

During upgrade

  1. See the INSTALL document.
  2. Run the SMW_unifyProperties.php script. This will move all non-overlapping relation pages to the property-namespace
  3. Run the SMW_refreshData.php script with -p option, then again.

Fallout from Relation and Attribute unified to Property

Help:Properties and types describes property, and its section "Relations" and "Attributes" in earlier versions describes the specific change.

Attributes and relations become properties, in a single Property namespace.

This is a big change, but because

  • the default for a property is Type:Page, which matches the former Relation — the property's object is another wiki page, displayed as a link.
  • the := annotation still works
  • most annotations and queries don't include Relation: or Attribute: (or Property:), they infer it from the :=/:: syntax.
  • the old Attribute namespace becomes the Property namespace, so SMW can still find essential special properties like Property:Has type.

your Wiki will work pretty well immediately after the upgrade!

The visible changes after upgrading include:

  • All wiki pages that were in the Attribute namespace are now in the Property namespace, i.e. the text in the old Attribute:'Foo' page is now in the Property:Foo page. (This is good, it means properties that were formerly attributes with types and conversion factors and units still work.)
  • Explicit links to Attribute: pages are broken
  • Wiki pages in the Relation namespace still exist, but the factbox and Special:Browse will link to the title in the Property namespace.
  • Links to the Special:Attributes and Special:Relations pages are broken
  • Pages that assigned values to untyped attributes would display fine in 0.7 but show [Oops! No type defined for attribute] in the factbox; in SMW 1.0 these become properties that default to Type:Page and so display their value as a link.
  • If you had a relation and an attribute with the same name, the attribute foo becomes the Property:Foo page and thus "wins". All property assignments will use the type of the former attribute. You will have to create a new name for the former relation, find all the pages that used the relation and change them to use the new name.

Fixing up former relations and attributes

  • Use the SMW_unifyProperties.php script
  • Short-term: fix broken links to Attribute: and Relation: pages.
    • First run MediaWiki's refreshLinks.php, otherwise every page with semantic annotations will misleadingly count towards missing Attribute or Relation until you re-save the page.
    • Then Special:Wantedpages will list the remaining Attribute and Relation pages that have explicit links to them.
    • You could create the obsolete attribute and relation pages, making each redirect to its Property page using #REDIRECT [[Property:{{PAGENAME}}]], or better you can fix the broken links to the and replace the text "[[Relation:" and "[[Property:" on it with [[Property:.
  • Short-term: find former attributes that lacked a type and give them one (e.g. [[has type::Type:String]]). Special:WantedProperties might help.
  • Use Special:Allpages to find all pages in the Relation namespace and move them to properties.
  • If you had a former Attribute: and Relation: with the same page name, you will have to change the relation property's name.
  • Long-term cleanup: change := in former attribute assignments and inline queries to ::
  • Long-term cleanup: add an explicit [[has type::Type:Page]] to the Property page of every former Relation pages, creating the page if necessary.

aliased names

Aliased Types

Type:Integer and Type:Float are aliases for the new datatype Number. Pages using the old types should continue to work, but the code makes no distinction between whole numbers and floating-point numbers.

URI is an alias for URL.

Type:Enumeration is an alias for the Type:String, since the special property allows value can apply to any property.

(Type:Enumeration may return as a separate type in a future version of SMW to permit further control over enumaration order and display.)

Display units

The special property Display Unit is an alias for the new special property Display units. The latter is new and takes a comma-separated list of units. When used on property pages that have a datatype that supports units, the effect is that all printouts will show the values only in the given units, and only in that order. This makes the special property "main display unit" obsolete, since this was just a way of encoding the first of the display units.

You need to find all pages with Property:Main display unit and remove this special property, adding the primary unit to the front of a list of display units. For example, if Property:Weight used to have

[[Main display unit:=kg]] and [[Display unit:=lbs]]

after upgrading weights will only appear in lbs. You need to replace this with

[[display units::kg, lbs]]

English names and localization

In previous SMW versions, if your wiki used a language other than English, you had to use the localized names, for example [[Hat Datentyp::Datentyp:Zeichenkette]] instead of [[Has type::Type:String]]. Now the English labels are allowed in all languages. It's possible this new feature may introduce a conflict with existing page and namespace names in your Wiki.

Other changes

Many error strings are replaced with a yellow triangular caution icon, which pops up the error text when clicked.

Allows value

Property:allows value can apply to any property. In previous SMW versions using allows_value for a property of some type besides Type:Enumeration would have no effect, now it does.

Missing pages

As remarked elsewhere, Special:Attributes, Special:Relations are gone, replaced by the unified Special:Properties.

Special:SearchTriple is gone, replaced by Special:SearchByProperty.

Inline query changes

double brackets always required

In SMW 0.7 it seems you could use a "naked" page name, or more likely the template variable ( {{PAGENAME}} or {{FULLPAGENAME}}, in an inline query. In SMW 1.0pre-alpha3 you must wrap the pagename with double brackets. For example, if you showed properties for items in a category on a category page with

<ask>{{FULLPAGENAME}}[[located in::*]]</ask>

you must use

<ask>[[{{FULLPAGENAME}}]][[located in::*]]</ask>

default query is a list

Inline queries used to appear as a table by default. In SMW 1.0, you just get a comma-separated list. To ensure a table, add format="table" inside the <ask> tag.