semantic-mediawiki.org:Community portal

From semantic-mediawiki.org
(Redirected from Talk:Semantic MediaWiki)
Jump to: navigation, search
Community portal of Semantic MediaWiki

Welcome to the community portal. This is the place for general inquiries, your ideas or comments concerning this wiki. Here you may get in touch with one of the admins of this wiki, who also use this portal as a noticeboard.

If you are looking for support with problem about the software itself, please have a look at the info page on getting support.


We are always looking for ways to improve documentation and communication with the community therefore it would help us if you could take 5 minutes of your time and fill out the survey form. Thank you.

First page
First page
Previous page
Previous page
Last page
Last page

Hide subcategories in Special:Category main menu

Hey,


imagine i want to define a something like this:


Category1

Category2

Category3


Catogory 2 is subcategory of Category1, and 3 is subcategory of 2.

So in a tree, it would be like Category1->Category2->Category3


Problema is that in Special:Category i will see

Category1(3)

Category2(2)

Category3(1)

Showing me all categories with the number of subcategories+1.

How could i maintain a tree view, making only (at this point) Category1 the only visible from the Special:category menu?

Maiser (talk)16:56, 25 March 2015

> How could i maintain a tree view, making only (at this point) Category1 the only visible from the Special:category menu?

Generally, SMW (core) does not alter (or interferes with) the display of standard MediaWiki objects (such as categories). I'm not aware of any extension that would fit your requirement but maybe [0] can give you a starting point.

[0] https://www.mediawiki.org/w/index.php?search=category+tree&title=Special%3ASearch&go=Go

MWJames (talk)19:58, 25 March 2015
 

SMW database error

Hi,

We are using the older 1.8.0.5 version of SMW with MediaWiki 1.20.2, PHP 5.4.9, MySQL 5.5.28. Everything has been working great so far and we are well over 106,000 pages in our system after over 2 years or use in production. Recently we encountered the following database error when running jobs. It seems to occur only a specific type of page invoking a specific template.

A database query syntax error has occurred. The last attempted database query was: "INSERT IGNORE INTO `t6` SELECT t7.smw_id FROM `smw_object_ids` AS t7 WHERE t7.smw_sortkey LIKE 'CID%'" from within function "SMW::executeQueries". Database returned error "1114: The table 't6' is full (localhost)"

Is this related to some default MySQL setting for SMW? We currently have just over 16GB RAM used for MySQL caching and buffers. We have plenty of hard disk space. I'm wondering if there is some simple MySQL setting we need to change to increase teh table size. Any help here would appreciated.

Thanks,

Lloonngg (talk) 14:29, 24 March 2015 (CET)

Lloonngg (talk)15:29, 24 March 2015

> We are using the older 1.8.0.5 version of SMW with MediaWiki 1.20.2, PHP 5.4.9, MySQL 5.5.28.

Honestly it will be difficult for use to make any suggestions since you are using a no longer maintained code base (SMW 1.8*). It will be toilsome for us to make an appropriate response but we are tracking the issue at [0].

> It seems to occur only a specific type of page invoking a specific template.

Is it possible for you to post the details of your analysis to [0]?

Also, could you try running an isolated stack trace to see whether the queries are caught in a resource loop and link the report to [0]. Limit your pages when running the job because "$wgDebugDumpSql = true" is expensive as it returns each single SQL query executed.

