On 07/05/13 21:47, Michael Trosin wrote:
Okay, that works as it gives me many subClassOf-properties, which is like
it is defined in the ontology. Nevertheless now I am stuck with getting the
actual OntProperty which should be assigned (or the value of the
subClassOf-property).

Using

Property prop = iter.next().getPredicate();
System.out.println(oc.getPropertyValue(prop).toString());

for testing purposes give some cryptic values. E.g.
"-6b6b64bf:13e80b8715e:-7ff4"
This is the result of calling toString() on an anonymous node (also known as a bNode). A bNode is a resource with no URI. You can test for a bNode with the isAnon() method on Resource. The toString() value is simply an internal identifier used inside Jena, and will change each time the ontology is loaded.

Note that you are not getting the property here, but the *value* of the property.

Is there a way to load the OntProperty out of the name?
I don't understand the question, sorry. You already have the property - it's your prop variable. If you want that as an OntProperty, you can do:

OntProperty ontProp = prop.as( OntProperty.class );

However, when you call:

oc.getPropertyValue(prop)

whether you do that with prop or ontProp, you're getting the value of that property of that resource. E.g:

ex:fido foaf:name "Fido Dog" .

prop (or ontProp) is foaf:name, and calling getPropertyValue(prop) on ex:fido will give you the value "Fido Dog".


I'm not quite sure,
but I expected to get anything like "&xsd;string" or the real property-name
like "hasName". Is this wrong?
Yes, see above.

Ian

Reply via email to