Class MemIRI
- java.lang.Object
-
- org.eclipse.rdf4j.sail.memory.model.MemResource
-
- org.eclipse.rdf4j.sail.memory.model.MemIRI
-
public class MemIRI extends MemResource implements IRI
A MemoryStore-specific implementation of URI that stores separated namespace and local name information to enable reuse of namespace String objects (reducing memory usage) and that gives it node properties.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.ObjectcreatorThe object that created this MemURI.private inthashCodeThe MemURI's hash code, 0 if not yet initialized.private java.lang.StringlocalNameThe URI's local name.private java.lang.StringnamespaceThe URI's namespace.private MemStatementListobjectStatementsThe list of statements for which this MemURI is the object.private MemStatementListpredicateStatementsThe list of statements for which this MemURI is the predicate.private static longserialVersionUID(package private) java.lang.ref.SoftReference<java.lang.String>toStringCache-
Fields inherited from class org.eclipse.rdf4j.sail.memory.model.MemResource
contextStatements, subjectStatements
-
Fields inherited from interface org.eclipse.rdf4j.sail.memory.model.MemValue
EMPTY_LIST
-
-
Constructor Summary
Constructors Constructor Description MemIRI(java.lang.Object creator, java.lang.String namespace, java.lang.String localName)Creates a new MemURI for a URI.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddObjectStatement(MemStatement st)Adds a statement to this MemValue's list of statements for which it is the object.voidaddPredicateStatement(MemStatement st)Adds a statement to this MemURI's list of statements for which it is the predicate.voidcleanSnapshotsFromObjectStatements(int currentSnapshot)Removes statements from old snapshots (those that have expired at or before the specified snapshot version) from this MemValue's list of statements for which it is the object.voidcleanSnapshotsFromPredicateStatements(int currentSnapshot)Removes statements from old snapshots (those that have expired at or before the specified snapshot version) from this MemValue's list of statements for which it is the predicate.booleanequals(java.lang.Object o)Compares this IRI to another object.java.lang.ObjectgetCreator()Returns the object that created this MemValue.java.lang.StringgetLocalName()Gets the local name part of this IRI.java.lang.StringgetNamespace()Gets the namespace part of this IRI.intgetObjectStatementCount()Gets the number of statements for which this MemValue is the object.MemStatementListgetObjectStatementList()Gets the list of statements for which this MemValue is the object.intgetPredicateStatementCount()Gets the number of Statements for which this MemURI is the predicate.MemStatementListgetPredicateStatementList()Gets the list of statements for which this MemURI is the predicate.inthashCode()Computes the hash code of this IRI.booleanhasObjectStatements()booleanhasPredicateStatements()booleanhasStatements()Checks whether this MemValue has any statements.java.lang.StringstringValue()Returns the String-value of a Value object.java.lang.StringtoString()-
Methods inherited from class org.eclipse.rdf4j.sail.memory.model.MemResource
addContextStatement, addSubjectStatement, cleanSnapshotsFromContextStatements, cleanSnapshotsFromSubjectStatements, getContextStatementCount, getContextStatementList, getSubjectStatementCount, getSubjectStatementList, hasContextStatements, hasSubjectStatements
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.rdf4j.model.Resource
isResource
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
namespace
private final java.lang.String namespace
The URI's namespace.
-
localName
private final java.lang.String localName
The URI's local name.
-
creator
private final transient java.lang.Object creator
The object that created this MemURI.
-
hashCode
private volatile int hashCode
The MemURI's hash code, 0 if not yet initialized.
-
predicateStatements
private final transient MemStatementList predicateStatements
The list of statements for which this MemURI is the predicate.
-
objectStatements
private final transient MemStatementList objectStatements
The list of statements for which this MemURI is the object.
-
toStringCache
transient java.lang.ref.SoftReference<java.lang.String> toStringCache
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
stringValue
public java.lang.String stringValue()
Description copied from interface:ValueReturns the String-value of a Value object. This returns either aLiteral's label, aIRI's URI or aBNode's ID.- Specified by:
stringValuein interfaceValue
-
getNamespace
public java.lang.String getNamespace()
Description copied from interface:IRIGets the namespace part of this IRI.The namespace is defined as per the algorithm described in the class documentation.
- Specified by:
getNamespacein interfaceIRI- Returns:
- the namespace of this IRI
-
getLocalName
public java.lang.String getLocalName()
Description copied from interface:IRIGets the local name part of this IRI.The local name is defined as per the algorithm described in the class documentation.
- Specified by:
getLocalNamein interfaceIRI- Returns:
- the local name of this IRI
-
equals
public boolean equals(java.lang.Object o)
Description copied from interface:IRICompares this IRI to another object.- Specified by:
equalsin interfaceIRI- Overrides:
equalsin classjava.lang.Object- Parameters:
o- the object to compare this IRI to- Returns:
true, if the other object is an instance ofIRIand their string values are equal;false, otherwise
-
hashCode
public int hashCode()
Description copied from interface:IRIComputes the hash code of this IRI.- Specified by:
hashCodein interfaceIRI- Overrides:
hashCodein classjava.lang.Object- Returns:
- a hash code for this IRI computed as
Value.stringValue().hashCode()
-
getCreator
public java.lang.Object getCreator()
Description copied from interface:MemValueReturns the object that created this MemValue. MemValues are only unique within a single repository, but an application could use several repositories at the same time, passing MemValues generated by one Sail to another Sail. In such situations, the MemValue of the first Sail cannot be used by the second Sail.- Specified by:
getCreatorin interfaceMemValue
-
hasStatements
public boolean hasStatements()
Description copied from interface:MemValueChecks whether this MemValue has any statements. A MemValue object has statements if there is at least one statement where it is used as the subject, predicate, object or context value.- Specified by:
hasStatementsin interfaceMemValue- Returns:
- true if the MemValue has statements, false otherwise.
-
getPredicateStatementList
public MemStatementList getPredicateStatementList()
Gets the list of statements for which this MemURI is the predicate.- Returns:
- a MemStatementList containing the statements.
-
getPredicateStatementCount
public int getPredicateStatementCount()
Gets the number of Statements for which this MemURI is the predicate.- Returns:
- An integer larger than or equal to 0.
-
addPredicateStatement
public void addPredicateStatement(MemStatement st) throws java.lang.InterruptedException
Adds a statement to this MemURI's list of statements for which it is the predicate.- Throws:
java.lang.InterruptedException
-
cleanSnapshotsFromPredicateStatements
public void cleanSnapshotsFromPredicateStatements(int currentSnapshot) throws java.lang.InterruptedExceptionRemoves statements from old snapshots (those that have expired at or before the specified snapshot version) from this MemValue's list of statements for which it is the predicate.- Parameters:
currentSnapshot- The current snapshot version.- Throws:
java.lang.InterruptedException
-
getObjectStatementList
public MemStatementList getObjectStatementList()
Description copied from interface:MemValueGets the list of statements for which this MemValue is the object.- Specified by:
getObjectStatementListin interfaceMemValue- Returns:
- A MemStatementList containing the statements.
-
getObjectStatementCount
public int getObjectStatementCount()
Description copied from interface:MemValueGets the number of statements for which this MemValue is the object.- Specified by:
getObjectStatementCountin interfaceMemValue- Returns:
- An integer larger than or equal to 0.
-
addObjectStatement
public void addObjectStatement(MemStatement st) throws java.lang.InterruptedException
Description copied from interface:MemValueAdds a statement to this MemValue's list of statements for which it is the object.- Specified by:
addObjectStatementin interfaceMemValue- Throws:
java.lang.InterruptedException
-
cleanSnapshotsFromObjectStatements
public void cleanSnapshotsFromObjectStatements(int currentSnapshot) throws java.lang.InterruptedExceptionDescription copied from interface:MemValueRemoves statements from old snapshots (those that have expired at or before the specified snapshot version) from this MemValue's list of statements for which it is the object.- Specified by:
cleanSnapshotsFromObjectStatementsin interfaceMemValue- Parameters:
currentSnapshot- The current snapshot version.- Throws:
java.lang.InterruptedException
-
hasPredicateStatements
public boolean hasPredicateStatements()
- Specified by:
hasPredicateStatementsin interfaceMemValue
-
hasObjectStatements
public boolean hasObjectStatements()
- Specified by:
hasObjectStatementsin interfaceMemValue
-
-