1

I have some object restrictions like

hasVendor some Vendor
hasYear some integer[minLength 2, maxLength 4, >=1995, <=2012]
hasPrice only string[pattern "/^[0-9]+(\.[0-9]{2})?$/"]

where Vendor is a Class. I followed the instructions from this link : https://stackoverflow.com/a/7805455/1138148 to read the restrictions. I need to get the constraint values from each of these restrictions using Jena. I was able to get 'Vendor' as the constraint in the first case, but for 2nd and 3rd I am getting some garbage like values like :

7cbf42c2:137784f42b4:-7d1f and 7cbf42c2:137784f42b4:-7d29 resp. What are these values? How can I retrieve the pattern as such and the values minLength, 1995 etc.

Community
  • 1
  • 1
Vijith
  • 77
  • 1
  • 10

1 Answers1

1

Those are the bnode identifiers for the intermediate nodes in those restrictions. There's a lot more 'stuff' in the resulting data than is shown when it's serialized in Manchester syntax. You'll want to check out the OWL to RDF mappings document at the w3c to learn more about how that happens.

I don't suggest doing the validation yourself. If you're going to represent this stuff in OWL, you can use a reasoner to tell you when something has violated a restriction. That will work for the most part, but there are some pitfalls around open-world vs closed-world that you'll need to be aware of to really make this work. You can also look at something like Integrity Constraint Validation as offered by Pellet which lets you write constraints in OWL and applies closed-world semantics to them which gives a more natural (especially if you're coming from an RDBMS world) way of working with them.

But if you must handle the restrictions by hand, you're going to need to delve a little further into the underlying RDF structure of the restrictions to get the bits you're looking for, or use an API that's actually designed for working with OWL, such as OWLAPI.

Michael
  • 4,858
  • 19
  • 32
  • Thanks. I am new to OWL and Jena. So If I have a set of tokens, how can I apply my reasoner to it and check if each token violates the restriction or not. Please give a code example. – Vijith May 24 '12 at 04:50
  • 1
    I don't have the slightest idea what you mean by token. If you put an ontology into a reasoner along with your data, the reasoner will tell you if, among other things, the data is consistent w.r.t to the ontology. That is, whether or not one of your restrictions or other axioms was violated. I strongly recommend you read the OWL primer and something about what open-world reasoning means so you have a better understanding of how this stuff works. – Michael May 24 '12 at 11:20