Difference between revisions of "User:Khaim"
Jump to navigation
Jump to search
(Query example) |
(Removing move tag - see Ask Tutorial) Tag: Undo |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
==How-To: Properties & Queries== | ==How-To: Properties & Queries== | ||
− | ''' | + | ===Property Syntax=== |
− | * [ | + | |
− | * [ | + | ====Adding properties to pages==== |
− | * [ | + | |
− | * [ | + | * Basic syntax: <tt><nowiki>[[Example property::value]]</nowiki></tt> |
+ | ** How this looks on the page depends on the property's ''type''. The default type is [[Special:Types/Page|Page]], which will display this the same as <nowiki>[[value]]</nowiki>, i.e. the text 'value' which links to the wikipage 'value'. | ||
+ | ** Properties with the [[Special:Types/Number|Number]] type - very common on this wiki - will not add a link. They will just display as 'value'. | ||
+ | * Alternate display text: <tt><nowiki>[[Example property::value|alt-text]]</nowiki></tt> | ||
+ | ** Displays as either <nowiki>[[value|alt-text]]</nowiki>, for page links; or 'alt-text', for numbers. | ||
+ | * Set property without displaying anything: <tt><nowiki>[[Example property::value| ]]</nowiki></tt> | ||
+ | ** The space is required. | ||
+ | |||
+ | If you add a property to a page, check that it's defined! If it isn't, the wiki will use the defaults, which are terrible. In this case you should create the property page yourself. | ||
+ | |||
+ | ====Defining Properties==== | ||
− | + | Property is defined by special pages with the '''Property:''' prefix. For example, the "Beauty Base" property is defined by [[Property:Beauty_Base]]. At minimum a property page needs to define its type. | |
+ | * Basic syntax: <tt><nowiki>[[has property::type| ]]</nowiki></tt> | ||
+ | ** On this wiki the type should probably be either 'number' or 'page'. | ||
+ | ** This is the exact same syntax as adding a property to a normal page. That's because ''has_type'' is also a property; it's a special built-in property. | ||
+ | * Helper template: <tt><nowiki>{{Property with Page | page = Beauty | type = Number }}</nowiki></tt> | ||
+ | ** This sets the type and also displays ''See [[Beauty]]'' to link to the page that describes what this property is. | ||
− | '' | + | A property's page is also a wiki page, so you can add content to it as normal. It's fine to leave it blank. |
===Query Syntax=== | ===Query Syntax=== | ||
A query allows you to insert content, usually tables, which dynamically update based on data from other pages. | A query allows you to insert content, usually tables, which dynamically update based on data from other pages. | ||
− | Example | + | ====Example==== |
+ | Wiki code for the query: | ||
<nowiki>{{#ask: | <nowiki>{{#ask: | ||
[[Skill Base Factor::>0.4]] | [[Skill Base Factor::>0.4]] | ||
Line 30: | Line 46: | ||
}}</nowiki> | }}</nowiki> | ||
− | + | Wiki code on [[Mechanoid Disassembly Efficiency]]: | |
+ | <nowiki>[[Skill Base Factor::0.75|75%]] plus [[Skill Bonus Factor::0.025|2.5%]] per skill level.</nowiki> | ||
+ | (Similar wiki code is on the other pages.) | ||
+ | |||
+ | Query output: | ||
{{#ask: | {{#ask: | ||
− | [[Skill Base Factor:: | + | [[Skill Base Factor::>0.4]] |
[[Skill Bonus Factor::+]] | [[Skill Bonus Factor::+]] | ||
| ?Skill Base Factor# = Base | | ?Skill Base Factor# = Base | ||
Line 44: | Line 64: | ||
Comments: | Comments: | ||
− | <nowiki>{{#ask: // Begin a query. | + | <nowiki>{{#ask: // Begin a query. |
+ | |||
// Everything up to the next | is the query term. This particular example returns pages which: | // Everything up to the next | is the query term. This particular example returns pages which: | ||
[[Skill Base Factor::>0.4]] // have the Skill_Base_Factor property, value is >0.4 | [[Skill Base Factor::>0.4]] // have the Skill_Base_Factor property, value is >0.4 | ||
[[Skill Bonus Factor::+]] // AND have the Skill_Bonus_Factor property, with any value | [[Skill Bonus Factor::+]] // AND have the Skill_Bonus_Factor property, with any value | ||
− | // Define | + | |
− | + | // Define columns to show. The first column is the page name. | |
| ?Skill Base Factor# = Base // The second column is the page's Skill_Base_Factor value, with heading 'Base'. | | ?Skill Base Factor# = Base // The second column is the page's Skill_Base_Factor value, with heading 'Base'. | ||
− | | ?Skill Bonus Factor# = Factor | + | | ?Skill Bonus Factor# = Factor // The third column is Skill_Bonus_Factor, with heading 'Factor' |
− | | format = table // 'format = broadtable' makes a table as wide as the screen | + | | mainlabel = Stat // The heading for the first column. |
− | | limit = 100 // Maximum number of pages to return | + | |
− | + | // Optional settings. | |
− | | sort = Skill Base Factor,Skill Bonus Factor // Sort by base factor, then bonus factor | + | | format = table // This makes a fitted table. 'format = broadtable' makes a table as wide as the screen. |
+ | | limit = 100 // Maximum number of pages to return. | ||
+ | | sort = Skill Base Factor,Skill Bonus Factor // Sort by base factor, then bonus factor. | ||
| order = desc,desc | | order = desc,desc | ||
}}</nowiki> | }}</nowiki> | ||
+ | |||
+ | ===MediaWiki references=== | ||
+ | * [https://www.semantic-mediawiki.org/wiki/Help:Properties_and_types Properties] | ||
+ | * [https://www.semantic-mediawiki.org/wiki/Help:Selecting_pages Query syntax] | ||
+ | * [https://www.semantic-mediawiki.org/wiki/Help:Displaying_information Display syntax] | ||
+ | * [https://www.semantic-mediawiki.org/wiki/Help:Result_formats Result formats] | ||
+ | * [https://www.semantic-mediawiki.org/wiki/Help:Special_properties Special properties] |
Latest revision as of 10:46, 28 January 2022
Sandbox[edit]
How-To: Properties & Queries[edit]
Property Syntax[edit]
Adding properties to pages[edit]
- Basic syntax: [[Example property::value]]
- How this looks on the page depends on the property's type. The default type is Page, which will display this the same as [[value]], i.e. the text 'value' which links to the wikipage 'value'.
- Properties with the Number type - very common on this wiki - will not add a link. They will just display as 'value'.
- Alternate display text: [[Example property::value|alt-text]]
- Displays as either [[value|alt-text]], for page links; or 'alt-text', for numbers.
- Set property without displaying anything: [[Example property::value| ]]
- The space is required.
If you add a property to a page, check that it's defined! If it isn't, the wiki will use the defaults, which are terrible. In this case you should create the property page yourself.
Defining Properties[edit]
Property is defined by special pages with the Property: prefix. For example, the "Beauty Base" property is defined by Property:Beauty_Base. At minimum a property page needs to define its type.
- Basic syntax: [[has property::type| ]]
- On this wiki the type should probably be either 'number' or 'page'.
- This is the exact same syntax as adding a property to a normal page. That's because has_type is also a property; it's a special built-in property.
- Helper template: {{Property with Page | page = Beauty | type = Number }}
- This sets the type and also displays See Beauty to link to the page that describes what this property is.
A property's page is also a wiki page, so you can add content to it as normal. It's fine to leave it blank.
Query Syntax[edit]
A query allows you to insert content, usually tables, which dynamically update based on data from other pages.
Example[edit]
Wiki code for the query:
{{#ask: [[Skill Base Factor::>0.4]] [[Skill Bonus Factor::+]] | ?Skill Base Factor# = Base | ?Skill Bonus Factor# = Factor | format = table | limit = 100 | mainlabel = Stat | sort = Skill Base Factor,Skill Bonus Factor | order = desc,desc }}
Wiki code on Mechanoid Disassembly Efficiency:
[[Skill Base Factor::0.75|75%]] plus [[Skill Bonus Factor::0.025|2.5%]] per skill level.
(Similar wiki code is on the other pages.)
Query output:
Stat | Base | Factor |
---|---|---|
Reading Speed | 1 | 0.02 |
Pruning Speed | 0.92 | 0.01 |
Social Impact | 0.82 | 0.0275 |
Mech Repair Speed | 0.8 | 0.1 |
Subcore Encoding Speed | 0.75 | 0.1 |
Mech Gestation Speed | 0.75 | 0.025 |
Butchery Efficiency | 0.75 | 0.025 |
Mechanoid Shredding Efficiency | 0.75 | 0.025 |
Hacking Speed | 0.75 | 0.025 |
Arrest Success Chance | 0.6 | 0.075 |
Negotiation Ability | 0.4 | 0.075 |
Medical Tend Speed | 0.4 | 0.06 |
Medical Operation Speed | 0.4 | 0.06 |
Mechanoid Shredding Speed | 0.4 | 0.06 |
Butchery Speed | 0.4 | 0.06 |
Drug Cooking Speed | 0.4 | 0.06 |
Comments:
{{#ask: // Begin a query. // Everything up to the next | is the query term. This particular example returns pages which: [[Skill Base Factor::>0.4]] // have the Skill_Base_Factor property, value is >0.4 [[Skill Bonus Factor::+]] // AND have the Skill_Bonus_Factor property, with any value // Define columns to show. The first column is the page name. | ?Skill Base Factor# = Base // The second column is the page's Skill_Base_Factor value, with heading 'Base'. | ?Skill Bonus Factor# = Factor // The third column is Skill_Bonus_Factor, with heading 'Factor' | mainlabel = Stat // The heading for the first column. // Optional settings. | format = table // This makes a fitted table. 'format = broadtable' makes a table as wide as the screen. | limit = 100 // Maximum number of pages to return. | sort = Skill Base Factor,Skill Bonus Factor // Sort by base factor, then bonus factor. | order = desc,desc }}