0

I am writing a DL query parser in Java. I need to use the method getObjectPropertyValues(). how to convert a string to OWL Object Property expression in Java , please give me a sample code.

Stanislav Kralin
  • 11,070
  • 4
  • 35
  • 58
  • What API are you using? The two common ones (that I'm aware of) are Jena and the OWL-API. (I notice that you didn't specify this in [your earlier question](http://stackoverflow.com/q/19228798/1281433), either, but it's really needed there, too.) – Joshua Taylor Oct 15 '13 at 19:17
  • Based on the method name `getObjectPropertyValues`, I expect that you're trying to use the OWL-API. There are (at least) two methods with that name, though: `OWLReasoner.getObjectPropertyValues`, and `OWLIndividual.getObjectPropertyValues`. Neither takes zero arguments, though. – Joshua Taylor Oct 15 '13 at 19:21
  • you can also look at this example https://github.com/owlcs/owlapi/blob/master/contract/src/test/java/org/coode/owlapi/examples/DLQueryExample.java – loopasam Oct 15 '13 at 20:57
  • Did you end up getting this resolved? If you did, and one of the answers worked for you, you should [accept it](http://meta.stackexchange.com/q/5234/225437), or if they didn't, you should write up what ended up working for you, and should accept it (it's not a bad thing at all to accept your own answer). If you haven't found a solution yet, can you elaborate on the problem? Perhaps more information will help in finding an answer to it. – Joshua Taylor Oct 20 '13 at 20:36

2 Answers2

1

You create an OWLObjectProperty using the aptly named OWLDataFactory.getOWLObjectProperty(IRI iri), and IRI has a constructor IRI(String). E.g., from the examples in the documentation:

OWLObjectProperty prop
  = factory.getOWLObjectProperty(IRI.create(ontologyIRI + "#propA"));
Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
1

If you are using the OWLAPI you can reuse the code from here for parsing a DL query: https://github.com/owlcs/owlapi/wiki/DL-Queries-with-a-real-reasoner

mikrohelen
  • 249
  • 1
  • 3