Help:Adding subobjects/tr

From semantic-mediawiki.org
< Help:Adding subobjects
Adding subobjectsHelp:Adding subobjects/tr
Adding subobjects/tr
Bir sayfada alt nesne oluşturun
Further Information
Provided by: Semantic MediaWiki
Minimum version: 1.7.0
Maximum version: still supported
Function: yes
Tag: no
Name: #subobject
Table of Contents

#subobject ayrıştırıcı işlevi, Semantic MediaWiki ile yapılan açıklamaların, viki sayfaları gibi kendi özellik-değer çiftlerine sahip olan, ancak gerçekte içinde bir sayfası olmayan nesnelere başvurmasına izin verir. Bu, yeni yardımcı sayfaların oluşturulmasına gerek kalmadan bir sayfada verilen özellik-değer çiftlerini "gruplamak" için kullanılabilir. Bu ayrıştırıcı işlevi ile ayarlanan değerleri içeren sayfalar special property "Has subobject"Holds the subobjects set on a page ile saklanır.

Bu sayfa, alt nesnelerin nasıl ekleneceğini açıklamaktadır. Alt nesneleri ekledikten sonra bunun nasıl yapılacağını öğrenmek için alt nesneleri sorgulama sayfasına bakın.

The parser function #set_recurring_event uses subobjects to store annotation values (see Help:Recurring events).

Syntax[edit]

{{#subobject:mysubobject
 |Has property 1=value
 |Has property 2=values|+sep=...
 |...
}}
Like the #set parser function the #subobject parser function is a form of silent annotation: it adds values to properties but does not print anything to the page.
Using subobjects with anonymous identifiers is probably the preferred approach in most use cases.

Specifying multiple values for the same property[edit]

The syntax for specifying subobjects is very similar to the one used when setting values. Starting with Semantic MediaWiki 2.2.0Released on 9 May 2015 and compatible with MW 1.19.0 - 1.24.x. a subobject with no valid annotation content (property-value declaration) is no longer permitted / stored.1

Add multiple lines[edit]

{{#subobject:mysubobject
 |Has property 1=value1
 |Has property 2=value2
 |Has property 3=value1
 ...
}}

Add one line and separate values using a pipe[edit]

Starting with Semantic MediaWiki 1.8.0Released on 2 December 2012 and compatible with MW 1.17.0 - 1.22.x
(except 1.22.1).
multiple values may be set with "|" as a delimiter. This does not create new restrictions on values but provides a convenient short-cut. The following is the same as the above:

{{#subobject:mysubobject
 |Has property=value1|value2
 ...
}}
The possibility of using pipes "|" for setting multiple values like e.g. "{{#subobject: Has property=value1|value2 }}" was deprecated starting with Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x. and will be removed in a later version. It is strongly recommended to migrate to using the "|+sep" parameter.2

Add one line and separate values using a named separator[edit]

Semantic MediaWiki 1.9.0Released on 3 January 2014 and compatible with MW 1.19.0 - 1.22.x. introduces |+sep=... to identify the separator (see a demo):

{{#subobject:mysubobject
 |Has property 1=Value 1;Value 2;Value 3;Value 4|+sep=;
 |Has property 2=12+22+3+4+5+6+7+8+9+10|+sep=+
 |Has property 3=123,1234,12345,|+sep=
 |Has property 4=One,or,two,more,values|+sep
 ...
}}
You must use a named separator if you want to assign multiple values for a single property, e.g. in multi-instance templates.

Specifying an identifier[edit]

Subobjects can have a named 'identifier'. This can be used to directly specify multiple property value combinations to a given data object.

Adlandırılmış tanımlayıcı[edit]

Bu alt nesne, street address adıyla tanımlanan bir alt nesne olarak sokak adresini sayfaya ekler:

{{#subobject:street address
 |street number=10
 |street name=Parks Road
 |postcode=OX1 3QD
 |city=Oxford
 |country=UK
}}

A named identifier shall not contain a dot (i.e foo.bar) in the first five characters, this naming scheme is reserved for extensions (starting with Semantic MediaWiki 2.4.0Released on 9 July 2016 and compatible with MW 1.19.0 - 1.27.x. this convention is enforced).

Using subobjects with anonymous identifiers is probably the preferred approach in most use cases.

Anonymous identifier[edit]

