-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to represent logic expressions in RDF #2
Comments
One feature of a good solution here, I think, is that removing triples from the representation of the ruleset shouldn't give you additional entailments. So this representation would be bad:
because if we delete the { :r1 :if [ [:d :e :f] } triple, the rule fires more easily, and suddenly { a b c } entails {g h i}. That's why I use lists of triples in all the options above, instead of just a repeated property. The motivation here is about logical monotonicity, but I'm not sure I have a rock solid case that we need to do it with N3 |
I am not entirely sure whether I agree with this issue here (but I can be convinced, maybe I simply don't see the whole picture?). I see a general problem with representing N3 in pure RDF because the RDF constructs already have fixed meanings and we cannot "hijack" them for other purposes. Take rdf reification as an example: Suppose we have the N3 construct: which we "translate" as: I just want to illustrate here that sometimes it makes sense to also extend the syntax if you extend the semantics. Especially in a case like ours, where the logic is meant as an extension of RDF and the already existing constructs should have the same meaning in both logics. |
Putting my concerns from above aside, some comments on the above:
|
Absolutely. That's how it's usually done, as I understand it. It's just that RDF is flexible enough that we have another option here, if we want to take it. So one answer to this issue, "How to represent logic expressions in RDF" is "Let's not bother. Too difficult, not worthwhile."
I don't understand this. Can you give an example of how this issue might manifest?
Yeah, I don't think that's a big problem. Similarly, when you write a graph down with { ... } notation, you still have to write the triples in order; we just define that order as not significant. |
Sorry, that I answer that late. I spent some time thinking about the issue I raised and was not able to come up with a good example here and I think that the discussion should be based on examples (so I keep searching). A problem with all the representations proposed is that they don't keep the scoping of blank nodes. In
The blank node is scoped inside the graph. The formulas translates to something like: But if you have a representation like for example with reification, you would have:
which would then mean: "There exists something of which Wikipedia denies that Melville wrote it". So, if we want to come to one of the representations you propose here, we should either change the scoping of blank nodes in N3 or also have a good mechanism to express explicit quantification in RDF so that we can use this mechanism instead in my example. |
I touch on my idea for doing this on page 5 of my Data Workshop Presentation. Basically, I propose creating a new resource type for Universally Quantified Variables ( {
"@context": {
"@version": 1.1,
"@base": "http://example.com/",
"@vocab": "http://example.com/",
"=>": {"@id": "http://www.w3.org/2000/10/swap/log#implies", "@container": "@graph"},
"?x": {"@univar": true},
"?y": {"@univar": true}
},
"@graph": [
{"@id": "Julie", "parent": {"@id": "Suzie"}},
{
"@graph": {"@id": "?x", "parent": "?y"},
"=>": {"@id": "?y", "child": "?x"}
}
]
} In TriG, this might look like the following: @prefix log: <http://www.w3.org/2000/10/swap/log#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://example.com/Julie> <http://example.com/parent> <http://example.com/Suzie> .
_:b0 log:implies _:b1 .
_:b0 { <http://example.com/?x> <http://example.com/parent> "?y" .}
_:b1 {<http://example.com/?y> <http://example.com/child> "?x" .} Note that this requires RDF be updated so that the blank nodes used in the implication can denote the graphs they label, which is not strictly allowed in RDF 1.1, but seems to be an emerging practice, thanks largely to the way they're serialized in JSON-LD. |
(paste from public-n3-dev list) I wanted to point out that though this is true if you only consider the
part, it is quite possible to have ’says’ govern the interpretation. We can give a
So we can get back the original bag of statements, blank nodes are not a More generally we can choose the semantics by choosing what rules to I think we do need a syntax extension of some kind to talk about graphs I also really like the LISP proposal. It is easy to see in the rule that I give (added here, not on the mailing list) Another consequence of choosing which rules to apply is that we need to be |
@wwaites I agree that reification is not really a problem for our rules. The problem I was referring to was, if I remember correctly, that rdf reification is not really a good way to express N3 graphs in RDF given that there is RDF semantics. @gkellogg I think your representation using TriG looks good, but the problem you mention is a very big one: TriG has no semantics and we therefore do not know whether the I hope you are right that there is a common preference for the interpretation of named graphs, but I do not really see it (yet?). Now that I am on it, one additional question: why are ?x and ?y represented in different ways? |
As was brought up on my Data Workshop slides, the notion that Regarding using reification for representing the meaning of a quoted graph, it becomes an issue when that graph has more than one statement; the team submission uses a list of statements, but that has it's own issues. That said, I think the notion that when a blank node is used to name a graph and also used as the subject or object of other statements, that those statements are generally understood to be about the graph (at least the graph specifically named by the blank node, if not another equivalent graph named otherwise).
{
"@context": {
"@base": "http://example.com/",
"@vocab": "http://example.com/",
"=>": {
"@id": "http://www.w3.org/2000/10/swap/log#implies",
"@container": "@graph"
},
"?x": {"@univar": true},
"?y": {"@univar": true}
},
"@graph": [
{"@id": "Julie", "parent": {"@id": "Suzie"}},
{
"@graph": {"@id": "?x", "parent": "?y"},
"=>": {"@id": "?y", "child": "?x"}
}
]
} They are represented the same, in the antecedent, the subject is |
@sandhawke we were discussing this issue shortly during today's Skype meeting. I suppose there are two ways of looking at this:
Any thoughts? |
I don't think I have much to add to the intro to this issue. There is this RDF* effort going on now that might help with the named-graph problems, but I'm not following it closely. Personally, I'm using a non-RDF syntax these days to solve these problems. |
In case anyone wants to expand on this issue, feel free to open it again - for now it will be closed since there does not seem interest in continuing down this path. Also, note that consideration of RDF* has been turned into a separate issue #27 |
N3 doesn't necessarily have to be able to fit into RDF, but it seems like a nice feature, and the original implementation in cwm did it.
This is related to #1, which is about trying to use RDF Datasets for this. This issue is more like aside from Datasets, how could we do it?
We could separate this into:
... but for now, let's keep them together.
Here are some options:
Lists Everywhere. This was shown in Aligning with semantics of RDF Datasets #1. A graph is a list of triples, a triple is a list of subject, predicate, object. Like this:
and
List of RDF Statements. Here, instead of representing triples as an (s p o) list, we use the somewhat archaic RDF Reification Vocabulary.
RIF-in-RDF. We could use RIF in RDF. I'm not aware of any implementations except one I did while writing the spec, and I don't know of anyone using it.
The text was updated successfully, but these errors were encountered: