Hi Christopher,

This problem has now been fixed and will appear in the next release of OWLIM.

I understand that the problem is simply that the statement counters were not being reset after the clear operation.

Thanks for reporting this.

Regards,
barry

Barry Bishop
OWLIM Product Manager
Ontotext AD
Tel: +43 650 2000 237
email: [email protected]
skype: bazbishop
www.ontotext.com


On 15/05/12 17:12, Lott, Christopher M wrote:
I am working with owlim-lite-5.0.5001 accessed as a remote HTTP repository using Sesame 
2.6.5. I noticed that invoking the clear method doesn't seem to clear things out; in fact 
on a new repository, the size *increases* after I call the clear method.  This seems to 
be a consequence of using RDFS reasoning rules, because if I use a repository with 
"empty" rule set, the size behaves the same as an in-memory or MySQL 
repository, namely that clear() returns it to zero.  Would someone please explain?

I've attached a program that demonstrates the behavior.  Also see below for the 
transcript of using the sesame console application to create an empty 
repository on which I ran the program.

---

import org.openrdf.model.Resource;
import org.openrdf.model.URI;
import org.openrdf.model.ValueFactory;
import org.openrdf.model.vocabulary.RDF;
import org.openrdf.repository.Repository;
import org.openrdf.repository.RepositoryConnection;
import org.openrdf.repository.http.HTTPRepository;
import org.openrdf.repository.sail.SailRepository;
import org.openrdf.sail.memory.MemoryStore;
import org.openrdf.sail.rdbms.mysql.MySqlStore;

/**
  * Tests Sesame repository implementation of size method. On an in-memory or a
  * MySQL repository, after calling the clear() method the size() method returns
  * zero. On a remote Owlim repository that uses rule-set "rdfs", after calling
  * clear() the size() method returns a number larger than before the clear().
  *
  * @author clott
  */
public class TestAddRemoveClear {

        /**
         * Arguments control which repository implementation is used. Invoke 
with:
         *<UL>
        *<LI>1 argument: the URI of a remote repository
         *<LI>4 arguments: the host name, database name, user name and password 
for
         * a MySQL repository
         *<LI>Other argument count: ignores arguments, uses an in-memory
         * repository.
         *</UL>
        *
         * @param args
         */
        public static void main(String[] args) {

                try {
                        // Get started
                        Repository repo = null;
                        if (args.length == 4) {
                                System.out.println("Using mysql repository on host 
" + args[0]);
                                MySqlStore sqlStore = new MySqlStore(args[1]);
                                sqlStore.setServerName(args[0]);
                                sqlStore.setPortNumber(3306);
                                sqlStore.setUser(args[2]);
                                sqlStore.setPassword(args[3]);
                                repo = new SailRepository(sqlStore);
                        } else if (args.length == 1) {
                                System.out.println("Using remote repository at 
" + args[0]);
                                repo = new HTTPRepository(args[0]);
                        } else {
                                System.out.println("Creating an in-memory Sail 
repository");
                                repo = new SailRepository(new MemoryStore());
                        }

                        // Init the repo and connect
                        System.out.println("Initializating and connecting");
                        repo.initialize();
                        RepositoryConnection con = repo.getConnection();

                        // Get the initial size
                        Long beforeSize = con.size();
                        System.out.println("Size at start is " + beforeSize);

                        // Create some resources and literals to use in 
statements
                        ValueFactory f = repo.getValueFactory();
                        String namespace = "http://example.org/ontology#";;
                        URI personClassUri = f.createURI(namespace + "Person");

                        // Add the entity
                        System.out.println("Adding entity of type Person");
                        Resource entity = f.createBNode();
                        con.add(entity, RDF.TYPE, personClassUri);

                        // Get the modified size
                        Long modSize = con.size();
                        System.out.println("Size after add is " + modSize);

                        // Remove the newly added statements
                        System.out.println("Removing the newly added entity");
                        con.remove(entity, RDF.TYPE, personClassUri);

                        long afterSize = con.size();
                        System.out.println("Size after remove is " + afterSize);

                        System.out.println("Clearing repo");
                        con.clear();

                        long clearSize = con.size();
                        System.out.println("Size after clear is " + clearSize);

                        // Drop connection and release the lock on the 
repository
                        System.out.println("Closing connection and shutting 
down");
                        con.close();
                        repo.shutDown();
                } catch (Exception ex) {
                        ex.printStackTrace();
                }
        }
}

---

$ openrdf-sesame-2.6.5/bin/console.sh
11:03:59.830 [main] DEBUG info.aduna.platform.PlatformFactory - os.name = linux
11:03:59.834 [main] DEBUG info.aduna.platform.PlatformFactory - Detected Posix 
platform
Connected to default data directory

Commands end with '.' at the end of a line
Type 'help.' for help
connect http://localhost:8080/openrdf-sesame  .
Disconnecting from default data directory
Connected to http://localhost:8080/openrdf-sesame
create owlim-lite .
Please specify values for the following variables:
Repository ID [owlim-lite-test]: lott
Repository title [OWLIM-Lite test repository]: Lott rdfs
Storage folder [storage]:
Rule-set [owl-horst-optimized]: rdfs
Base URL [http://example.org/owlim#]:
Entity index size [200000]:
No Persistence [false]:
Imported RDF files(';' delimited):
Default namespaces for imports(';' delimited):
Repository created
quit .
Disconnecting from http://localhost:8080/openrdf-sesame
Bye

_______________________________________________
Owlim-discussion mailing list
[email protected]
http://ontomail.semdata.org/cgi-bin/mailman/listinfo/owlim-discussion
_______________________________________________
Owlim-discussion mailing list
[email protected]
http://ontomail.semdata.org/cgi-bin/mailman/listinfo/owlim-discussion

Reply via email to