semantic-mediawiki.org:Community portal
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.
- [View source↑]
- [History↑]
Contents
![]() First page |
![]() Previous page |
![]() Next page |
![]() Last page |
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
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
Try {{#show: Bruce Wayne | NameFirst}}
.
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.
{{#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}}
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.
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)
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.
Hi, I was searching for some result formats and I think some of them are broken or misconfigured, see:
- Demo:Tagcloud/Basic tagcloud with links (colons appearing)
- Help:Slideshow format (demo not working)
- Demo:Listwidget using parameter template (fatal error)
- Demo:Listwidget using sortkey for display (fatal error)
Thanks for reporting. I filed an issue about the fatal errors here https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/67
The Slideshow format is not working again, see the "Result:" section, after "Example".
It is a known issue [0] but someone has to pick-up the task.
[0] https://github.com/SemanticMediaWiki/SemanticResultFormats/issues/56
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!
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.
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.
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 }}
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.
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
{{#ask:[[Category:Semantic MediaWiki documentation]] [[Docinfo author::<q>[[Category:Developer]]</q>]]|?Docinfo author}}
will produce:
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
).
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!
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.
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|....}}".
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?)
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).
Hello,
Could someone please explain to me how to delete pages in WIKI? The url is www.faq.vensters.nl. There are some old pages that are not connected to a category that need to be deleted.
Thanks,
Simone
Hello all,
I'm new here. Perhaps this has been asked before, but I didn't find a possibility to search the forum for keywords. And I'm not sure if this is the right place for this question, should I use the mailing list instead? But anyway, here it is:
I want to present the relations in my knowledge base as navigable graphic. I have found the extension SemanticGraph [1] which looks quite nice. Unfortunately there is only a version available which works with SMW 1.5. I am working with SMW 1.7.1 and I couldn't get this to work.
Has anybody experience with this extension in combination with newer versions of SMW, particular 1.7.1 and can tell me what to do?
Thanks, Martin
You can always use template format combined with GraphViz.
Hello. Templates can not be used between <source lang = "blabla">
tags but they can be used between <code>
tags. Would it be possible to put the below css in MediaWiki:Common.css? This greatly improves readability of the text between <code>
tags? Regards.
/** * Redesigned <code>. * Should improve readability by not having the samples blend into the white background, * but by having a visible (though subtle) border around the code sample. */ code { border: 1px solid #ddd; padding: 1px 4px; border-radius: 2px; }
Hello--
The following query searches for all competitor in Mexico with a yield that is greater than zero. However, result does list competitors with zero yield. {{#ask:[[CompetitorlName::<q>[[Country::Mexico]]</q>]][[Yield::>0]] |?Date |?Yield |format=table }}
However, this query eliminates those competitors with zero yield {{#ask:[[CompetitorName::<q>[[Country::Mexico]]</q>]][[Yield::>0.000001]] |?Date |?Yield |format=table }}
Am I doing the first query incorrectly somehow?
Use {{#ask:[[CompetitorlName::<q>[[Country::Mexico]]</q>]][[Yield::≥0]] |?Date |?Yield |format=table }}
. Alternatively, set $smwStrictComparators to false.
Hello,
I'm trying to query those pages to count where a particular property is not empty. I've used as follows:
{{#ask:[[Competitor::! ]] |?Competitor |format=count }}
A number does result indicating how many pages have "Competitor" not null, but an error results as well: "Empty strings are not accepted".
Let me ask, is this the right way to query for non-empty properties? If this is the only possible way to do, is there a way to suppress the error?
Have you tried {{#ask:[[Competitor::+]]|format=count}}
?
Thanks, that works great! And how about those situations where the field IS empty?
I tried [[Competitor::-]], but did not work.
Hello,
I am looking for an open source solution that would allow me to create an internal knowledge base for our customer service team.
What I want to do is be able to populate the knowledge base using forms. I want to capture and maintain information in a standardized way. For instance, our customer service team wants to document certain characteristics and FAQs on the customers we service so that all representatives can reference it without having to ask the same questions over and over again. In the ideal case, the customer service reps would go to the knowledge base, search for the customer they wanted the information on, and then receive a knowledge base article on that customer with a variety of different types of information - a table of key customer contacts and their contact information, notes on the client, any relevant documents, FAQs with answers, etc. Furthermore, when a customer service rep creates a knowledge base article on a customer, I'd like for them to input these values through a form (with text fields, drop down boxes, data pickers, etc.).
I came close to accomplishing this with MediaWiki and the Semantic Forms add-on, however, I'm having trouble creating constructs for arrays of information. For instance, I want our reps to be able to add multiple contacts for a customer. I created a form per the example provided in the documentation, however, adding the contacts via contact names doesn't seem to allow for multiple contacts with the same name stored independently per customer. I hope that makes sense.
Can anyone help point me in the right direction to accomplish this?
Thanks in advance.
You can't store different contacts (or more generally, entities) with the same name. If you have two different contacts named "John Smith" (I assume that's the kind of thing you're asking about), you'll have to use some kind of disambiguation scheme - like including the middle name, or company name, or something. If you're creating contact pages via a form, you could do it by using the "one-step process" and including "unique ID" in the page name formula.
![]() First page |
![]() Previous page |
![]() Next page |
![]() Last page |