Help:Datatype "URL"

Jump to: navigation, search
Holds URIs, URNs and URLs
Further Information
Provided by: Semantic MediaWiki
Added in version: 1.0
Removed in version: still in use
Datatype ID:
Table of Contents

URL is a built-in datatype of Semantic MediaWiki that is used for the most common kinds of URLs, URNs, and URIs. It accepts almost any string and interprets it as a URL. The URL appears as a link in text and the Factbox.

Technically speaking, email addresses and even telephone numbers are also kinds of URLs. There are special datatypes for these kind of inputs that should be used in such cases: datatype "Email" and "Telephone number".

Text vs. URL

MediaWiki will generally display a property of Text that starts with http:// or https:// as a hyperlink. However, strings do not check the validity of the input as a URL, and URLs have different meaning in RDF export, so it is generally recommended to use Type:URL if applicable.

The URL type denotes that it is a reference to something else. The ontology language OWL DL that we use as an export format uses many URIs for identifying its language constructs. But it is not desirable to make new statements about those language constructs. For example, you clearly do not want to declare owl:sameAs, the property that specifies that two individuals refer to the same concept, as the capital of Germany! For this reason, the datatype Type:URL disallows certain URIs that already have a predefined meaning that cannot be used without changing the output format of the whole wiki. The corresponding URI ranges are specified by the MediaWiki message MediaWiki:smw_uri_blacklist which can be extended by wiki-administrators. URIs from those ranges will be rejected by the wiki, but this will not have any effect on normal usage where URIs typically just point to some web-resource, such as an HTML or image document.

Searching within values

Since Semantic MediaWiki 1.8.0 the first 40 characters (if more than 72 characters were stored as property value) or all 72 characters (if a maximum of 72 characters were stored as property value) are searchable as explained on the help page about selecting pages.1 Searching within property values was not possible in earlier versions of Semantic MediaWiki (≤ 1.7.1).

Semantic MediaWiki 2.5.0 introduces full-text search2 which allows to search with in more than just the maximum of 72 characters as described before.

Semantic MediaWiki 3.0.0 introduces configuration parameter $smwgFieldTypeFeaturesSets relational database specific field type features with it's option SMW_FIELDT_CHAR_LONG3 making it possible to extend the searchable length as described here to 300 characters4 without relying on the full-text search feature.

Displaying results

There is one output format NOWIKI available which is specific to this datatype. It escapes the URL and displays it as a plain string. This is useful if you e.g. want to generate links containing text on the page with the query result. See the help page on displaying information for further information on this.

Related query syntax elements


Help pageSyntax elementDescription
#ask: annotation query marker
Marks an inline query as part of an annotation5
#ask: control query marker
Allows to dynamically alter a result display without the need to reload a page6
#ask: deferred query marker
Marks an inline query as deferred from regular parsing6
#ask: hierarchy depth restriction
Restricts the hierarchy depth of a query7
#ask: printout column width
Defines an alignment for the content of a printout column
#ask: printout column width
Defines a width for a printout column8

This documentation page applies to all SMW versions from 1.8 to the most current version.
Other versions: 1.0 – 1.7.1       Other languages: de

Help:Type URL en 1.8


  1. ^  Semantic MediaWiki: User mailing list thread " Unable to query over the last words of a long text value "
  2. ^  Semantic MediaWiki: GitHub pull request gh:smw:1481
  3. ^  Semantic MediaWiki: GitHub pull request gh:smw:2536
  4. ^  Stack Overflow: Question 3489041: Mysql::Error: Specified key was too long; max key length is 1000 bytes
  5. ^  Semantic MediaWiki: GitHub pull request gh:smw:2572
  6. a b  Semantic MediaWiki: GitHub pull request gh:smw:2398 (Add support for @deferred mode)
  7. ^  Semantic MediaWiki: GitHub issue gh:smw:2662
  8. ^  Semantic MediaWiki: GitHub pull request gh:smw:2677