On this page:
15.1 Turtle
15.2 RDF/  XML

15 Appendix: Names Defined🔗ℹ

Starting with the productions from [SPARQL11QL] section 19.8 Grammar:

[6]    PrefixDecl      ::= 'PREFIX' PNAME_NS IRIREF

 

[136]  iri             ::= IRIREF | PrefixedName

[137]  PrefixedName    ::= PNAME_LN | PNAME_NS

 

[140]  PNAME_NS        ::= PN_PREFIX? ':'

[141]  PNAME_LN        ::= PNAME_NS PN_LOCAL

 

[164]  PN_CHARS_BASE   ::= [A-Z] | [a-z] | [#x00C0-#x00D6]

                         | [#x00D8-#x00F6] | [#x00F8-#x02FF]

                         | [#x0370-#x037D] | [#x037F-#x1FFF]

                         | [#x200C-#x200D] | [#x2070-#x218F]

                         | [#x2C00-#x2FEF] | [#x3001-#xD7FF]

                         | [#xF900-#xFDCF] | [#xFDF0-#xFFFD]

                         | [#x10000-#xEFFFF]

[165]  PN_CHARS_U      ::= PN_CHARS_BASE | '_'

 

[167]  PN_CHARS        ::= PN_CHARS_U | '-' | [0-9] | #x00B7

                         | [#x0300-#x036F] | [#x203F-#x2040]

[168]  PN_PREFIX       ::= PN_CHARS_BASE

                           ( ( PN_CHARS | '.' )* PN_CHARS )?

[169]  PN_LOCAL        ::= ( PN_CHARS_U | ':' | [0-9] | PLX )

                           ( ( PN_CHARS | '.' | ':' | PLX )*

                             ( PN_CHARS | ':' | PLX ) )?

[170]  PLX             ::= PERCENT | PN_LOCAL_ESC

[171]  PERCENT         ::= '%' HEX HEX

[172]  HEX             ::= [0-9] | [A-F] | [a-f]

[173]  PN_LOCAL_ESC    ::= '\' ( '_' | '~' | '.' | '-' | '!' | '$'

                               | '&' | "'" | '(' | ')' | '*' | '+'

                               | ',' | ';' | '=' | '/' | '?' | '#'

                               | '@' | '%' )

As well as section 19.5 IRI References:

Text matched by the IRIREF production and PrefixedName (after prefix expansion) production, after escape processing, must conform to the generic syntax of IRI references in section 2.2 of RFC 3987 "ABNF for IRI References and IRIs". For example, the IRIREF <abc#def> may occur in a SPARQL query string, but the IRIREF <abc##def> must not.

This package has the following type mapping:

Racket type

  

SPARQL production

prefix-name?

  

PNAME_NS

local-name?

  

PN_LOCAL

prefixed-name?

  

PrefixedName

As well as the following string predicates:

Racket type

  

SPARQL production

prefix-string?

  

PNAME_NS

prefix-name-string?

  

PN_PREFIX

local-name-string?

  

PN_LOCAL

prefixed-name-string?

  

PrefixedName

15.1 Turtle🔗ℹ

The Turtle grammar, [RDF11TTL] section 6.5 Grammar reuses the definitions in SPARQL. Note that in the rule number [6s] the suffix "s" denotes this specifically as a rule borrowed directly from SPARQL.

[4]     prefixID       ::= '@prefix' PNAME_NS IRIREF '.'

 

[6s]    sparqlPrefix   ::= "PREFIX" PNAME_NS IRIREF

Also, section 7.2 RDF Term Constructors contains a table, a subset of which is below.

production

  

type

  

procedure

PNAME_NS

  

prefix

  

When used in a prefixID or sparqlPrefix production, the prefix is the potentially empty unicode string matching the first argument of the rule is a key into the namespaces map.

PNAME_NS

  

IRI

  

When used in a PrefixedName production, the IRI is the value in the namespaces map corresponding to the first argument of the rule.

PNAME_LN

  

IRI

  

A potentially empty prefix is identified by the first sequence, PNAME_NS. The namespaces map must have a corresponding namespace. The unicode string of the IRI is formed by unescaping the reserved characters in the second argument, PN_LOCAL, and concatenating this onto the namespace.

Finally, [RDF11TTL] section 2.4 IRIs, includes

Prefixed names are a superset of XML QNames. They differ in that the local part of prefixed names may include:

  • leading digits, e.g. leg:3032571 or isbn13:9780136019701

  • non leading colons, e.g. og:video:height

  • reserved character escape sequences, e.g. wgs:lat\-long

15.2 RDF/XML🔗ℹ

The specification RDF 1.1 Syntax [RDF11XML] (commonly referred to as RDF/XML) is constrained by it’s use of XML to use the type NCName (see [XMLNAMES], section 3, Declaring Namespaces) for both prefix and local names. However, the value space of this type is smaller than the names above and the specification’s [RDF11XML], Section 8 – Serializing an RDF Graph to RDF/XML, states:

There are some RDF Graphs as defined in [RDF11CAS] that cannot be serialized in RDF/XML. These are those that:

Use property names that cannot be turned into XML namespace-qualified names.

An XML namespace-qualified name (QName) has restrictions on the legal characters such that not all property URIs can be expressed as these names. It is recommended that implementors of RDF serializers, in order to break a URI into a namespace name and a local name, split it after the last XML non-NCName character, ensuring that the first character of the name is a Letter or ’_’. If the URI ends in a non-NCName character then throw a "this graph cannot be serialized in RDF/XML" exception or error.

Use inappropriate reserved names as properties

For example, a property with the same URI as any of the syntaxTerms production.

Use the rdf:HTML datatype

This datatype as introduced in RDF 1.1 [RDF11CAS].