<http://alph.io/interfaces/link>
Ver.PA5
Sending an HTTP GET request to an Alph server resource with a query string beginning with "link" returns a JSON-LD response document with a @graph property containing links to/from the queried resource. The contents of the graph will be different depending on what, if anything follows "link" in the query string.
STATUS OF THIS DOCUMENT
This is very much in the "note to self" phase right now, not a well-defined specification!
SPECIFIC LINK QUERIES
?link
Passing the query string "link" by itself will generate a response document containing all known links to/from the resource.
?link=scan(url)
Adding a scan() parameter to the query string will ask the resource's server to fetch and scan the resource at the passed URL and record any links that it finds to itself, or transclusions of its media. The response graph will contain the links that were discovered, if any.
?link=transcludes(selector, partials)
The transcludes() parameter will return links that transclude the fragment addressed by the selector; if 'partials' is the string "true", include partial matches.
If the resource being queried is plain-text, an image, or an audiovisual stream, 'selector' must be a Simple Selector <http://alph.io/selectors>
If the resource being queried is an HTML document, 'selector' may be either an Alph-flavored XPointer <http://alph.io/selectors/xpointer>, or a bare name selector (i.e.: "#section_1").
?link=relation(rel [,rel ,...])
Queries with the relation() parameter will return links with the passed relation(s). Globbing/wildcarding is allowed in relation names.
?link=from(source)
The from() parameter will cause the resource to return a graph with links from documents originating at the passed source. Globbing also works on these. The source can be a specific document (http://site/path/document.html), or a fully-qualified domain (https://some.site/*), or a TLD (http://*.com/*), and so-on.
COMBINING AND NEGATING LINK QUERIES
More than one parameter can be passed in a single query string, separated by the strings "_OR_", "_NOT_", or "_AND_". Query parameters are successively filtered from left-to-right, using the boolean operation indicated by the combining string. For example:
?link=relation(*ism,*ian)_OR_from(*.us/*)
This will return all links having a relation that ends in the strings "ism" or "ian" and, additionally, all links to documents that are hosted on a .us TLD.
?link=relation(comment*)_NOT_from(*.com/*)
This will return links having a relation starting with "comment" that do not come from a .com domain.
Queries should always be sent percent-encoded.
The scan() query parameter cannot be combined with the others.
...