Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is a "query string" allowed in a URI used in RDF?

Tags:

uri

rdf

The "Resource Description Framework (RDF): Concepts and Abstract Syntax" document Section 6.4 states that "A URI reference within an RDF graph (an RDF URI reference) ... would produce a valid URI character sequence (per RFC2396, sections 2.1) representing an absolute URI with optional fragment identifier ... "

RFC 2396, Section 2.1 only talks about the encoding of the individual characters. It does not speak to what sections of a standard URI are allowed within RDF.

In some RDF documents I have seen, the term "absolute URI" seems to refer to just the domain.tld/path/name#optionalFragment form of a URI but with no mention of whether a query string (?key1=value1&key2=value2) (sometimes known as the CGI data) is allowed or disallowed. Other RDF documentation only uses the term "absolute URI" in contrast to a relative URI (/just/a/path).

Searching for "RDF URI query string" is rife with false hits on things like SPARQL.

So, my question is: Is a standard HTML query string allowed in a URI used in RDF or RDFa?

If not, why not? I understand that a URI is not a URL and will not necessarily be used to retrieve a web page from a server. However, RDF processors read those URIs and I'm thinking they could stand to have some help in the form of the additional metadata that could be passed along via these "query" strings.

[Update 2/9/2012] Here is the point of my question: I am looking for a way to indicate the "strength" of a connection. For instance, not everyone foaf:knows everyone equally well. We may have just met for a few minutes at a conference. Or I may have lived with someone for years. It's all the same to FAOF. However, if I was able to write foaf:knows?strength=+50 then processors which don't know what to do with the strength key could ignore it while those that are "strength aware" would have valuable additional metadata. I could create a vocabulary which includes the term "agreesWith" then allow the strength= key value to range from 0 to 100 (indicating percentages of agreement). Then I would cover the entire range of agreement with one vocabulary term. {Note: I had thought about allowing the range to go from -100 to +100 to cover a range of disagreement. However, for backward compatibility we would need a term "disagreeWith" so that processors which are not "strength aware" would still know the difference between "agreeWith" and disagreeWith."}

As it stands now, it seems that there is no way for an RDF reasoner to know the difference between "barely met" and "knows him better than he knows himself." The decision to treat each and every different predicate URI with a different value in a key-value pair as an utterly separate and completely unrelated predicate seems to be throwing out almost all of the most valuable information about a connection, all for the sake of easy code writing and fast processing.

There could be other valuable uses for key-value pairs in a query string other than creating an entirely separate subject, predicate, or object: They could be used to indicate who added a particular entity to a jointly edited .RDF file. As it stands, all an RDF reasoner knows is that a triple exists, out there, somewhere? It has not additional information on which to base it's reasoning. Encrypted passphrases could be used to validate the reliability of a source rather than simply deciding to trust or not trust an entire domain.

like image 200
GrantRobertson Avatar asked Feb 07 '12 05:02

GrantRobertson


People also ask

Does URI include query string?

There is no protocol information given in URI. It contains components such as protocol, domain, path, hash, query string, etc. It contains components like scheme, authority, path, query, fragment component, etc. Not all URIs are URLs since a URI can be a name instead of a locator.

What's a query in an URI?

The Query property contains any query information included in the URI. Query information is separated from the path information by a question mark (?) and continues to the end of the URI. The query information returned includes the leading question mark.


1 Answers

Yes.

(What, you want more?)

RDF refers to things using what are colloquially called 'URLs'. If you want to be more accurate, IRIs (essentially a way to include more than ascii in URLs, which is why you can use exotic characters in your browser bar). The most accurate answer is too tedious to relate, so assume IRIs.

RDF uses absolute references. Its syntaxes may use relative references (e.g. foo/bar) but they are resolved relative to the document base to become absolute. Exactly like html links, in fact.

Beyond the syntax, RDF is not concerned with the internals of these references. You just compare them character by character. As a consequence:

  • http://example.com/foo/bar == http://example.com/foo/bar
  • http://example.com/foo/bar?query=x == http://example.com/foo/bar?query=x
  • http://example.com/foo/bar != http://example.com/foo/bar?query=x
  • http://example.com/foo/bar#x == http://example.com/foo/bar#x
  • http://example.com/foo/bar != http://example.com/foo/bar#x
  • http://example.com/%66oo/bar != http://example.com/foo/bar

Note that you don't even get normalisation.

And in particular RDF doesn't see the query part as anything special.

like image 150
user205512 Avatar answered Oct 22 '22 09:10

user205512