|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.activemath.omdocjdom.lucene.OmdocLuceneMBaseRef
public class OmdocLuceneMBaseRef
This class implements MBaseRef interface. It uses lucene database at back-end.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.activemath.abstractcontent.MBaseRef |
|---|
MBaseRef.Dependency, MBaseRef.Relation |
| Field Summary | |
|---|---|
ReadWriteLock |
lock
|
| Constructor Summary | |
|---|---|
OmdocLuceneMBaseRef(Subconfiguration config)
Complete constructor from the properties which are properties to override makeDefaultProps(). |
|
| Method Summary | |
|---|---|
void |
assertItsUp()
Asserts that the database connection is up and running. |
void |
create()
Does the same as reload(List,String) except with no error-accumulator. |
String |
deleteTerm(String id)
|
Collection |
generateImportIDs(String col,
String fileName)
|
String |
generateImports(String col,
String fileName)
This method makes omdoc documents compatible with the databse It resolve all references and add necessary imports statements |
AMIndex |
getAMIndex()
|
String |
getAttribute(MBaseID id,
String attName)
Returns the attribute value of the attribute of given name of the element with given ID. |
MBaseID |
getCanonicalID(MBaseID givenID)
Returns a fully-qualified unique ID that enables collections of IDs to behave properly. |
OJElement |
getChildren(MBaseID id,
String xPathReducedExpression)
Returns the content of the named descendant of the element of given ID. |
String |
getChildrenString(MBaseID id,
String xPathReducedExpression)
This method returns children as text. |
Collection |
getCollectionsProvided()
returns a Collection (object) with the collections (content blocks) provided by this MBaseRef |
Map |
getCommonName(MBaseID id)
Returns the names of this element which is fetched either from the <metadata><dc:Title>
descendant or from the <commonname> elements. |
OJElement |
getCompleteDCMetadata(MBaseID id)
Returns a metadata element with only Dublin-Core children including inherited
ones from their parents. |
String |
getCompleteDCMetadataString(MBaseID id)
This method returns dc metadata as string. |
Iterator |
getDefinitions(MBaseID id,
Collection collections)
For a symbol, this method returns the IDs of all definitions. |
Iterator |
getDependencies(MBaseID id)
Gets an Iterator of MBaseRef.Dependency relations with all relations that stem from this
element. |
org.apache.lucene.document.Document |
getDocument(MBaseID id)
|
OJElement |
getFormalContent(MBaseID id)
From any ID this method returns the content of the FMP element. |
String |
getFormalContentString(MBaseID id)
This method returns FMP string |
MBaseID[] |
getForWhat(MBaseID id)
Returns the ID contained in the attribute for |
Iterator |
getIncomingRelations(MBaseID id,
Collection collections)
For now just returns the single-typed relations. |
Collection |
getInversedDependency(MBaseID id,
String wantedType,
Collection col)
|
Iterator |
getItemsModifiedSince(Date date)
|
Date |
getLastModified(Collection ids)
Returns the latest modification dates of the elements whose IDs are given. |
OJElement |
getMetadata(MBaseID id)
Returns the contents of the <metdata> child of this element. |
String |
getMetadataString(MBaseID id)
This method returns metadata as string. |
Hashtable |
getOMDocPath(MBaseID id)
|
Iterator |
getOutgoingRelations(MBaseID id)
For now just returns the single-typed relations. |
Iterator |
getProofs(MBaseID assertionID,
Collection collections)
For an assertion, this method returns the IDs of all of its proofs. |
Iterator |
getRelated(MBaseID id,
Collection collections)
Same as MBaseRef.getDependencies(org.activemath.abstractcontent.MBaseID) but returns the converse: all relations whose MBaseRef.Dependency.idOn is the element of given ID. |
OJDocument |
getStructuredListOfConcepts(Collection collections)
This expensive operation walks the complete XML structure of one single collection stored in the server and creates a theory element for each theory then a concept element for each of the concepts (symbol, definition, assertion, proof, methods). |
Map |
getTagFreeCommonName(MBaseID id)
Returns the titles without any tags, just extracting the text or partially rendering it. |
List |
getTextualContent(MBaseID id)
From any ID this method returns the row of CMP elements' contents. |
String |
getTextualContentString(MBaseID id)
This method return textual Contents as String. |
MBaseID |
getTheory(MBaseID id)
Returns the ID of the closest parent (including the element itself) that either has a theory attribute or is a theory element or null if there is no such parent. |
String |
getTypeString(MBaseID id)
Returns the name of the element whose ID is given. |
Iterator |
listItems(Collection collections,
String type)
Lists all the items being children of the element of the indicated ID. |
Iterator |
listItems(MBaseID id)
Lists all the items being children of the element of the indicated ID. |
Iterator |
listTheories(Collection collections)
Lists all the IDs of the theory elements contained in the indicated collections
. |
Iterator |
listTheories(String collection)
|
void |
reload()
Does the same as reload(List,String) except with no error-accumulator. |
void |
reload(Collection collections)
Works only with OmdocJdomMBaseRef and
OmdocLuceneMBaseRef. |
void |
reload(List errorAccumulator,
String fileName)
Checks the modification dates of the files that were recorded, reloads the newer files, drops the too old files and rebuilds. |
void |
reload(String fileName)
Does the same as reload(List,String) except with no error-accumulator. |
void |
reloadWithErrors(Collection collections,
List errorAccumulator)
Reloads the content from the directory (optional operation). |
Iterator |
searchIDs(String sub)
Searches for an id by substring... |
Vector |
searchIDsVector(String idSubstring)
Searches for an id by substring... |
Iterator |
searchText(String textToSearch,
Collection collections)
Searches the union of all text elements, but not the attributes, for the given substring in a case-sensistive manner. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final ReadWriteLock lock
| Constructor Detail |
|---|
public OmdocLuceneMBaseRef(Subconfiguration config)
throws Exception
makeDefaultProps().
Properties that can be set are the following (note that the
ActiveMath manager uses the prefix LuceneMBase:
dbpath
The path where lucene database exist. This path must exist in your directory with valid lucence data files. By default path is ACTIVEMATH_HOME/data/lucenedb.
Exception| Method Detail |
|---|
public AMIndex getAMIndex()
public Iterator getDependencies(MBaseID id)
throws MBaseException
MBaseRefMBaseRef.Dependency relations with all relations that stem from this
element. Relations are considered the same as dependencies in this class.
They are of many types as described in the MBaseRef.Dependency class.
Use MBaseRef.getDependencies(org.activemath.abstractcontent.MBaseID) to read the list of relations that stem from another element
but target this element.
Note that the server implementation is not required to return all these types only the content of the <depends-on> elements are required to be returned.
getDependencies in interface MBaseRefid - which's dependencies are to be returned
MBaseException - if something's wrong, i.e. if a collection was queried that is not
provided
public Iterator getRelated(MBaseID id,
Collection collections)
throws MBaseException
MBaseRefMBaseRef.getDependencies(org.activemath.abstractcontent.MBaseID) but returns the converse: all relations whose MBaseRef.Dependency.idOn is the element of given ID.
getRelated in interface MBaseRefid - which's relations are to be returnedcollections - java.util.Collection of (content) collections as Strings to search in
MBaseException - if something's wrong.
public OJElement getChildren(MBaseID id,
String xPathReducedExpression)
throws MBaseException
MBaseRefxPathReducedExpression parameter which aims at imitating an
XPath expression except it only accepts the ., / and named
elements.
This walks the tree of descendants, taking children everytime a /elementName is
found in the xPathReducedExpression and returns the content of the end child.
Such a method might be a warmer future for all requests, including getDependencies, getMetaData and getCommonName.
getChildren in interface MBaseRefid - the MBaseID to get the children ofxPathReducedExpression - as described above
OJElement thus crafted
MBaseException - if something fails
public String getChildrenString(MBaseID id,
String xPathReducedExpression)
throws MBaseException
id - a MBaseID valuexPathReducedExpression - a String value
String value
MBaseException - if an error occurs
public String getAttribute(MBaseID id,
String attName)
throws MBaseException
MBaseRef
getAttribute in interface MBaseRefid - the id of the XML element that is to be looked forattName - the name of the attribute to be looked for in this
element
MBaseException - if anything goes wrong
public Iterator getDefinitions(MBaseID id,
Collection collections)
throws MBaseException
MBaseRefsymbol, this method returns the IDs of all definitions.
getDefinitions in interface MBaseRefid - id the id of the symbol whose definitions are looked atcollections - collections the name of the collections to be searched
MBaseException - if something's wrong.
public Iterator getProofs(MBaseID assertionID,
Collection collections)
throws MBaseException
MBaseRefassertion, this method returns the IDs of all of its proofs.
getProofs in interface MBaseRefassertionID - MBaseID denoting the assertion whose proofs are to be searchedcollections - Collection of (content) collections to search in
MBaseException - if something's wrong.
public List getTextualContent(MBaseID id)
throws MBaseException
MBaseRef<OMS> who are "referenced" by means of the
xref attribute.
getTextualContent in interface MBaseRefid - The ID of the item whose CMPs are to be returned
OJElements being the CMP nodes
MBaseException - if something fails
public String getTextualContentString(MBaseID id)
throws MBaseException
id - a MBaseID value
MBaseException - if an error occurs
public OJElement getFormalContent(MBaseID id)
throws MBaseException
MBaseRef<OMS> who are "referenced" by means of the
xref attribute.
getFormalContent in interface MBaseRefid - The ID whose FMP child is to be fetched
OJElement representing the <FMP> or
null if there is no <FMP> content behind the ID
MBaseException - if something fails
public String getFormalContentString(MBaseID id)
throws MBaseException
id - a MBaseID value
String value
MBaseException - if an error occurs
public OJElement getMetadata(MBaseID id)
throws MBaseException
MBaseRef<metdata> child of this element. This does not
apply the inheritance principles of Dublin-Core metadata (as described in OMDoc 1.1
specifications), please use MBaseRef.getCompleteDCMetadata(org.activemath.abstractcontent.MBaseID) for this task.
getMetadata in interface MBaseRefid - The ID of the item whose metadata element is to be fetched.
- Returns:
- The
metadata OJElement
- Throws:
MBaseException - if something fails
public String getMetadataString(MBaseID id)
throws MBaseException
id - a MBaseID value
String value. It is string of metadata.
MBaseException - if an error occurs
public OJElement getCompleteDCMetadata(MBaseID id)
throws MBaseException
MBaseRefmetadata element with only Dublin-Core children including inherited
ones from their parents. The inheritance is described in OMDoc 1.1 specifications (i.e. added values with
children taking precedence when a triple (language, element-name, role) also exists. This allows most of the copyright informations to be stored in the metadata element of the OMDoc while additions can override or enrich these values.
getCompleteDCMetadata in interface MBaseRefid - the ID of the item whose metadata is to be fetched
OJElement metadata node
MBaseException - If anything happens
public String getCompleteDCMetadataString(MBaseID id)
throws MBaseException
id - a MBaseID value
String value. dc metadata value.
MBaseException - if an error occurs
public MBaseID getTheory(MBaseID id)
throws MBaseException
MBaseRefnull if there is no such parent.
getTheory in interface MBaseRefid - The item whose theory is to be found
MBaseID of the related theory element
MBaseException - if something's wrong.
public Map getCommonName(MBaseID id)
throws MBaseException
MBaseRef<metadata><dc:Title>
descendant or from the <commonname> elements.
The table returned has, as keys, the language and as values the text of this common-name.
- Specified by:
getCommonName in interface MBaseRef
- Parameters:
id - The ID of the item whose titles are to be looked at.
- Returns:
- A
Map of titles (keys String language}, values the
String titles
- Throws:
MBaseException - if something's wrong.
public String getTypeString(MBaseID id)
throws MBaseException
MBaseRef
getTypeString in interface MBaseRefid - The ID of the element
MBaseException - if something's wrong.
public MBaseID[] getForWhat(MBaseID id)
throws MBaseException
MBaseReffor
getForWhat in interface MBaseRefid - The ID of the item whose for attribute is to be looked
at.
for attribute of the element
MBaseException - if something's wrong.
public Iterator listItems(MBaseID id)
throws MBaseException
MBaseRefomgroup and theory elements
only.
listItems in interface MBaseRefid - the ID of the omgroup, theory
or other element
MBaseID objects
MBaseException - If anything goes wrong
public Iterator listTheories(Collection collections)
throws MBaseException
MBaseReftheory elements contained in the indicated collections
.
listTheories in interface MBaseRefcollections - the set of collection-names to be walked through for theories.
MBaseException - If anything goes wrong
public Iterator listItems(Collection collections,
String type)
throws MBaseException
MBaseRefomgroup and theory elements
only.
listItems in interface MBaseRefcollections - the possible collections where to search for the items of this typetype - the element name wished to be returne
MBaseID objects to the given elements
MBaseException - If anything goes wrong
public Iterator listTheories(String collection)
throws MBaseException
MBaseException
public Iterator searchText(String textToSearch,
Collection collections)
throws MBaseException
MBaseRef
searchText in interface MBaseReftextToSearch - String containing the text to be searchedcollections - Collection of collections (as Strings) to search in
MBaseException - if something's wrong.
public OJDocument getStructuredListOfConcepts(Collection collections)
throws MBaseException
MBaseRef
getStructuredListOfConcepts in interface MBaseRefcollections - strings with the name of the collection to search in
null,
if there are no contents found
MBaseException - if something fails
public void assertItsUp()
throws MBaseException
MBaseRef
assertItsUp in interface MBaseRefMBaseException - if something's wrong.
public Collection getCollectionsProvided()
throws MBaseException
MBaseRef
getCollectionsProvided in interface MBaseRefMBaseException - If anything goes wrong (normally nothing is expected to go wrong
here)
public MBaseID getCanonicalID(MBaseID givenID)
throws MBaseException
MBaseRefMBase engines should be consistent and never return more than one ID for a given item.
getCanonicalID in interface MBaseRefgivenID - the id that may be missing a theory or collection.
MBaseException - If anything goes wrong
public Collection getInversedDependency(MBaseID id,
String wantedType,
Collection col)
throws MBaseException
MBaseException
public void create()
throws org.jdom.JDOMException,
NoSuchIDException,
IOException,
MBaseException,
Exception
reload(List,String) except with no error-accumulator.
org.jdom.JDOMException
NoSuchIDException
IOException
MBaseException
Exception
public void reload()
throws org.jdom.JDOMException,
NoSuchIDException,
IOException,
MBaseException,
Exception
reload(List,String) except with no error-accumulator.
org.jdom.JDOMException
NoSuchIDException
IOException
MBaseException
Exception
public void reload(String fileName)
throws org.jdom.JDOMException,
NoSuchIDException,
IOException,
MBaseException,
Exception
reload(List,String) except with no error-accumulator.
org.jdom.JDOMException
NoSuchIDException
IOException
MBaseException
Exception
public void reload(Collection collections)
throws MBaseException
AuthorExtendedMBaseRefOmdocJdomMBaseRef and
OmdocLuceneMBaseRef.
reload in interface AuthorExtendedMBaseRefcollections - The set of collection-names (Strings) to be reloaded
(might be ignored by some implementations)
MBaseException
public void reloadWithErrors(Collection collections,
List errorAccumulator)
throws MBaseException
AuthorExtendedMBaseRef
reloadWithErrors in interface AuthorExtendedMBaseRefcollections - The set of collection-names (Strings) tobe reloadederrorAccumulator - a place to accumulate errors reported by the reload process
each entry should be a Hashtable with keys
MBaseException
public String generateImports(String col,
String fileName)
throws Exception
col - a String value. The name of the
collection.fileName - It is a absoulte path of the omdoc fileName
Exception - Description of the Exception
public Collection generateImportIDs(String col,
String fileName)
throws Exception
Exception
public void reload(List errorAccumulator,
String fileName)
throws org.jdom.JDOMException,
NoSuchIDException,
IOException,
MBaseException,
Exception
MBaseErrorReporter.
errorAccumulator - A list where error records will be added-to. Can be null.
(see MBaseErrorReporter.makeAsRecord(org.activemath.omdocjdom.MBaseBuildException)).
org.jdom.JDOMException - Missing description of Exception
NoSuchIDException - Missing description of Exception
IOException - Missing description of Exception
MBaseException
Exception
public Vector searchIDsVector(String idSubstring)
throws IOException
idSubstring - The substring to search (may be empty to get a compelte list)
IOException
public Iterator searchIDs(String sub)
throws MBaseException
AuthorExtendedMBaseRef
searchIDs in interface AuthorExtendedMBaseRefsub - The substring to search (may be empty to get a complete but expectedly hige list)
MBaseException
public String deleteTerm(String id)
throws NoSuchIDException,
IOException
NoSuchIDException
IOException
public org.apache.lucene.document.Document getDocument(MBaseID id)
throws MBaseException
MBaseException
public Hashtable getOMDocPath(MBaseID id)
throws MBaseException
getOMDocPath in interface AuthorExtendedMBaseRefid - The ID to be found
path, the path relative to the basePath.lineNumber the line-number in the filecolumnNumber the column-number in the fileabsolutePath the absolute path to the file (optional)MBaseItemNotFoundException - if the ID is not found
MBaseException - If anything happens,
public Date getLastModified(Collection ids)
throws MBaseException
MBaseRef
getLastModified in interface MBaseRefids - a list of MBaseIDs of items, theories, or Strings of collection name
MBaseException
public Iterator getItemsModifiedSince(Date date)
throws MBaseException
getItemsModifiedSince in interface MBaseRefMBaseException
public Map getTagFreeCommonName(MBaseID id)
throws MBaseException
MBaseRef
getTagFreeCommonName in interface MBaseRefid - the item id.
MBaseException
public Iterator getIncomingRelations(MBaseID id,
Collection collections)
throws MBaseException
getIncomingRelations in interface MBaseRefid - the id from which to see the relationscollections - from where should these relations be incoming
MBaseRef.Relations objects
MBaseException - if anything
public Iterator getOutgoingRelations(MBaseID id)
throws MBaseException
getOutgoingRelations in interface MBaseRefid - the id from which to see the relations
MBaseRef.Relations objects
MBaseException - if anything
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||