Discuss Properties and types

From semantic-mediawiki.org

Talk pages on this wiki should primarily be used to address possible mistakes as well as missing and superseded information in the documentation.
In case you are seeking support concerning individual questions, please have a look at this page. The Semantic MediaWiki user mailing list is always a good idea for seeking help.

Archived pages can be accessed here.


Thread titleRepliesLast modified
Icon as link within property declaration114:56, 11 October 2016
Semantic inner queries are not resolving211:14, 1 September 2016
Tags inside Property Value220:28, 20 February 2015
Is any part of the data type declaration case-sensitive?111:23, 11 December 2014
Naming convention: Population v. ``Has population''...renaming??220:47, 8 November 2014
[RESOLVED] Values not showing on property page004:18, 10 October 2014
How to change date format in property page?010:48, 6 February 2014
Property and Type for a wiki user...115:25, 15 August 2013
Type Text318:26, 8 May 2013
Question about url-type properties217:52, 22 February 2013
Wrong property type107:15, 21 February 2013
State to abbreviation 417:03, 3 December 2012
Renaming Properties?100:10, 29 October 2012
Newbie confusion and typos102:13, 23 October 2012

Icon as link within property declaration


I know that there is a feature to change the link-text of a property. E.g.: [[myProp::theValue|click me]] I tried to change "click me" into an icon but without success: [[myProp::theValue|[[File:myIcon]]]] is there a feature for that?

Thanks for help.

12:24, 18 August 2016

Mediawiki doesn't work that way. You can turn an image into a link only by adding a |link= parameter to the file call. Since you can't add semantic markup to an image, you'd have to process that separately (probably using the {{#set}} parser function so it happens invisibly). So to do what you want, it would look like this:

