Skip to content

URI hierarchy

rspeer edited this page Oct 12, 2011 · 26 revisions

This page is wrong!

The system of

But here's the documentation anyway

Nodes in ConceptNet have URIs. A URI should tell you:

  • what kind of object you're looking at
  • important defining properties of it, such as its language or its text ("name")
  • (if you prepend a server name) what URL to go to to get information about it, when we put up our API

For example, one concept URI is /concept/en/coffee. The type is "concept". The type defines that the parts that come next are the language (en) and the concept name (concept).

The internal encoding is UTF-8 with spaces changed to underscores. We don't URI-encode things on this end (such as changing apostrophes to %27), though someone accessing our API will have to do that.

List encoding

When a URI needs to contain a list of components, it is a tree-structured URI. The special URI components /[ and /] mark the beginning and end of a list, and the items in the list are separated by /,.

For example, a conjunction might have a list of conjuncts, containing /source/contributor/omcs/rspeer and /source/activity/commons2-question. The resulting URI is:

/conjunction/[/source/contributor/omcs/rspeer/,/source/activity/commons2-question/]

We guarantee that the special components /[, /,, and /] will always appear next to another slash or at the end of the string, so that other things are not mistaken for these components. If a list item begins with http://... because it is an external Semantic Web node, we represent it in the URI as /http://....

(We used to do this with strings between quotation marks, and some documentation may stil reflect this. The quoting/escaping issues involved were absurd.)

The hierarchy

/: the root object, possibly the starting point for spreading confidence and for garbage collection

/assertions: Assertions

  • Assertions are specified by several concepts (the first of which acts as a relation) in a JSON list.
  • Examples:
    • /assertion/[/relation/IsA/,/concept/en/dog/,/concept/en/animal/]
    • /assertion/[/relation/UsedFor/,/concept/zh_TW/枕頭/,/concept/zh_TW/睡覺/]

/concept: Concepts

Specified by a language and a name.

  • /concept/en: English concepts
    • /concept/en/coffee (for example): the concept "coffee" in English
    • /concept/en/for: the preposition "for", probably being used as a relation
  • /concept/zh_TW: Traditional Chinese concepts as used in Taiwan

/conjunction: conjunctions between sources

See below for how sources are specified. The sources in a conjunction are separated by /_.

  • /conjunction/[/source/web/en.wiktionary.org/,/source/rule/wiktionary_scraper/] (for example): we read things from Wiktionary with a scraper

/frame: text patterns

Specified by a name only.

  • /frame/{1}_is_used_for_{2} (for example)

/relation: language-independent relations

Specified by a name only.

  • /relation/UsedFor (for example): the "used for" relation, across all languages

/source: knowledge sources

Specified by an arbitrary hierarchy, examples of which are shown here.

  • /source/contributor: crowd-sourced contributors.
    • /source/contributor/omcs/bedume: contributors from the OMCS database
    • /source/contributor/petgame/3362: contributors from the NTU pet game
  • /source/web: Web sites
    • /source/web/en.wiktionary.org: a Web site, considered as a whole
  • /source/activity: an interface used by contributors
    • /source/activity/analogyspace
  • /source/rule: a derivation rule, ideally packaged with the code
    • /source/rule/wiktionary_scraper
Clone this wiki locally