是“查询字符串”吗?允许在 RDF 中使用的 URI 中使用吗?
“资源描述框架 (RDF):概念和抽象语法”文档 部分6.4 指出“RDF 图中的 URI 引用(RDF URI 引用)...将生成有效的 URI 字符序列(根据 RFC2396,第 2.1 节)表示带有可选片段标识符的绝对 URI ... "
RFC 2396,第 2.1 节只讨论单个字符的编码。它没有说明 RDF 中允许标准 URI 的哪些部分。
在我见过的一些 RDF 文档中,术语“绝对 URI”似乎仅指 URI 的 domain.tld/path/name#optionalFragment 形式,但没有提及查询字符串 (?key1=value1&key2= value2)(有时称为 CGI 数据)是允许或不允许的。其他 RDF 文档仅使用术语“绝对 URI”,而不是相对 URI (/just/a/path)。
搜索“RDF URI 查询字符串”时,对 SPARQL 等内容的错误命中率很高。
所以,我的问题是:RDF 或 RDFa 中使用的 URI 中是否允许使用标准 HTML 查询字符串?
如果没有,为什么不呢?据我了解,URI 不是 URL,不一定用于从服务器检索网页。然而,RDF 处理器读取这些 URI,我认为它们可以通过这些“查询”字符串传递的附加元数据的形式获得一些帮助。
[更新2/9/2012] 这是我的问题的要点:我正在寻找一种方法来指示连接的“强度”。例如,并不是每个人都对每个人都同样了解。我们可能刚刚在一次会议上见过几分钟。或者我可能已经和某人住了很多年了。对于FAOF 来说都是一样的。但是,如果我能够编写 foaf:knows?strength=+50 ,那么不知道如何处理强度密钥的处理器可能会忽略它,而那些“强度感知”的处理器将拥有有价值的附加元数据。我可以创建一个包含术语“agreesWith”的词汇表,然后允许strength=键值的范围从0到100(表示同意的百分比)。然后我会用一个词汇术语涵盖整个协议范围。 {注:我曾考虑过允许范围从 -100 到 +100 以涵盖一系列分歧。然而,为了向后兼容,我们需要一个术语“disagreeWith”,以便不“强度感知”的处理器仍然知道“agreeWith”和disagreeWith之间的区别。”}
就目前情况而言,似乎没有办法RDF 推理器知道“几乎没有见过”和“比他更了解他自己”之间的区别。决定将键值对中具有不同值的每个不同谓词 URI 视为完全独立的且完全不同的。不相关的谓词似乎丢弃了几乎所有有关连接的最有价值的信息,所有这些都是为了轻松编写代码和快速处理,
除了创建完整的查询字符串之外,查询字符串中的键值对还可能有其他有价值的用途。单独的主语、谓语或宾语:它们可用于指示谁将特定实体添加到共同编辑的 .RDF 文件中。就目前而言,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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的。
(什么,你想要更多吗?)
RDF 指的是使用通俗称为“URL”的东西。如果您想更准确,IRI(本质上是一种在 URL 中包含 ASCII 以外的内容的方法,这就是您可以在浏览器栏中使用外来字符的原因)。最准确的答案太乏味而无法关联,因此假设 IRI。
RDF 使用绝对引用。它的语法可以使用相对引用(例如
foo/bar
),但它们相对于文档库解析为绝对引用。事实上,就像 html 链接一样。除了语法之外,RDF 并不关心这些引用的内部结构。你只需将它们逐个比较即可。结果是:
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
请注意,您甚至没有得到标准化。
特别是,RDF 并不认为查询部分有什么特殊之处。
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.
为了确认上面的答案,是的。
URI 纯粹是语法性的,因此上面列出的规则适用。
使用片段的 URI 不可取消引用,当代理尝试取消引用片段时,它会通过删除片段将其解析为另一个 URI(即 URL)。
最后,建议您尽可能使用 IRI(国际化资源标识符)代替 URI
http:// /www.ietf.org/rfc/rfc3987.txt
这指定了不同的语法约束和限制。
To confirm the answer above, yes.
URI's are purely syntactic so the rules listed above apply.
URI's using a fragment are not dereferenceable and when an agent attempts to dereference one, it resolves it to another URI (which is a URL) by removing the fragment.
Finally, it is recommended that you use IRI's (Internationalised Resource Identifiers) in place of URI's where possible
http://www.ietf.org/rfc/rfc3987.txt
This specificies different syntatic constraints and restrictions.