Semantic Wiki

EdgeWiki supports semantic markup and querying similar to that used by Semantic MediaWiki (“SMW”).

Each wiki page will have any number of relationships (SMW: “properties”).

Each relationship will have a name (e.g. “capital of”, “birth date”) and a value.

The value can be another wiki page (e.g. “Germany”), a simple type (e.g. string, date, geocoordinate), or a complex type (e.g. “has degree”). Each instance of a complex type can have its own set of relationships (e.g. “has degree” might have “school”, “major”, and “graduation date”).

Markup

Relationships to other wiki pages

To create a relationship to another wiki page, you simply add the relationship name to a normal wiki link, separated with a double-colon (::).

Berlin is the capital of [[capital of::Germany]].

If the link displays different text than the title of the wiki page, we use typical EdgeWiki Formatting syntax.

Berlin is the capital of [[this country >> capital of::Germany]].

If you don’t want to create a link to the wiki page, you can use the set macro, which isn’t displayed in the rendered page, but does establish the relationship.

Berlin is the capital. {{?set capital of::Germany}}

Some properties support multiple values; multiple hyperlinks and/or set macros can be used as expected.

Rome was the capital of the [[capital of::Roman Empire]] and is now the capital of [[capital of::Italy]].

Simple properties (relationships to simple values)

Simple properties use basically the same syntax.

I was born on [[birth date::June 19, 1975]].

In this case, even though the hyperlink syntax is used, “June 19, 1975” will not be rendered as a hyperlink.

Complex properties (relationships to complex values)

If “has degree” or “employment” is a complex property with properties of its own, use hierarchical syntax as follows.

John Smith was granted an [[has degree::degree::MS]] in [[has degree::major::Computer Science]]
on [[has degree::degree date::June 3, 1999]]. He has been employed by
[[employment::employer::Logos Bible Software]] since [[employment::hire date::July 1, 2006]].

For complex properties that can be specified more than once, use a disambiguating identifier after the property name, separated by a single colon (:).

John Smith was granted a [[has degree:1::degree::MS]] in [[has degree:1::major::Computer Science]]
and [[has degree:1::major::Mathematics]] on [[has degree:1::degree date::June 3, 1999]]. John
Smith was also granted a [[has degree:2::major::Basket Weaving]] [[has degree:2::degree::PhD]] on
[[has degree:2::degree date::June 3, 2004]].

He was initially employed by [[employment:1::employer::Taco Bell]] from [[employment:1::hire date::June 4, 2004]]
to [[employment:1::termination date::June 15, 2006]], but now works for
[[employment:2::employer::Logos Bible Software]].

Defining relationships

To define relationships, we create a special page that describes the relationships in one or more tables. (Multiple tables are not necessary but can be used to help readers find the relationship.) Tables must have a heading row with headings for Name and Type and optionally Description and RDF Type.

? SemanticRelationships

! Semantic Relationships

!! Nations

|** Name | Type | Description |
| capital of | page | The capital of the nation. (See [[Capitals of Nations]].) |

!! Degrees

|** Name | Type | Description |
| has degree | complex | A degree of the person. |
| degree | string | The degree. |
| major | page | The major. |
| degree date | date | The date that the degree was earned. |