[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/918

MWJames (talk)17:23, 24 March 2015

See the post to error 1114 at [0].

MWJames (talk)17:38, 24 March 2015
 
 

Declaring subcategory without entering the category page

Hello,


at the moment i have to bring a pretty big class hierarchy from a .owl document to my SMW. I have been searching for quite a long time on how to do this, but i have seen that there is no way of a direct "import.

In order to do this, my idea is creating a document which makes something like this:


//Category declaration . . . .


This is easy, and will allow me to create all categories, problem is that they need to be organized in a hierarchy.

For this i would need something like


catego1 subCategoryOf: catego2

You know, without having to enter the category (in this example catego1) each time, as there is a pretty long way to go.

Any clue on how to do this? Did not found nothing on how to do that.

Maiser (talk)18:31, 23 March 2015

Some questions about SMW

Hello all,

at the moment i am becoming crazy looking for information about different aspects of the SMW, and would be cool if someone could help me with them.

1) How can i import ontologies into my SMW? I want to import DublinCore one and another one which i have in ".owl" format, is there any way?

 With import i mean having the possibility to use the vocabulary itself on my forms, i would like to have categories and properties automatically created from these ones.
 
 I know there is a way of making a property which is "equal" to external ontologies vocabulary this way:
 https://semantic-mediawiki.org/wiki/Help:Import_vocabulary#Making_vocabularies_available_for_import
 
 But this is not what i am looking for. I just want to click "properties"for example and have vocabulary there.


2) Hide deleted properties, categories.......

 Whenever i go to my properties place, i find thousands of them with the yellow "warning" sign, which makes you know they have been deleted. I simply want to hide them so they do not botter me when i want to 
 see the actual vocabulary.


Well, this is all for the moment.

Thanks.

Maiser (talk)17:38, 18 March 2015

> With import i mean having the possibility to use the vocabulary itself on my forms, i would like to have categories and properties automatically created from these ones.

Forms and imported vocabularies don't share any commonalities or functionality. SMW is used under the premise of explicit type declarations. Of course you can create ad-hoc properties but those are defaulted to the page type and should be adjusted to a type it is ought to represent.

As for imported property references (e.g. foaf, dc), the following discussions should give you a quick overview of what is supported and how [0, 1].

> I just want to click "properties"for example and have vocabulary there.

I'm not sure I understand the comment.

> Whenever i go to my properties place, i find thousands of them with the yellow "warning" sign, which makes you know they have been deleted.

Again, I'm not sure I understand the comment/question. Do you mean by "properties place" the Special:Properties page? In case you mean Special:Properties, see Help:$smwgPropertyZeroCountDisplay.

[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/891

[1] https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/464#issuecomment-70341109

MWJames (talk)18:21, 18 March 2015

I will put an example of what i mean with import:

FOAF has:

Classes:

Agent | Document | Group | Image | LabelProperty | OnlineAccount | OnlineChatAccount | OnlineEcommerceAccount | OnlineGamingAccount | Organization | Person | PersonalProfileDocument | Project |

Properties:

account | accountName | accountServiceHomepage | age | aimChatID | based_near | birthday | currentProject | depiction | depicts | dnaChecksum | familyName | family_name | firstName | focus | fundedBy | geekcode | gender | givenName | givenname | holdsAccount | homepage | icqChatID | img | interest | isPrimaryTopicOf | jabberID | knows | lastName | logo | made | maker | mbox | mbox_sha1sum | member | membershipClass | msnChatID | myersBriggs | name | nick | openid | page | pastProject | phone | plan | primaryTopic | publications | schoolHomepage | sha1 | skypeID | status | surname | theme | thumbnail | tipjar | title | topic | topic_interest | weblog | workInfoHomepage | workplaceHomepage | yahooChatID |


According to : http://xmlns.com/foaf/spec/

I need a way to import classes and properties into my web, so that i go into "Special:properties" and see the foaf classes as if they were introduced by hand in the web. Same with properties, when i go to "Special:properties".

Is it a bit clearer now?


I tried to follow the import marked on :

https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/464#issuecomment-70341109

But this did not do the thing for me.



Issue 2:

Even if this was not what i was looking for:

Help:$smwgPropertyZeroCountDisplay.

Thanks! It will help me. I just wanted to hide properties which had been deleted, not those with 0 uses :).

Hope you can help me with imports now. Thanks for your time!

Maiser (talk)14:57, 19 March 2015

Issue 1: As the documentation says, after creating the page for the vocabulary import (MediaWiki:Smw import foaf, for example), you have to include (manually or via template/transclusion) [[imported from::foaf:knows]] statement in a property page or in a category page (if it is a class).

Issue 2: I don't have an answer for this. I have the same problem for years.

Jaider msg23:11, 19 March 2015

