0

i'm working with Open Link Virtuoso but I'm having some problems. I have loaded my RDF file by Linked data > Quad Store Upload, and now I want load the some RDF Schema to prevent a wrong insertion. (I want to ensure that any inserted data uses only properties that I've declared.) How I can do this? I've inserted a triple into the graph with:

INSERT { myns:my_property rdf:type rdf:Property }

I want this to ensure that if a user inserts a triple, then the triple must have myns:my_property as the property. I know that the triple was inserted, because if I run this query, I get these results:

SELECT ?s WHERE { ?s rdf:type rdf:Property }
myns:my_property

Yet, when I try a forbidden insertion, such as the following, it is allowed. There is no error, and the data is inserted.

INSERT { <my_subject> myns:other_poperty "object" }
Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
mauro
  • 21
  • 2
  • "I want load the rdf Schema to prevent a wrong insertion. How I can do it?" What sort of "wrong insertion" do you want to prevent? Just because you have `myns:my_property rdf:type rdf:Property` doesn't mean you can't use `myns:my_property` as a subject or object. In fact, it's a subject in that triple. I'm not all that familiar with Virtuoso, but I expect that you're not going to get the kind of "input validation" that it sounds like you want. Can you provide more details, so that we can decide one way or the other? – Joshua Taylor Jun 12 '14 at 12:08
  • "I've tried to insert the rule by SPARQL int his way: INSERT {myns:my_property rdf:type rdf:Property} but it seems not works" What do you mean that it seems not to work? That's not a legal SPARQL update, for one thing. You can check using SPARQL.org's update validator. For a constant triple like that, you'd need to `insert data { … }`. This is clearly explained in [3.1.1. INSERT DATA](http://www.w3.org/TR/2013/REC-sparql11-update-20130321/#insertData), after all. But you didn't say whether you got a parse error, or no error but didn't see results, etc. – Joshua Taylor Jun 12 '14 at 12:10
  • 1
    All in all, please note that "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve)." – Joshua Taylor Jun 12 '14 at 12:11
  • I've not included the error because there isn't an error. the syntax is correct, infact the result is that I've the new triple rdf in the graph. What I want Is that if I try to insert a triple different from the rule inserted (in my case, if I try to use a property different from myns:my_property), Virtuoso forbide me to do it. Sorry if the question is not so clear, I'll try to improve it. – mauro Jun 12 '14 at 12:36
  • Virtuoso may accept it, but it's not a legal SPARQL 1.1 Update. See the results from sparql.org's validator: http://imgur.com/PSd6FaE. But it sounds like Virtuoso is accepting it anyway and inserting your triple. So, "if I try to insert a triple different from the rule inserted (in my case, if I try to use a property different from myns:my_property), Virtuoso forbide me to do it." The triple `x a rdf:Property` isn't a rule, though, it's just a triple. RDF is sort of "open ended", you don't have a predefined set of properties that you can use. You can use any URI as a property. – Joshua Taylor Jun 12 '14 at 12:43
  • The behavior is exactly as it should be. Your first insertion isn't a restriction at all. [Joshua](http://stackoverflow.com/users/1281433/joshua-taylor) has given you some pointers to useful information about this. I suggest you read up some more on the general space, and try asking questions about how to achieve your overall goal, rather than how to deal with a specific hurdle you see, which may not really be there at all. – TallTed Jul 03 '14 at 02:54

0 Answers0