!! Misc
|** Name | Type | Description | RDF Type |
| {{?semrel description}} | string | | {{~ {http://purl.org/dc/elements/1.1/}description}} |
| {{?semrel author}} | page | | {{~ {http://purl.org/dc/elements/1.1/}creator}} |

If there is a page link in the description, it becomes the official page for that relationship.

Supported Types

  • page
  • string
  • integer
  • float
  • date
  • complex

Built-in Relationships

link there is a link relationship for each link (internal or external) on the page
created-by display name of the user that created the page
created-date date the page was created
last-modified-by display name of the user that last modified the page
last-modified-date date the page was last modified

Query

Syntax

They query syntax is based on SMW’s (http://semantic-mediawiki.org/wiki/Help:Selecting_pages).

Queries are made up of a series of conditions, followed by a series of parameters joined by |. Conditions are logically ANDed together. Parameters affect the presentation of the query results.

Get the pages with a relationship department having a value Development .

[[department::Development]]

Format the results as an unordered list.

[[department::Development]] | format=ul

Get the pages with a relationship department having a value Development and a relationship gender having a value male.

[[department::Development]] [[gender::male]] | format=ul

Get the pages with a relationship department having a value Development and a relationship degree having any value.

[[department::Development]] [[degree::+]]

Use Dept as the heading for the column department .

[[department::Development]] | ?department=Dept

Comparators

Token Description Example
< less than [[age::<100]] [[name::<M]]
> greater than [[age::>100]] [[name::>M]]
! not [[age::!100]] [[name::!Richard]]
~ like (string relationships only) [[name::~vander]]
+ has value [[age::+]]
. this page (the title of the current page is used as the value) [[link::.]]

Supported Parameters

Parameter Description
mainlabel The label of the main (first) column. Defaults to blank.
format The output format (see below). Defaults to table.
sort Field or relationship to sort on. Valid options are: title, -title, date, -date or any simple relationship name. date is the page revision date. Defaults to title.
limit Limit the results to this many.
offset 0-based index of the result to start with. Use with sort.
searchlabel Text used to link to the full results if results are limited. Set to blank to hide the link. Defaults to «… further results».
values Return all values for the given relationship type. See below.
relationships Return all relationship types. See below.

Supported Output Formats

Format Description
list Comma-separated list, with additional column data shown in parentheses
ol Ordered list, with additional column data shown in parentheses
ul Bulleted list, with additional column data shown in parentheses
table Tabular output
csv Export result table as CSV (comma-separated values)
section Wiki segments (<div> tags in HTML with label as CSS class)
segment Wiki sections (<span> tags in HTML with label as CSS class)

Values Query

To get all the values of a given relationship, supply exactly one query condition with the has value (+) operator and use the values parameter.

[[department::+]] | values

Relationships Query

To get all the relationship in use, use the relationships parameter.

| relationships

To get all the relationships in use for a set of pages matching some condition, specify that condition.

[[department::Web Development]] | relationships

Complex Relationship Queries

Find all pages having the semantic property “employer” with the value “Logos Bible Software”:

[[employer::Logos Bible Software]]

Find all pages having the complex semantic property “employment” with its own property “employer” with the value “Logos Bible Software”:

[[employment::employer::Logos Bible Software]]

Find all pages having the complex semantic property “employment” with its own property “employer” with the value “Logos Bible Software” and that same “employment” property has a “hire date” property value greater than Jan 1, 2000:

[[employment::employer::Logos Bible Software]] [[employment::hire date::>1/1/2000]]

Full-Text Queries

Find pages with an “employer” property and page text containing “software”:

[[employer::+]] [software]

Inline Queries

Ask Macro

Use the ask macro to run a query inline with wiki text.

{{?ask [[employer::Logos Bible Software]] | ?hire date | format=ul}}

Queries may be split across multiple lines by using a section.

{{{?ask
[[employer::Logos Bible Software]]
| ?hire date
| format=ul
}}}

Semrel Macro

Use the semrel macro to create a link to the values query for a relationship.

{{?semrel employer}}

URL Queries

Queries can be passed to the ad-hoc query page via the query parameter. The colons (::) must be escaped.
http://examplewiki/query.aspx?query=[[employer%3A%3ALogos Bible Software]]|?hire%20date

JSON Results

The results can be returned as JSON by adding format=json to the URL.
http://examplewiki/query.aspx?query=[[employer%3A%3ALogos Bible Software]]|?hire%20date&format=json
produces:

{"Results":[{"Page":"John Smith","hire date":"7/1/2006"},{"Page":"Harry Jones","hire date":"8/15/2006"}]}

A callback JavaScript function can be passed with the format parameter:
http://examplewiki/query.aspx?query=[[employer%3A%3ALogos Bible Software]]|?hire%20date&format=json&callback=processData
produces:

processData({"Results":[{"Page":"John Smith","hire date":"7/1/2006"},{"Page":"Harry Jones","hire date":"8/15/2006"}]})

Feed Results

The results can be returned as an Atom or RSS feed by adding format=atom or format=rss to the URL. Any relationships that are part of the result set will be returned as an HTML definition table unless the content URL query parameter is also provided, in which case the content of the page will be returned in the requested format. Valid content types are: xhtml, html and wiki.
http://examplewiki/query.aspx?query=[[employer%3A%3ALogos Bible Software]]|?hire%20date&format=rss&content=wiki

iCalendar Results

The results can be returned as an iCalendar file or feed by adding format=ics to the URL. The query must contain one relationship of type date or one complex relationship event relationship (see below).
http://examplewiki/query.aspx?query=[[employer%3A%3ALogos Bible Software]]|?hire%20date&format=ics

An events is a complex relationship with a relationship named date of type date and a relationship named recurrence. Recurrence can be one of: secondly, minutely, hourly, daily, weekly, monthly or yearly.

John Smith was born [[birth::date::7/29/1979]].
{{?set birth::recurrence::yearly}}

webcal://examplewiki/query.aspx?query=[[employer%3A%3ALogos Bible Software]]|?birth&format=ics



Logos Bible Software Wiki

Welcome, Guest! (sign in)