[[File:myIcon|link=theValue]] {{#set: myProp=theValue }}
14:54, 11 October 2016

Semantic inner queries are not resolving

Edited by author.
Last edit: 11:14, 1 September 2016

Hi I have migrated MediaWIKI v1.21.2 to v1.25.3 with SMW v1.8 to v2.3 Semantic data is being queried with below code and data is displaying in a table of three columns. All seems fine now except the only issue is the shortname of users is not resolving to their full-names.

{{#ask:[[keyword::Seal portal]] [[organisational units::Organisation/Exploration (EXP)]] |link=none |mainlabel=- |?#=file |?author=author |?status=year |?article display name=article display name |format=template |template=publication/list |introtemplate=publication/list/intro |outrotemplate=publication/list/outro |sort=status |order=descending |limit=20000 |named args=yes }}

The name is now look alike For exmaple : shortname::User:sasaah

Could someone help would greatly appreciated !


15:54, 19 August 2016

After several requests [0] to provide an appropriate example, I went ahead (and this will be my last attempt to explain what we expect or require) and created [1] based on the information provided by the #ask statement above.

[1] example produces an output with the template provide earlier [0], yet it does not show or contain the mentioned `shortname::User:sasaah` output.

Please be so kind and adapt [1] so that we can actually see where `shortname::User:sasaah` as output appears otherwise it will be very difficult for us to provide further assistance.

[0] http://sandbox.semantic-mediawiki.org/wiki/Discussion_utilisateur:Sanjay [1] http://sandbox.semantic-mediawiki.org/wiki/ExplorationExampleUsingTemplateFormat

16:41, 19 August 2016

for security reason, all data cant be reflected in sandbox as requried. But I can reflect some of example data as requried. And its related to inline query expression like User:sasah should resolve to the full name as 'Sanjay Sahu' I have rebuild the semantic data using 'rebuildData.php' but it did not help.

Could you say how did you added data to the table at below example page displying for user/Author : HumptyDumpty ? so that I can add some more example data.



15:41, 30 August 2016

Tags inside Property Value

After placing a Reference Tag inside of a Property Value within a SMW Form, I received the following error on the page: "Error: The given value was not understood." Any ideas why <tags> cannot be used within a property?

I'm currently running on Medawiki 1.23.2, SMW 2.0, Semantic Forms 2.6, Semantic Internal Objects 0.8.1, Semantic Results Formats 1.9.

19:15, 29 August 2014

I think it would be a very useful feature if a datatype "wiki markup" would be available. Even if there would be some restrictions e.g. limiting the markup to non semanti-mediawiki content and maybe having to encode special characters like | and {{. Even if this kind of attribute would be non -queryable it would be o.k. as long as the bindings to the parent object parent page would be available. This way wiki markup/tags could be transported within semantic content and their would be many usecases for this.

12:28, 2 November 2014

MediaWiki generally encodes content for any <tag> notation [0] which makes fetching the plain value (when displayed by the browser) after it has been processed by MW rather complex [1].

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

[1] https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/794

20:28, 20 February 2015

Is any part of the data type declaration case-sensitive?

I'm having problems on one of my wikis, where using

[[has Type::Number]]

or variations still causes numbers to show links to internal pages (which don't exist). Is "has", "type", or "number" case-sensitive?

19:26, 10 December 2014

Naming convention: Population v. ``Has population''...renaming??

The naming convention discussion is a good one and is vitally important.
has type is easily confused with has population for us newbies (it was for me) and when you're confused by the assignment statement you're not off to a good start.
I was confused by the frequent and sometimes erroneous use of ''[[Has population::123456]]'' and ''[[population::123456]]''

I am still confused by the Berlin example.

When you say:
The annotation avoiding ambiguity is as follows:
Germany's capital is called [[Has capital::Berlin]]. ↔ [[Is capital of::Berlin]] is the capital of Germany.
Are you saying that we're going to create two distinct properties
  • Has capital
  • Is capital of
Perhaps it's my ignorance of the precise meaning of the symbol: "↔"
Perhaps you're saying Property names should follow the expected usage, the expected context.
Perhaps you're saying something else altogether.
01:14, 23 October 2012


indeed sometimes this wiki uses "Has population" and sometimes "Population". This should be consistent. I thought that I tracked all of them but obviously I did not. I recommend to use a more distinct naming scheme following the expected context.

The example the Berlin just explains that two distinct properties have to be created in case you would like to cater for the expected context. Both properties take Berlin as a value, but the meaning conveyed by the property is different in both cases. The symbol "↔" may best be seen here as a replacement for "compared to".

In case you want to avoid having two different properties you would just call it "Capital". Both properties mentioned above will probably never be used on the same page, so doing "Capital" is arguably a valid solution, too. I personally follow the two properties scheme here since this proved to be the better solution for me. Again, there are other opinions around, too.


02:03, 23 October 2012

Indeed, I was confused about this as well. Or more specifically, the information on the page is confused about this.

The "property nomenclature" discussion is important. However, it also seems to throw new users off -- especially when the manual itself is not consistent about this. If the very page that tells a user how to name properties can't even do it right itself, then how are users expected to get it right.

Would the original authors object strongly if I re-structured the text a little, maybe emphasising practical examples at the top and postponing the "property nomenclature" discussion/recommendation until after the user has been given a change to grasp the basic concept of properties? I'm also thinking of add a note to mention that the "has" verb is not special: "has population" and "population" does not describe the same property. "Has" is used to produce a property that is better distinguishable from the other interpretations of this property. E.g. for the property "wife":

  • "has wife" --> Relation. Barrack has wife Michelle. (Although for programmers this might be even less clear, as is could also be a boolean, whether or not Barrack "has (a) wife".)
  • "is wife of" --> Relation. Michelle is (the) wife of Barrack.
  • "is wife" --> Boolean. Michelle 'is (a) wife'.
  • Category: Wife or Wives. Putting Michelle in the category of (known/famous) wives. Similar to "is wife" above, but the category might also include e.g. dictionary categorization, etc).

In the end, what matters is that properties are named and used consistently. Using the "has" verb prefix to make properties with a clear meaning is one way to help obtain that.

One might add that specifying both "has wife" and "is wife of" is redundant and against the "wikipedia" philosophy of centralizing the information and avoid repeating/scattering the information. In the context of semantic wiki, it might be better to use an inverse property instead of specifying both, e.g. use "-has wife" in place of "is wife of". (That discussion is, of course, beyond the scope of the present page.)

20:47, 8 November 2014

[RESOLVED] Values not showing on property page

MW 1.18.0 - SMW - SF 2.5.2

I created a new property of type Page, added it to an existing template/form, made it auto-complete on a category, and entered some values in existing pages using the form. It works fine and the values are displayed on the edited pages as links to the value's page.

When I tried to query against the new data I got no results so looked at the property page and found none of the the new values were showing up.

I'm stumped as to possible causes/fixes for this and appreciate in advance any tips or pointers.

23:38, 12 September 2014

How to change date format in property page?

I would like to ask whether the date format in the property page could be changed. For example, in the property page of a DateType property, pages using this property in the list are automatically arranged by date. But the date displayed is always in the day-month-year format (e.g. 30 December 2013 23:59:25). I would like to know how to change it into year-month-day format. I have tried to search for solutions in this wiki but it seems that there is no related content.

10:48, 6 February 2014

Property and Type for a wiki user...

Hi all,

We're using the Wiki software to great effect in a company environment. We are logging quite a few different business related activities and we need to assign a "User" type to a property then use that property on various pages. The property can be something like [[Is assigned to::Chuck Norris]].

I've created just a regular "Text" property but the issue is that there's no validation against the list of actual users.

Has anyone else faced and solved this problem?

Cheers Walter

15:15, 8 August 2013

I would recommend you to use Extension "Page Forms" for that. There you can use dropdown menu to fill your template with values

15:25, 15 August 2013

Th article suggests a text area can be an arbitrary length, however I have experienced failures to enter data when the entry is very long (somewhere around 1900 characters seems to be the limit) the edit fails and the page is left completely blank. Is this a variable that can be adjusted somewhere?

12:37, 8 May 2013

This sounds like an issue with Semantic Forms, not Semantic MediaWiki. But the issue might be a setting you can change in PHP or Apache (assuming you're using Apache).

17:05, 8 May 2013

Yes, I am using Apache. Have you any idea where I might look to diagnose what the problem might be?

18:06, 8 May 2013

I don't know, sorry. It should be something related to submitting text from within forms, using POST.

18:26, 8 May 2013

Question about url-type properties

Edited by another user.
Last edit: 18:39, 18 February 2013

The link in the header (http://example.com ) does not work as I expected it to work. Thus when I browse properties for a page with this link I something like: Is website - Http://example.com Where Http://example.com links to the next page: http://mywiki/index.php?title=Http://example.com While I expect it to link to the http://example.com site itself.

18:38, 18 February 2013

Of course, Property:Is website does not work since it is a unknown property (here on this website) which has no type declaration.

For more information about the url-type properties, see Property:Has URL.

18:54, 18 February 2013

Thank you for the tip! Works now!

17:52, 22 February 2013

Wrong property type

For some properties, the property type is defined as something other than "Page" type using "Has type:", but they show up as "Page" type on Special:Properties.

02:17, 21 February 2013

Have you checked that you use a double colon? e.g. string. Furthermore, if you use __SHOWFACTBOX__ then the factbox should show the Has type special property for your property page.

07:15, 21 February 2013

State to abbreviation

Ok, don't want to reinvent the wheel here, as I'm sure something like this has been done before. I have a property of State, which is set to whatever state based on the page name. I want to add on an if statement, like if State::Texas, then StateAbr::TX. I'm sure there has to be a better way than having 50 if statements on every page?

18:30, 21 November 2012

I think that it's better to create a page for Texas and add a property Abbreviation on a page Texas.

23:40, 22 November 2012

Well I want to be able to do an ask query on either Texas or TX to grab the pages that have that property. So if someone does a Semantic Forms runquery and types in Austin, Texas or Austin, TX, I can run a query like:

{{#ask: [[State::{{{query|}}}]] OR [[StateAbr::{{{query|}}}]]
| ?Coordinates#
| format=map
17:48, 26 November 2012

then you can probably use Parser Functions extensions, i.e. switch function. You can wrap into a template an expression that will check the value of the property State and the consequence of switch will be setting StateAbr property.

05:09, 29 November 2012

Didn't even think of that. I was able to put it into the Semantic Form, so it does the switch once when the page is created and that's it. Thanks, and here it is in case it might save someone some time.

{{#switch: "Entered State" | Alabama = AL | Alaska = AK | Arizona = AZ | Arkansas = AR | California = CA | Colorado = CO | Connecticut = CT | Delaware = DE | Florida = FL | Georgia = GA | Hawaii = HI | Idaho = ID | Illinois = IL | Indiana = IN | Iowa = IA | Kansas = KS | Kentucky = KY | Louisiana = LA | Maine = ME | Maryland = MD | Massachusetts = MA | Michigan = MI | Minnesota = MN | Mississippi = MS | Missouri = MO | Montana = MT | Nebraska = NE | Nevada = NV | New Hampshire = NH | New Jersey = NJ | New Mexico = NM | New York = NY | North Carolina = NC | North Dakota = ND | Ohio = OH | Oklahoma = OK | Oregon = OR | Pennsylvania = PA | Rhode Island = RI | South Carolina = SC | South Dakota = SD | Tennessee = TN | Texas = TX | Utah = UT | Vermont = VT | Virginia = VA | Washington = WA | West Virginia = WV | Wisconsin = WI | Wyoming = WY | no match}}
17:03, 3 December 2012

Renaming Properties?

Wait a second. Hold the phone.
I was going to ask about renaming properties; I'm guessing this is not the best idea. But, why not?
Why not just Move a Property page?
But before we get to that...
Let's talk about the contents of Special:Properties page.
on Special:Properties there are:
Orange links
I have no idea what these are. Some are preceded some text, such as, "7 of type", some are followed by a number in parenthesis, while others are followed by a datatype in parenthesis.
Some of these pages exist and some don't.
Has label exists
Has value does not exist
those pages that exist I can Move but I suspect the orange links are errors of some type
Blue Links
These pages exist and, therefore, I can Move them. But I notice a difference between Cover_image and Country. One contains what seems to be automatically inserted text whilst the other does not. Perhaps this is because Properties can be created in at least two ways:
Manually Creating a Property page
Using the Special Page: Create a property from the Special Pages
is there any way to tell how a page was created; is there any way to tell if it was created "manually" or via the Create a property page?
Red links
These pages don't exist and, therefore, cannot be moved.
Perhaps these Properties, I mean these pages, should have been created and should now be created.
So my questions are:
What can I tell by looking @ the Special:Properties page?
Can I rename Properties by moving the page?
Is it a Best Practice to create properties via the Special:CreateProperty?
Is it Best Practice to rename properties?
Is is there any way to tell how a Property was created, viz., via Special:CreateProperty or "manually"?
08:19, 23 October 2012
  • Special:Properties shows you the properties existing in the wiki: special properties (usually only in italics but here additionally in orange to allow better identification), properties with blue links (respective properties were created assigning a datatype and/or providing infos about the property) and properties with red links (no datatype was assigned, thus they will be of type page, and without infos about the property) Note: This special page is kinda broken right now (2012-10-28). I will file a bug for this.
  • I guess you can, but I would not recommend to do it. There have been several mails on the mailing list that report some kind of problem resulting from this. So I recommend creating a new property with the desired name and changing all property assignments from the old to the new property. One may consider using the "Replace Text" extension for this or some bot.
  • Special:CreateProperty is provided by the "Semantic Forms" extension, so if this one was not installed you cannot use is. However, in case this extension was installed I would recommend using it since it helps you doing so.
  • This depends. I am sure that there are cases there you might want to rename a property. However, I would not do this all the time and only after consideration (see above)
  • Yes, Special:CreateProperty adds a standardised message: Created page with "This is a property of type ...".


00:09, 29 October 2012

Newbie confusion and typos

When we reference a property
[[Is capital of::Germany]]

and then say:

"The additional text "capital of" [emphasis added] is the name of the property that classifies the link to Germany."
We're wrong; right?
It should be "Is capital of"
I mean the additional text, the property to which we're assigning the value Germany, consists of the text--that in this case consists of three words--between ``[['' and ``::'' is: Is capital of
01:05, 23 October 2012

Heiya, yes to both. I have amended the typos leading to inconsistencies within the documentation and thus to confusion. Thank you for pointing this out. Cheers

02:13, 23 October 2012