Semantic MediaWiki 1.8.0Released on 2 December 2012 and compatible with MW 1.17.0 - 1.22.x
(except 1.22.1).
supports anonymous identifiers (hash-numbering) for objects that do not use a named identifier. If two subobject entities are identical in content (meaning they build an identical hash key) within the same page then only one entity will be stored and available for query representation.

{{#subobject:|
 ...
}}

Identifier starting with:

  • _QUERY... tag a query meta container
  • _ERR... tag an error container

Specifying a sortkey[edit]

Semantic MediaWiki 2.0.0Released on 4 August 2014 and compatible with MW 1.19.0 - 1.24.x. introduces |@sortkey=... to allow to set an arbitrary sort value for a particular subobject. It will be treated case sensitive, i.e. values are stored as a "string" and will not appear (in terms of visibility) to the end-user but will be ordered as any other regular wiki page using a sortkey.

{{#subobject:street address
 |Street number=10
 |Street name=Parks Road
 |Postcode=OX1 3QD
 |City=Oxford
 |Country=UK
 |@sortkey=A
}}

The sortkey in above example is "A".

Conceptional notes[edit]

Clarifies the relationship between subject and subobject

Value declaration[edit]

If a subobject contains the same declarations then it is being recognized as being the same (technically a hash is produced to compare those entities) unless it describes something different (using an explicit name opposed to the auto-identifier given without an explicit name). Using a different name on a subobject embedded within the same subject creates an independent entity about something that may or may not be described by the same facts.

{{#subobject:
 |Foo=Bar
}}
{{#subobject:
 |Foo=Bar
}}

Both subobjects declare the same attributes while

{{#subobject:Foo
 |Foo=Bar
}}
{{#subobject:Bar
 |Foo=Bar
}}

are equal in its declaration to produce the same annotation but are different to the end that it represents a Subject X#Foo and the other a Subject X#Bar. Another way to create a distinctions is by using `@sortkey` (those are not equal hence treated as different entities and therefore can be queried individually):

{{#subobject:
 |Foo=Bar
 |@sortkey=Foo
}}
{{#subobject:
 |Foo=Bar
 |@sortkey=Bar
}}

Using categories[edit]

As of Semantic MediaWiki 2.3.0Released on 29 October 2015 and compatible with MW 1.19.0 - 1.25.x., @category can be used to add a category classification. While subobjects with categories can be queried as any other object, they will not appear in an individual Category: ... list because a subobject is a Semantic MediaWiki and not a MediaWiki concept.

{{#subobject:
 |Has page=Example/0301/1
 |@category=ABC;123|+sep=;
}}

Prior to Semantic MediaWiki 2.3.0Released on 29 October 2015 and compatible with MW 1.19.0 - 1.25.x., an alternative approach based solely on properties can be used:

  • Name your category-like properties as you would name a category, e.g. "Property:Detective fiction".
  • Using Property:Subproperty of, you can arrange these category-like properties into a deeply nested hierarchy (e.g. "Property:Detective fiction" is a member of "Property:Crime fiction" is a member of "Property:Genres", etc.). In this way, you can closely mimic a category hierarchy.
  • In order to classify a subobject in this method, assign, within the subobject, any value to the property which corresponds to the desired classification. The value assigned to the property is irrelevant.
  • While with a traditional category-based approach, you would query on [[Category:Crime fiction]] and retrieve only pages belonging to this category and its subcategories, you can now query on [[Crime fiction::+]] and retrieve pages as well as subobjects that belong to this property and its subproperties.

Querying for subobjects[edit]

Main page: Help:Subobjects and queries

Subobjects can be treated just like pages. The simplest way to query for a set of subobjects is to ask for the existence of a property that is unique to the subobjects, e.g.

{{#ask:
 [[postcode::+]]
 |? street number
 |? street name
 ...
}}

(assuming that all 'address' subobjects have the postcode property). For querying purposes, you can define a 'dummy' property for subobjects that you want to group together in this way, e.g. 'is address=1'.

For more information about subobjects and queries, see here.

Examples[edit]

Troubleshooting[edit]

Problem with subobjects that have a '=' character in a parameter value when using a template
See this issue for a workaround.

See also[edit]

References[edit]


References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:914
  2. ^  Semantic MediaWiki: GitHub pull request gh:smw:1345