Problem with save an infModel

Hi,

Thank you for your answer, it works now. But I have an another problem. It's
about saving the infModel.

If I don't print the statements of a special resource, I can't save the
infModel.
here is the code :

  public static void printStatements() {

        ExtendedIterator i = infmodel.getGraph()
                                     .find(Node.createURI(resourceName),
null,null);
         while (i.hasNext())
            System.out.println(i.next());
     }


And there is often also a problem with Node.createURI(ressourceName), and I
don't know why.

Exception in thread "main" java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(Unknown Source)
at java.util.HashMap$KeyIterator.next(Unknown Source)
at com.hp.hpl.jena.reasoner.rulesys.impl.RETEQueue.fire(RETEQueue.java:100)
at com.hp.hpl.jena.reasoner.rulesys.impl.RETEQueue.fire(RETEQueue.java:119)
at com.hp.hpl.jena.reasoner.rulesys.impl.RETEQueue.fire(RETEQueue.java:119)
at com.hp.hpl.jena.reasoner.rulesys.impl.RETEQueue.fire(RETEQueue.java:119)
at com.hp.hpl.jena.reasoner.rulesys.impl.RETEQueue.fire(RETEQueue.java:119)
at com.hp.hpl.jena.reasoner.rulesys.impl.RETEQueue.fire(RETEQueue.java:119)
at com.hp.hpl.jena.reasoner.rulesys.impl.RETEQueue.fire(RETEQueue.java:119)
at com.hp.hpl.jena.reasoner.rulesys.impl.RETEQueue.fire(RETEQueue.java:119)
at
com.hp.hpl.jena.reasoner.rulesys.impl.RETEClauseFilter.fire(RETEClauseFilter.java:220)
at
com.hp.hpl.jena.reasoner.rulesys.impl.RETEEngine.inject(RETEEngine.java:421)
at
com.hp.hpl.jena.reasoner.rulesys.impl.RETEEngine.runAll(RETEEngine.java:403)
at
com.hp.hpl.jena.reasoner.rulesys.impl.RETEEngine.fastInit(RETEEngine.java:149)
at
com.hp.hpl.jena.reasoner.rulesys.FBRuleInfGraph.prepare(FBRuleInfGraph.java:460)
at
com.hp.hpl.jena.reasoner.rulesys.FBRuleInfGraph.findWithContinuation(FBRuleInfGraph.java:551)
at
com.hp.hpl.jena.reasoner.rulesys.FBRuleInfGraph.graphBaseFind(FBRuleInfGraph.java:583)
at com.hp.hpl.jena.graph.impl.GraphBase.find(GraphBase.java:257)
at com.alblf.cmf.contextRaisonner.builtin.Main.printStatements(Main.java:45)
at
com.alblf.cmf.contextRaisonner.builtin.Main.startReasonerConfigured(Main.java:82)
at com.alblf.cmf.contextRaisonner.builtin.Main.main(Main.java:92)

So if I don't call this method before saving the infModel, it will not be
saved.



2010/8/20 Dave Reynolds <dave.e.reynolds@gmail.com>

> On Thu, 2010-08-19 at 15:09 +0200, Shamir Nazaraly wrote:
> > Hi,
> >
> >
> > I builded the ontology from the software Protégé. I developped a
> > method with Jena API  to delete a value inside the ontology:
> >
> > public void delete(Node measurement, OWLDatatypeProperty property,
> > String value) {
> >
> >         Node propertyNode = Node.createURI(property.getURI());
> >         Node valueNode = Node.createLiteral(value);
> >
> >
> >         infGraph.delete(new
> > Triple(measurement, propertyNode , valueNode ));
> >     }
>
> Operating a mixture of API (e.g. OWLDatatypeProperty) and SPI (Node) is
> a little odd but works.
>
> Any easier way to get the Node corresponding to the API object is:
>
>  property.asNode()
> > This method works correctly..
> > For example there is an instance which has a dataType property
> > "hasValue" and it contains the value "France":
> >
> >
> > http://www.cmf.com/Ontology.owl#PCountryMeasurement
> > @http://www.cmf.com/Ontology.owl#hasValue "France"
> >
> >
> > After executing the method above, the value is correctly deleted.
> >
> >
> > But when I launch Protégé, and I save after rewriting the same value
> > deleting "France" , I execute this same method but this value is still
> > here.
> >
> >
> > Actually, when I change something in the ontology graphically with
> > Protégé, I can't delete it with the method above.
> >
> >
> > I printed the statement to see what is the problem and I saw this
> > statement after rewriting the same value graphically.
> >
> >
> > http://www.cmf.com/Ontology.owl#PCountryMeasurement
> > @http://www.cmf.com/Ontology.owl#hasValue
> > "France"^^http://www.w3.org/2001/XMLSchema#string
> >
> >
> > There is something added to the second statement compared to the first
> > statement: ^^http://www.w3.org/2001/XMLSchema#string
>
> A plain literal and a literal with type xsd:string are different nodes
> in an RDF graph, though they are semantically equivalent. How well that
> equivalence is handled for you automatically depends on the set up, in
> particular whether you are using a database (at least with the old RDB
> they were stored differently in the database).
>
> Protege is choosing to use the typed literal representation instead of
> the plain literal. I would question that choice (you might want
> different language tags on your country names) but that's what is
> happening.
>
> To create a corresponding typed literal at the SPI level use:
>
>  Node.createLiteral("France", null, XSDDatatype.XSDstring)
> Dave
>
>
>

Received on Friday, 20 August 2010 08:49:54 UTC