You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Nikolaos Abatzis <Ni...@newriversystems.com> on 2011/03/21 18:51:34 UTC

ARQ/LARQ 2.8.5 - unindexStatement is not support

All:

Looking at the sources for ARQ-2.8.5 I found the following in IndexBuilderModel

    /** Remove index information */
    public void unindexStatement(Statement s)
    { throw new java.lang.UnsupportedOperationException("unindexStatement") ; }

How does one then deletes entries from a Lucene Index, based on Statement removal?

I apologize if I am missing something obvious    :-(



Please do not hesitate to contact me if you need additional information. Thank you.

Regards,

Nikolaos Abatzis
New River Systems Corporation
1890 Preston White Drive, Suite 240
Reston, VA 20191

Re: ARQ/LARQ 2.8.5 - unindexStatement is not support

Posted by Paolo Castagna <ca...@googlemail.com>.
Hi Nikolaos,
LARQ as in ARQ v2.8.5 does not currently support deletion of entries when you
remove Statements from a Model.

We are planning to take LARQ out of ARQ and put it into a separate module.

You can have a preview of it, here:
https://jena.svn.sourceforge.net/svnroot/jena/LARQ/trunk/

That does have implementation for unindexStatement methods, for example:
https://jena.svn.sourceforge.net/svnroot/jena/LARQ/trunk/src/main/java/org/apache/jena/larq/IndexBuilderLiteral.java

     @Override
     public void unindexStatement(Statement s)
     {
         if ( ! indexThisStatement(s) )
             return ;

         if ( s.getObject().isLiteral() )
         {
         	// we use the Model as reference counting
         	StmtIterator iter = s.getModel().listStatements((Resource)null, (Property)null, s.getObject());
         	if ( ! iter.hasNext() ) {
                 Node node = s.getObject().asNode() ;
                 if ( indexThisLiteral(s.getLiteral())) {
                 	index.unindex(node, node.getLiteralLexicalForm()) ;
                 }
         	}
         }
     }

When we need to delete a Lucene document, we need to be sure there are no other
statements with the same literal before deleting the document.

Since, it's not possible to modify fields in a Lucene document, I decided to use
the Jena model as source of reference counting and I delete the Lucene document
if and only if there are no other statements with the same literal.

If you need support for deletetion of entries, I recommend you to give the separate
LARQ module a try.

Let me know if you experience problems with it,
Paolo

Nikolaos Abatzis wrote:
> All:
> 
> Looking at the sources for ARQ-2.8.5 I found the following in IndexBuilderModel
> 
>     /** Remove index information */
>     public void unindexStatement(Statement s)
>     { throw new java.lang.UnsupportedOperationException("unindexStatement") ; }
> 
> How does one then deletes entries from a Lucene Index, based on Statement removal?
> 
> I apologize if I am missing something obvious    :-(
> 
> 
> 
> Please do not hesitate to contact me if you need additional information. Thank you.
> 
> Regards,
> 
> Nikolaos Abatzis
> New River Systems Corporation
> 1890 Preston White Drive, Suite 240
> Reston, VA 20191