简体   繁体   English

在RDF中使用的URI中是否允许“查询字符串”?

[英]Is a “query string” allowed in a URI used in 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 ... " “资源描述框架(RDF):概念和抽象语法”文档第6.4节规定“RDF图中的URI引用(RDF URI引用)...将产生有效的URI字符序列(根据RFC2396,第2.1节) 表示带有可选片段标识符的绝对URI ...“

RFC 2396 , Section 2.1 only talks about the encoding of the individual characters. RFC 2396第2.1节仅讨论了各个字符的编码。 It does not speak to what sections of a standard URI are allowed within RDF. 它没有说明RDF中允许的标准URI的哪些部分。

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. 在我看到的一些RDF文档中,术语“绝对URI”似乎只是指URI的domain.tld / path / name#optionalFragment形式,但没有提到查询字符串是什么(?key1 = value1&key2 = value2)允许或禁止(有时称为CGI数据)。 Other RDF documentation only uses the term "absolute URI" in contrast to a relative URI (/just/a/path). 与相对URI(/ just / a / path)相比,其他RDF文档仅使用术语“绝对URI”。

Searching for "RDF URI query string" is rife with false hits on things like SPARQL. 搜索“RDF URI查询字符串”充斥着SPARQL之类的错误命中。

So, my question is: Is a standard HTML query string allowed in a URI used in RDF or RDFa? 所以,我的问题是:在RDF或RDFa中使用的URI中是否允许使用标准HTML查询字符串?

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. 我知道URI不是URL,不一定用于从服务器检索网页。 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. 但是,RDF处理器读取这些URI,我认为他们可以通过这些“查询”字符串传递的附加元数据的形式获得一些帮助。

[Update 2/9/2012] Here is the point of my question: I am looking for a way to indicate the "strength" of a connection. [2012年2月9日更新]以下是我的问题:我正在寻找一种方法来表明连接的“强度”。 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. 但是,如果我能够编写foaf:knows?strength = + 50,那么不知道如何处理强度密钥的处理器可以忽略它,而那些“强度感知”的处理器将具有有价值的附加元数据。 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). 我可以创建一个包含术语“agreesWith”的词汇表,然后允许strength = key值的范围从0到100(表示协议的百分比)。 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. {注意:我曾考虑允许范围从-100到+100以涵盖一系列分歧。 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."} 但是,为了向后兼容,我们需要一个术语“disagreeWith”,这样不是“强度感知”的处理器仍然会知道“agreeWith”和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." 就目前而言,似乎RDF推理者无法知道“几乎不能满足”和“比他了解自己更了解他”之间的区别。 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. 将键值对中具有不同值的每个不同谓词URI视为完全独立且完全不相关的谓词的决定似乎抛弃了几乎所有关于连接的最有价值的信息,所有这些都是为了简单起见代码编写和快速处理。

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. 除了创建完全独立的主题,谓词或对象之外,查询字符串中的键值对可能还有其他有价值的用途:它们可用于指示是谁将特定实体添加到联合编辑的.RDF文件中。 As it stands, all an RDF reasoner knows is that a triple exists, out there, somewhere? 就目前而言,所有RDF推理者都知道,在某个地方存在三重存在? 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. 加密密码可用于验证源的可靠性,而不是简单地决定信任或不信任整个域。

Yes. 是。

(What, you want more?) (什么,你想要更多?)

RDF refers to things using what are colloquially called 'URLs'. RDF指的是使用俗称“URL”的东西。 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). 如果你想更准确,IRI(本质上是一种在URL中包含多于ascii的方法,这就是你可以在浏览器栏中使用异国字符的原因)。 The most accurate answer is too tedious to relate, so assume IRIs. 最准确的答案太难以联系,所以假设IRI。

RDF uses absolute references. RDF使用绝对引用。 Its syntaxes may use relative references (eg foo/bar ) but they are resolved relative to the document base to become absolute. 它的语法可能使用相对引用(例如foo/bar ),但它们相对于文档库被解析为绝对。 Exactly like html links, in fact. 事实上,正好像html链接一样。

Beyond the syntax, RDF is not concerned with the internals of these references. 除了语法之外,RDF并不关心这些引用的内部。 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. 特别是RDF并不认为查询部分是特殊的。

To confirm the answer above, yes. 要确认上面的答案,是的。

URI's are purely syntactic so the rules listed above apply. URI是纯粹的语法,因此上面列出的规则适用。

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. 使用片段的URI不可解除引用,当代理尝试取消引用时,它会通过删除片段将其解析为另一个URI(即URL)。

Finally, it is recommended that you use IRI's (Internationalised Resource Identifiers) in place of URI's where possible 最后,建议您尽可能使用IRI(国际化资源标识符)代替URI

http://www.ietf.org/rfc/rfc3987.txt http://www.ietf.org/rfc/rfc3987.txt

This specificies different syntatic constraints and restrictions. 这具体说明了不同的合成约束和限制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM