N4 (notation)

Template:Expand Template:Technical

N4 is another notation for RDF like languages. It is named N4 because it is "after" N3.

Contents

The Syntax

The N4 syntax is intentionally very simple:

N4 = '(' *(uri (uri | String | N4)) ')'

A short example:

(
    n4ns:n4 http://n4.org/n4/ 
    n4ns:p http://x.org/personal/
    n4ns: http://x.org/docs/1/

    p:Person (a n4:Class 
       n4:dof (li x:address li x:name)
    )
    p:Address (a n4:Class
       n4:dof (li p:city li p:street)
    )
   
    (li p:city li p:street)(a n4:Property n4:range n4:String)
    
    :me (a p:Person p:id "me"
       p:address (a p:Address id :me/address 
           p:city "Paris"
       )
    )
    :me/address (p:street "tur")
)

Comments about the example

  • it is a parenthesized expression
  • namespaces are used as shorthands for uris
  • the empty namespace is the current n4 document
  • each n4 expression is a sequence of attribute-value pairs
  • An attribute name can be a n4 expression
  • a n4 expression denotes an "object", i.e. an uri with assertions on it.
  • keywords 'a', 'li' and 'id' are "specials" uris
    • 'a' types an expression
    • 'li' introduces an element of a list
    • 'id' names an expression in a namespace
  • a blind list in subject position is a list a of subjects

Metaclasses

RDF based notations use a metaclass based design which can be used to represent things in a very concise way. Lets recall that a Metaclass is a class whose instances are also classes.

Metaclasses allow to define class variables, i.e. slot values hold by classes. Class variables are naturally shared by all instances of the class.

:mc (a n4:Class n4:subClassOf n4:Class)
(li :fcolor li :bcolor) (a n4:Property n4:domain :mc)
:c (a :mc :fcolor "red")
:o1 (a :c)
:o2 (a :c)
  •  :o1 and :o2 are instances of c and share the value of the slot :fcolor.
  •  :c is a class whose class is a metaclass
  •  :c is also a regular object.

Shared slots allow to use an interesting idiom : only define objects which are classes, and derive them following the two relations is-instance-of AND is-subclass-of. Lets note this double relation by the keyword "as".

:c1 (as :c :bcolor "white")
:c2 (as :c1 :fcolor "red")
:c3 (as :c1 :fcolor "blue")
:c4 (as :c3 :bcolor "red")


WebResourceDescriptionLanguage

Here is presented the WRSDL format, which allows to type web resources on a given site, and to map various url schemes to these resources.

An example:

(n4ns: http://n4.org/wrsdl/s1
n4ns:r http://n4.org/wrsdl/1.0/schema

:site (a r:Site r:name "example site"

   li (a r:Resource r:name "home" id :home
      li (a r:Get r:description "the home page "
         li (a r:Accept r:mime "text/html")
         li (a r:Accept r:mime "application/n4" r:class :Home)
      )
   )
   li (a r:Resource r:name "welcome" id :welcome r:description "splash"
      li (a r:Get 
         li (a r:Accept r:mime "image/gif" id :welcome/gif)
         li (a r:Accept r:mime "image/png" id :welcome/png)
      )
   )
)

:xmap (a r:Mappings r:host "n4.org:4445" r:context "/example/s1")
:map/home (as :xmap 
   li (a r:Mapping r:of :home
      li (a r:Path r:value "/Home")
   )
)
:map/welcome (as x:map 
   li (a r:Mapping r:of :welcome
      li (a r:Path r:value "/Welcome")
      li (a r:Parameter r:name "size" r:type :sizes)
   ) 
)

:sizes (a r:Enumeration li "small" li "big" li "huge")

:Home (a r:LinkSequence)  


Navigation

  • Art and Cultures
    • Art (https://academickids.com/encyclopedia/index.php/Art)
    • Architecture (https://academickids.com/encyclopedia/index.php/Architecture)
    • Cultures (https://www.academickids.com/encyclopedia/index.php/Cultures)
    • Music (https://www.academickids.com/encyclopedia/index.php/Music)
    • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
  • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
  • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
  • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
    • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
    • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
    • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
    • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
  • History (http://www.academickids.com/encyclopedia/index.php/History)
    • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
    • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
    • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
    • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
    • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
    • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
    • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
  • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
  • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
  • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
  • Science (http://www.academickids.com/encyclopedia/index.php/Science)
    • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
    • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
    • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
    • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
    • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
    • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
    • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
    • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
  • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
    • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
    • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
    • Government (http://www.academickids.com/encyclopedia/index.php/Government)
    • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
    • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
  • Space and Astronomy
    • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
    • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
  • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
  • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
  • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
  • US States (http://www.academickids.com/encyclopedia/index.php/US_States)

Information

  • Home Page (http://academickids.com/encyclopedia/index.php)
  • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)

  • Clip Art (http://classroomclipart.com)
Toolbox
Personal tools