w3c / N3

W3C's Notation 3 (N3) Community Group
48 stars 18 forks source link

Language-integrated Dereferencing of URIs #111

Open AdamSobieski opened 1 year ago

AdamSobieski commented 1 year ago

Hello. In addition to uses of the URI query string mapping syntax as a potential means of invoking language-integrated semantic templates, the mapping could also be utilized to form general-purpose URIs, including those URIs which are also utilized as URLs.

Let us consider a computer lexicon scenario involving verbs and sets of thematic relations:

@prefix vn : <https://www.verbnet.org/index.php#> .
@prefix ex : <http://example.org/#> .

vn:frame??(("verb" ex:ate) ("agent" ex:bob) ("patient" ex:cheese)) rdf:type   vn:VerbNetFrame ;
                                                                   vn:verb    ex:ate ;
                                                                   vn:agent   ex:bob ;
                                                                   vn:patient ex:cheese . 

where the subject of that example's graph's triples maps with a URI: https://www.verbnet.org/index.php?verb=http%3A%2F%2Fexample.org%2F%23ate&agent=http%3A%2F%2Fexample.org%2F%23bob&patient=http%3A%2F%2Fexample.org%2F%23cheese#frame.

This URI could also be utilized as a URL which, perhaps, provides a resource in a Semantic Web format.

Utilizing another syntactic possibility, prefixing URI nodes with a $ to indicate that arguments are to be processed into the resultant URI:

@prefix vn : <https://www.verbnet.org/index.php#> .
@prefix ex : <http://example.org/#> .

$<https://www.verbnet.org/index.php?verb={ex:ate}&agent={ex:bob}&patient={ex:cheese}#frame>
    rdf:type   vn:VerbNetFrame ;
    vn:verb    ex:ate ;
    vn:agent   ex:bob ;
    vn:patient ex:cheese . 

Regardless of syntax, we can consider an N3 language feature for fetching or retrieving language-integrated named graphs from URLs. That is, there could be a language-integrated feature, which perhaps resembles invoking a special template, for fetching or retrieving Semantic Web content from URLs and then using the resultant content as first-class named graphs in the language.

In a context with variables, ?x, ?y, and ?z, e.g., a semantic template, these syntactic options resemble:

special:fetch??( vn:frame??(("verb" ?x) ("agent" ?y) ("patient" ?z)) ) .
special:fetch??($<https://www.verbnet.org/index.php?verb={?x}&agent={?y}&patient={?z}#frame>) .

Also possible is a new keyword, @fetch or @dereference.

@dereference vn:frame??(("verb" ?x) ("agent" ?y) ("patient" ?z)) .
@dereference $"https://www.verbnet.org/index.php?verb={?x}&agent={?y}&patient={?z}#frame" .
@dereference $<https://www.verbnet.org/index.php?verb={?x}&agent={?y}&patient={?z}#frame> .

Any thoughts on this N3 language feature, dereferencing URIs/URLs, including as compatible with first-class named graphs, and as potentially compatible with a language-integrated semantic templates, and potentially syntactic sugar for enumeration? Thank you.


See also: https://github.com/w3c-cg/planning/discussions/27#discussioncomment-4414879