Issue 1: I already mentioned i did that, but that was not what i was looking for! I am looking for a way to automatically import all vocabulary into the web, without the need to create things one by one each time.

Maiser (talk)00:55, 20 March 2015

> for a way to automatically import all vocabulary

A semi-automatic approach is being described above by [1].

> without the need to create things one by one each time.

As I mentioned earlier "SMW is used under the premise of explicit type declarations." which means you need at least to declare a connection between a property (Property:A) and its external representation (imported from::foaf:name) otherwise how should the system (SMW) know the attributive connection between an internal and external term.

To import something without making an explicit declaration is not how SMW ought to work. One can write a tool that would help with those assignments but since each wiki uses individual named properties to assign values, it can not be assumed that Property:Foaf:name on wiki-A means (in terms of its entity description) the same thing as Property:Foaf:name on wiki-B (even though the common sense would dictate such conjecture) because those assumption are not declarative.

SMW does not reserve the foaf/dc (or any other) namespace for exclusive use by an external vocabulary making it therefore not feasible to assume that Property:Foaf:name represents an external foaf:name entity (this is where we use imported from to assign the meaning of an external vocabulary to a property of one's own choosing).

> things one by one each time.

You only create a declaration once per property.

MWJames (talk)01:31, 20 March 2015
 
 
 
 
 

Purge deleted properties

Hello all.


After i create a property with "Special:property" and delete it, whenever i go to "Special:createTemplate" i can still choose it as an element of the template (even if it should no longer exist). I understand that property itself does not longer exist (does not have nothing on it), and that when you use it, you are kind of creating it.

Anyway, i would like that after deleting it, it´s name also dissapeared, as if it had never existed before, so does not show up when you want to create a template.

How could i do this?

Thanks.

Maiser (talk)16:05, 23 March 2015

Semantic Issue After upgrade

Mediawiki upgraded from 1.12 to Mediawiki 1.21

SMW 1.8.0

Hi ,


for ex i created one autopopulated page by using the below syntaxt



like this i have multiple queries on multiple pages, after upgrade of mediawiki 1.12 to mediawiki 1.21 one extra column is coming for ex


  Name of the Document
<a href="Test1" title="Test1">Test1</a> <a href="Test1" title="Test1">Test1</a>

the first <th> adding all ask query page it is showing all the second column value

how to fix it?

Rajeshrjsh (talk)14:38, 17 March 2015

Do not do crossposting please! Things will not get faster doing so, in contrary. See the thread on the mailing list

[[kgh]] (talk)20:21, 17 March 2015
 

Templates not enabled for semantic in-text annotations due to namespace restrictions.

We just installed SMW Bundle 2.1 and the templates are not enabled, whereas the form pages are. I'm just the content person, not the one that did the install. Can anyone point me to the config parameter?

Dlacy (talk)22:38, 20 February 2015

$smwgNamespacesWithSemanticLinks is the setting that has to be changed by the system administrators.

[[kgh]] (talk)23:12, 22 February 2015
 

Semantic Forms and Parameters

Hi,

I have installed Semantic Media Wiki (last version) on a local machine. To creat forms, attributes etc. I installed the extension Semantic Forms. Everything is working so far, only the options for the parameters to edit the values etc. don't show up.

Screenshot: http://imgur.com/czpDJSj

Can anyone help?

Best, Matthias

Gosso (talk)18:56, 6 February 2015

I believe you will be better of asking at the Semantic Forms support page. Do not forget to mention your setup, e.g. version of MW, SF, PHP etc.

[[kgh]] (talk)19:24, 6 February 2015
 

SMW Page Lists

Good day:

I have been experimenting with with sub-objects and queries hoping to find a programmatic way to generate lists of related articles based on property values.

I see there are three extensions called Dynamic Page List that do this. I have the strong impression that none of them do so based on Semantic MediaWiki properties.

Can anyone suggest a path I might follow to create the lists I desire?

Thank you

AKSHA (talk)02:10, 9 November 2014

I would use SMW to do this instead of installing DPL.

[[kgh]] (talk)19:22, 6 February 2015
 

Semantic Internal Objects to Headings

Good day:

I would like to use queries to concatenate a string that includes property values so that these can function as article headings something like the following.

==={{#ask:[[Name::+]] [[NameFirst::Bruce]] [[NameLast::Wayne]] |? NameFirst }} {{#ask:[[Name::+]] [[NameFirst::Bruce]] [[NameLast::Wayne]] |? NameLast }}===

I have managed the following.

{{#set_internal:Name |[[NameFirst::]]= |[[NameLast::]]= }}

I have created the above object on a template page. I assume I have done this incorrectly, which may be my problem. I have put data into several articles to test my syntax.

  • Bruce Wayne
  • Bruce Banner
  • Peter Parker
  • Kevin Matchstick
  • Clark Kent

I then query the data successfully with the query below.

{{#ask:[[Name::+]] |? NameFirst |? NameLast }}

My problem so far is that I cannot get a query to produce plain text like: Bruce

How can I achieve this?

Thank you AKSHA

AKSHA (talk)01:37, 7 November 2014

Try {{#show: Bruce Wayne | NameFirst}}.

Alexander Mashintalk03:55, 7 November 2014

Thanks for that very good advice. The following provided the desired output: "Peter"

{{#show:[[Name::+]] [[NameFirst::Peter]] |?NameFirst }}

The following provided the output: "Bruce Bruce".

{{#show:[[Name::+]] [[NameFirst::Bruce]] |?NameFirst }}

This confused me until I realized that my data include: Bruce Wayne Bruce Banner

Thank you, thank you.

Have you any sense why both results come with the following error message?

Error

  • Some part ".." of the query was not understood.
  • The symbol "[[" was used in a place where it is not useful.
  • The part "]]" of the query was not understood. Result might not be as expected.
AKSHA (talk)05:19, 7 November 2014

{{#show:}} shows a property of only one page. It's {{#show:Bruce Wayne | ?NameFirst}}, not {{#show:[[NameFirst::Bruce Wayne]] [[Name::+]] | ?NameFirst}}. I'm surprised it worked at all. If you need more complex query conditions than page name, use {{#ask:[[NameFirst::Bruce Wayne]] [[Name::+]] | ?NameFirst#- | format = list | mainlabel=- | limit=1 | searchlabel = - | headers = hide}}

Alexander Mashintalk09:01, 7 November 2014

I put in the following ask and get no output:

{{#ask:[[NameFirst::Bruce Wayne]] [[Name::+]] | ?NameFirst#- | format = list | mainlabel=- | limit=1 | searchlabel = - | headers = hide}}


I think this is because no property value corresponds to “Bruce Wayne” so I change [[NameFirst::Bruce Wayne]] to [[NameFirst::Bruce]]:

{{#ask:[[NameFirst::Bruce]] [[Name::+]] | ?NameFirst#- | format = list | mainlabel=- | limit=1 | searchlabel = - | headers = hide}}


This returns: Bruce-. I want to get rid of that “-” so I experimentally remove a “-” from the query and view the page without it. This makes for an unwanted output so I edit the query and repair what I broke. Then I try deleting another “-”. This testing proves that if I remove the “-” from “searchlabel”, I get a pure property value: Bruce

{{#ask:[[NameFirst::Bruce]] [[Name::+]] | ?NameFirst#- | format = list | mainlabel=- | limit=1 | searchlabel = | headers = hide}}


Lessons learned[edit]

In an #ask the first parameters are the object you are querying and the property value you are searching for. They come before the first pipe “|”. Otherwise, place order is not a factor so the following are equivalent:

  • {{#ask:[[NameFirst::Bruce]] [[Name::+]] | }}
  • {{#ask:[[Name::+]] [[NameFirst::Bruce]] | }}


Many formatting instructions can apply to a single query as long as no two contradict. Each must be separated by a pipe “|”.


This solution provides a fine grained example of how to provide multiple formatting instructions to a query. It also provides a working example so that an inexperienced user can make individual changes and see the result. This helps a new user get over a number of very basic mistakes. By new user I mean myself.

Thank you for walking me through this solution Alexander Mashin.

Equipped with this example, I feel confident of making a better class of mistakes.

AKSHA (talk)17:44, 7 November 2014
 
 
 
 

ORCID user template

I have created Template:User ORCID, for those of you who have registered for an ORCID identifier. You can see an example on my user page. Please feel free to use it on your user page, or to port it to your own wiki. Pigsonthewing (talk) 01:39, 20 September 2014 (CEST)

Pigsonthewing (talk)01:39, 20 September 2014

I am still undecided if this is acceptable on this wiki. Nothing against providing such information on the user page, but I guess on some wikis a plain link instead of an extra template does the same goodness. Let's see how you future involvement looks like on this wiki. Cheers

[[kgh]] (talk)12:51, 20 September 2014
 

Conditional formatting according to properties

Hello, (this question was first raised in the wrong place here):

Is there a simple way of adding conditional formatting to a template that gets filled with a form and annotated properties? Let's say, there is a property:has Priority, and priority A should color the section red, B orange, C yellow… and so on. I've searched and tried a lot, but only found info about conditional formatting for tables.

Goal is to let the user choose an option within a form (+ template) and according to the answer display a certain formatting.

I guess, it's not going to work with the #if parser function, instead I've tried to use #switch like this:

<div style="background-color:#{{#switch:{{{Priority}}}
|#A = faa8a8
|B = facba8
|C = faf1a8
|#default = e1e4e2}};">
…
</div>

It's not reacting at all, if within <span> tags, but gives out the value of #default, when within <div> tags. (I fear I might have totally misunderstood the concept here?)

MediaWiki uses something like this in the Extension template, but it's hard to make out the relevant parts...

I would be happy about any hints pointing me in the right direction.

Zabien (talk)14:45, 18 September 2014

Demos not working

Hi, I was searching for some result formats and I think some of them are broken or misconfigured, see:

Jaider Msg21:52, 2 January 2014

Thanks for reporting. I filed an issue about the fatal errors here https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/67

Jeroen De Dauw (talk)01:39, 3 January 2014

Fatal errors have been fixed.

Jeroen De Dauw (talk)01:56, 3 January 2014
 

The Slideshow format is not working again, see the "Result:" section, after "Example".

Jaider msg00:18, 11 August 2014

It is a known issue [0] but someone has to pick-up the task.

[0] https://github.com/SemanticMediaWiki/SemanticResultFormats/issues/56

MWJames (talk)00:27, 11 August 2014
 
 

Schema _> form for uploading or referencing video plus fields for annotation

Hi All, I am a total noob- although I bought Yaron's book and have been feverishly trying to get the site up. I have the current SMW bundle running and am trying to create a form for uploading a video, then making a few notes, mostly text, a couple boolean, etc. I'd like to be able to edit the fields later (and also the form, that's why I thought schema would be the way to go...) I can't seem to get past the video part though. Is it possible to upload via a form? Would I be better off just uploading the videos separately, then embedding them?

This is for a school research project on gesture analysis and my professor is expecting a presentation on Weds. So, I'm stressing a bit :) Any advise appreciated. I even have a minuscule research budget if someone wants to make $60

Thanks!

Ikesmith (talk)19:22, 8 August 2014

Hi - I hope the book is useful! And yes, Page Schemas is the way to go. Support for displaying videos is pretty primitive, but yes, if you have a way to embed uploaded video files (via the Widgets extension, ideally), then you can upload them via the form - it's just a matter of editing the template to display the video file in the right way, which you would have to do by hand.

Yaron Koren (talk)19:42, 8 August 2014
 

"sort" option in query does not include results that have no value in sorted field

Edited by another user.
Last edit: 22:23, 4 March 2014

Hello,

The following query brings up no results (because Begin Date is blank):

{{#ask:[[Category:Market research]]
|?ResearchStatus
|?ResearchType
|?Description
|sort=BeginDate
}}

But this query brings up all results:

{{#ask:[[Category:Market research]]
|?ResearchStatus
|?ResearchType
|?Description
}}

I don't think that it logically follows that a "sort" option should exclude results where sorted field is blank.

Patelmm79 (talk)22:00, 4 March 2014

Well, if you do not query for a property you cannot sort by it since your printout statement cannot be fulfilled. Somehow you have to pick up the date from the pages/subobjects with the query. See sorting results. So your query should be

{{#ask:[[Category:Market research]]
|?ResearchStatus
|?ResearchType
|?Description
|?BeginDate
|sort=BeginDate
}}
[[kgh]] (talk)22:29, 4 March 2014

This is about sort statements that filter out the rows in which the sorted field is null, I think. An old and already reported problem of SMW.

Alexander Mashintalk03:42, 5 March 2014
 

A simple workaround to this is to define, in the template, some default values for the properties of interest if they are not already set. ie:

{{#if: {{{ArgIwant|}}}||[[PropIneed::SomeDefaultValue]]}} 

It's more elegant to do it where it's actually printing, but this has overcome the whole 'sort' issue any time I've needed it. Though, it assumes all the articles call some templates to which you could do this.

Lbillett (talk)04:56, 6 July 2014
 

"Crosstab" to summarize links between pages in categories?

When choosing SMW as knowledgebase, I was expecting, that I could summarize links between pages in tables to find inconsistencies. However, I seem to not be able to find a way to do this. Maybe I am missing something?

Here is what I would like to do: 1) Query for pages in two separate categories 2) Find all links (perhaps filter them for attribute) between the pages of these two categories 3) Display these links in a table (Crosstab), where pages of one category is on one axis and pages of the other category are on the other axis. Cells display the links / attributes linking these pages

Is there an extension, to do something like this?

Best Regards,

Ruedi

Ruediklein (talk)23:50, 19 June 2014

{{#ask:[[Category:Semantic MediaWiki documentation]] [[Docinfo author::<q>[[Category:Developer]]</q>]]|?Docinfo author}} will produce:

 Docinfo author
$smwgDefaultStoreMWJames
Accessing drilldown pageMWJames
Adding subobjects 1.7.0 - 1.7.1Jeroen De Dauw
Administrator manualMarkus Krötzsch
AjaxMWJames
Architecture guideMarkus Krötzsch
Argument declaration in templatesDenny Vrandecic
Ask APIJeroen De Dauw
Average formatYaron Koren
BibTeX formatYaron Koren
Broadtable formatMarkus Krötzsch
Broadtable format 0.4 - 1.6.1Markus Krötzsch
Browsen und SuchenMarkus Krötzsch
Browsing interfacesMarkus Krötzsch
Calendar formatYaron Koren
Calendar format 1.4.0 - 1.5.6Yaron Koren
Category formatYaron Koren
Type CodeMarkus Krötzsch
Concept cachingMarkus Krötzsch
ConceptsMarkus Krötzsch
ConfigurationMarkus Krötzsch
Configuration 1.6.0 - 1.6.2Markus Krötzsch
Count formatMarkus Krötzsch
Custom unitsDenny Vrandecic
Markus Krötzsch
Custom units 1.5Denny Vrandecic
D3 chart formatMWJames
DSV formatJeroen De Dauw
Data exchangeMWJames
Data visualizationMWJames
Datatables formatMWJames
Debug formatMarkus Krötzsch
Directionality supportMWJames
Displaying informationMarkus Krötzsch
Displaying information 1.5.1 - 1.6.2Markus Krötzsch
Displaying information 1.7.0 - 1.7.1Markus Krötzsch
Download 1.6.1 - 1.7.0Markus Krötzsch
Download 1.7.1 - 1.8.0Markus Krötzsch
Dygraphs formatMWJames
Einführung in Semantic MediaWikiMarkus Krötzsch
Embedded formatMarkus Krötzsch
Enhancing query formsMWJames
Eventcalendar formatMWJames
Eventline formatYaron Koren
Extension:Semantic WatchlistJeroen De Dauw
ExtensionsMarkus Krötzsch
Extensions (fr)Markus Krötzsch
Further resultsMWJames
Feed formatMWJames
Fehler meldenMarkus Krötzsch
Fixed propertiesNischayn22
... further results

This shows all Docinfo author links from Category:Semantic MediaWiki documentation to Category:Developer.

Displaying it as a crosstab will require templated output, most probably, using Lua (particularly, mw.loadData).

Alexander Mashintalk03:58, 20 June 2014
 

Querying for extra columns without filtering

Hi,

Is it possible within a #ask to query for extra columns of data to display, without applying a filter to them? For example, I'd like to do something like the following query from SPARQL:

SELECT ?year ?name WHERE {

 ?run ranIn ?year .
 ?run runOf ?module .
 ?module name ?name . 

}

I can do all of this except getting the name in #ask syntax. Is it possible to do this? Also, how often are inline #asks updated?

Thanks!

Hyphz (talk)20:31, 10 June 2014

How to Query Maps without coordinant's

A thread, Thread:Semantic-mediawiki.org:Community portal/How to Query Maps without coordinant's, was moved from here to Category talk:Semantic Maps examples. This move was made by Kghbln (Talk | contribs) on 8 May 2014 at 08:21.

Guidance on creating an employee form?

Hello,

I'm working on creating a single form that produces an infobox for applicant, freelancer and employee pages.

What I would like to do[edit]

These three types of pages share 90% of the same fields -- that's why I opted for a single class instead of 3 different classes. The issue is that the remainder 10% are fields that are exclusive to one or more of the aforementioned types of pages. For example: "Interview Date" should only be displayed in the infobox when the type of page is an applicant. Another example: "Join Date" should only display on employee type of pages (it would be silly to display "Join Date" on an applicant type of page -- as they're in the selection process).

What I have tried[edit]

So far I have modified the form to use "show on select". There is a field property called "Type" which allows the user to select between applicant, freelancer and employee. Depending on the selection, certain fields are shown and others are hidden (the 10% I talked about before). The majority of fields are shared by all three types.

The problem is that while these fields hide and show themselves correctly when editing a page with the form, they ALL display regardless on the template, e.g. "Join Date" and "Interview Date" shown up on all three types of pages.

What I need[edit]

I've been trying to figure out the ideal way to have the template (which controls the infobox display) to have the same hide and show functionality as the "show on select" option that the form provides.

These are the options I have considered:

  • Add an #ask query to the template which uses FULLPAGENAME and ?Has type to retrieve whether the page is of an applicant, freelancer or employee type. From there use IF statements on each of the fields that should be hidden/displayed according to the value of ?Has type. E.g., if the ?Has value = Applicant then display "Interview Date", else don't display it.
  • Create a template for each type of page to display only the appropriate fields, and then call the template by, again, using an #ask query and IF statements on the person page.

Both options seem messy and I doubt they'd update properly (due to asking for info that is on the same page where the value is set in order to display/hide fields ...). I also have the feeling I'm missing something obvious and it's doing my head in.

My questions[edit]

  • Has anyone tried to create a similar type of form in the past?
  • What's the best way of going about this?

Any guidance, tips or pointers in the right direction would be greatly appreciated.

If you need more information or clarification please let me know.

Thank you.

Optimae (talk)01:18, 18 January 2014

You may be missing something - in the template, you don't need to use a query to get the value of a field, if you already have that field. In other words, you could have something like "{{#ifeq:{{{Type|}}}|Employee|....}}".

Yaron Koren (talk)17:58, 19 January 2014
 

ParserFunctions and Templates and SMW???

I have some templates that use ParserFunctions (specifically #if, if that matters). How do I use SMW properties with those templates? For example, I have
| termend =

| termstart =


Where I have a property for term start (Term start) and one for term end (Term end). How do I tie these template items to those properties? (It's got to be possible, right?)

K llandon (talk)21:42, 22 April 2014

Okay, apparently it doesn't like my code, even inside code tags. See for example at http://en.wikipedia.org/wiki/Template:Infobox_Officeholder - we're talking about the part with lots of {{{ for terms (I've pulled this template over from Wikipedia).

K llandon (talk)21:50, 22 April 2014
 
First page
First page
Previous page
Previous page
Last page
Last page