How to get the name of a Wikidata item within wikicode? - mediawiki

Let's say I have a Wikidata item QID Q19675, and want to get the name of that item in Spanish within the wikicode of an unrelated Mediawiki page.
While getting a property like P281 postal code is easy (just write {{#property:P281|from=Q19675}}), how to get the name, which for some reason is not a normal property?
Unlike this question, this time I am not looking for a REST API, but for a Mediawiki wikicode expression.

You can use the Lua function mw.wikibase.label to get the label in the local language. If you're on a wiki that has a copy of the Wikidata template Label (e.g. the English Wikipedia), you can use that directly: {{label|Q19675}}.
If you want the label in a language other than local, use mw.wikibase.entity:getLabel.

Related

Semantic Mediawiki: Aggregation similar to GROUP BY, adding the Count

Little by little I am trying to learn Semantic Mediawiki almost like in a tutorial. I got so save info (including uri, titles and tags) for each element of a list using subobjects and then to get the list of the tag.
This is the wiki page with the list of the tags: link
Now I'd like to further explore the articles related to each tag. For example, is it possible to list the articles having the tag x? I wonder if it would be a nice idea to create a Module to parse the output of the semantic query.
SemanticMediawiki: embed some property into a piece of text
Can I use Semantic Mediawiki to add properties to each element of a list?
MediaWiki Semantic Template: Property "" (as page type) with input value contains invalid characters or is incomplete can cause unexpected results
Semantic Mediawiki error: processing error text "#category " cannot be used as a property name in this wiki
Semantic Mediawiki: writing a query that returns all the suboject defined in a page
Semantic Mediawiki: aggregation similar to SQL GROUP BY like #ask query
Best solution here is to make use of array extension.
Create an array containing all tags, and make it unique to have a "distinct list".
Then print your array, and run an ask query for each tag in the print loop, with the count format .
{{#arraydefine:tags| {{#ask:[[-Has subobject::{{FULLPAGENAME}}]] |?Tags#-=| mainlabel=-|limit = 1000}} |,|unique}}
{{#arrayprint:tags|, |####|<nowiki/>
[[####]] ({{#ask:[[Tags::####]]|format=count}})
}}
This code will print a link to each page named as tag value, and print the number of subobjects that hold this tag. Even if the solution is not optimal, as you are running a lot of independent queries, you should not have performance issues unless you have very high traffic on your wiki.
Nota bene : The best practice is to create a specific template for tag pages, one that list all articles having the tag. With the Page Forms extension, you can create each page automatically with this template, simply by running the job queue.

URL to an unnamed part of a web page

I'd like to refer to a specific part of a web page which I am not the author of, and which is not tagged with the NAME attribute. The specification of the part I have in mind could be made, e.g., as the location a certain word appears, and which could be manually reached via a FIND operation. I imagine something like
http://somesite.com#search-for:foo-bar
Is there some feature in HTML allowing for this?
No.
You can only link to elements with an id and a elements with a name.

Send and receive data to and from a website using the TWebbrowser component in Delphi

I'm creating a VCL Application with Delpi 10.3 and want to support some web functionality by having the user enter the ISBN of a book into a TEdit component and from there passing/sending this value to a search field on this website: https://isbnsearch.org after which the website looks up the ISBN and displays the Author of the book. I want to somehow access the information (i.e Author) presented by the search result and again use it in my application.
This is my GUI, for a better idea of what I want to accomplish:
What code can I use for this? Any other feasible suggestions or approaches are acceptable.
When performing a search on that website, it simply loads a page with a specific URL query string...
https://isbnsearch.org/search?s=suess
The above example is when I search for "suess", so you can easily concatenate a search URL.
You can use any HTTP component, such as TIdHTTP, to load this search page, then use an HTML parser to scrape the page and read what you need. Much, much easier than trying to read through the TWebBrowser.
In the end, you won't actually display the HTML (I mean you can if you want to), but the idea is to read the data and display it in your own format.
On that specific page, start by locating the ul element with id searchresults. Then, each li element contains individual results. Unfortunately, this website uses pagination, and only shows 10 results per page. To do this, call this page again with another parameter &p=2 for the 2nd page, &p=3 for the 3rd page, and so on.
On the other hand, that is the worst way to acquire such information. What you should be doing is using a proper API which gives you machine-friendly data. The service you are referencing doesn't appear to have an option, but here's an example of one which does:
https://openlibrary.org/dev/docs/api/books - this also appears to provide you MUCH more information than the one you're using.

API Blueprint on-page links in Resource group?

I'm writing a product data API in Blueprint and I'd like to provide a link in the styleNumber parameter to a # Group Value References beneath the Resource.
## GET Details for products that match any combination of the parameters below [/productservice/products/{?language,styleNumber}]
### Product Service (Products) [GET]
+ Parameters
+ language (array[string],optional)-_One or more 2 letter language codes ([ISO 639-1](https://www.loc.gov/standards/iso639-2/php/code_list.php) format, comma separated)_
+ styleNumber (array[string],optional)-_One or more 5 digit proprietary product style IDs (comma separated) See **[Value References](#Group Value References)**._
I was able to insert a working link to an external page in the language parameter, but neither a traditional markdown on-page link nor a link to a defined html name seem to be semantically valid to Apiary. Is there a way to do this?
Try
... See [Value References](/reference/value-references)._
It has to be the path to the actual heading and not the title.
URI cannot contain spaces etc., which is why what you have isn’t designed to work. I believe #value-references is meant to work as the URI anchor, but it doesn’t work in Apiary Documentation. Perhaps a bug, but maybe design.

How to display XML data(list) in HTML(CSS)

I want build a website that have two "table" to display two lists of data that stored in XML.
Category and items(think todo list. one category has more then one item)
I'm not sure how to display the list of data. What kind specific technique should I use? Can I only use HTML and CSS to achieve this(My friend said I have to use javascript).
U need to use AJAX for that purpose.
AJAX stands for Asynchronous Javascript XML...
This will help you to get your XML data loaded on Web Pages