> model.getProperty(ns,"GPA"); I think this works for me and store the data > property GPA in the file. > > Actually I do not need this: Model::createProperty(String nameSpace, String > localName) > as I have already created the property in my owl file and just needs > getProperty() method. > > If I use this : OntModel::getDatatypeProperty( String uri ) which property > (data property) will be returned ? Because the argument only contains the > namespace and not the actual property. The argument is the full URI, this is the same as you do to get the OntClass > > I tried this but it gives me error: > > DataProperty property=ontModel::getDatatypeProperty( String uri, "Score ) This is not Java syntax...
OntModel::getDatatypeProperty( String ur) means to use the method on the an OntModel object, but indeed with a dot, not two colons. And as I said, it has only one argument. As Andy Seaborne mentioned, your rule is still with illegal syntax, that's what Dave also mentioned at least twice in previous answers... > > On Wed, Sep 21, 2016 at 1:21 AM, Lorenz B. < > [email protected]> wrote: > >> Are you sure that this code compiles? >> >>> Property prop= model.getProperty(ns,"GPA"); >> ns is a String in your code, the method expects a Resource object is >> first argument. You totally use the wrong method here, as it returns a >> Statement. >> >> Model::createProperty(String nameSpace, String localName) >> >> would be the method to call, or even better as you use an OntModel >> >> OntModel::getDatatypeProperty( String uri ) >> >> >> -- >> Lorenz Bühmann >> AKSW group, University of Leipzig >> Group: http://aksw.org - semantic web research center >> -- Lorenz Bühmann AKSW group, University of Leipzig Group: http://aksw.org - semantic web research center
