Section 6.4 Origin of the HTML 5 draft defines the origin of scripts, documents etc.:
@keywords is, of, a.
@prefix : <scriptorigin#>.
@prefix s: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#>.
origin s:label "origin";
a owl:DatatypeProperty;
s:isDefinedBy <http://dev.w3.org/html5/spec/browsers.html#origin-0>;
s:comment """origin of a resource, document, script, etc.""";
s:comment """for example { doc1 origin "example.org". }""".
In particular, it says:
If a Document or image was served over the network and has an address that uses a URL scheme with a server-based naming authority,
The origin is the origin of the address of the Document or the URL of the image, as appropriate.
That seems to license the following rule:
@prefix ht: <http://www.w3.org/2006/http#>.
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix str: <http://www.w3.org/2000/10/swap/string#>.
@prefix list: <http://www.w3.org/2000/10/swap/list#>.
{
?RES log:uri ?I.
(?I "http://([^/]+)/") str:search (?ORIGIN).
?CONNECTION ht:connectionAuthority ?ORIGIN;
ht:requests [list:member ?Q].
?Q ht:absoluteURI ?I; ht:methodName "GET".
} => { ?RES origin ?ORIGIN }.
Note
Given our view that HTTP URIs (that respond to GETs with 200) denote social principals, is it too much of a stretch to read "has an address" as log:uri? i.e. the relationship between a URI and what it identifies?
To represent the judgement that a script object may contact an origin, we introduce:
contactsOrigin s:label "contacts origin";
a owl:DatatypeProperty;
s:isDefinedBy <http://dev.w3.org/html5/spec/browsers.html#origin-0>;
s:comment """relates a script object to
an origin that it is authorized to contact""".
We can then state the same origin policy as:
@prefix c: <speech#>.
{ ?P origin ?ORIGIN }
=> { ?P c:controls_subject ( contactsOrigin ?ORIGIN) }.