java.lang.Object
org.apache.jena.riot.system.MapWithScope<String,org.apache.jena.graph.Node,org.apache.jena.graph.Node>
org.apache.jena.riot.lang.LabelToNode
public class LabelToNode
extends MapWithScope<String,org.apache.jena.graph.Node,org.apache.jena.graph.Node>
Allocation of Nodes (blank nodes usually) based on the graph and scope.
There are various different policies.
See
SyntaxLabels.createLabelToNode()
for getting a default setup;
some of the others are for testing and debugging and may not generate
legal RDF overall (e.g. reparsing the same file gets the same bNodes)-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.jena.riot.system.MapWithScope
MapWithScope.Allocator<A,
B, S>, MapWithScope.ScopePolicy<A, B, S> -
Constructor Summary
ConstructorDescriptionLabelToNode
(MapWithScope.ScopePolicy<String, org.apache.jena.graph.Node, org.apache.jena.graph.Node> scopePolicy, MapWithScope.Allocator<String, org.apache.jena.graph.Node, org.apache.jena.graph.Node> allocator) -
Method Summary
Modifier and TypeMethodDescriptionstatic LabelToNode
Allocation, globally scoped, that uses a incrementing field to create new nodesstatic LabelToNode
Allocation from a single scope; just the label matters.static LabelToNode
Allocation from a single scope; just the label matters.static LabelToNode
Allocation scoped by graph and label.static LabelToNode
Allocation, with a map from seen label to node.static LabelToNode
Allocation using syntax label; output is unsafe for reading (usecreateUseLabelEncoded()
for output-input).static LabelToNode
Allocation using an encoded syntax label (i.e.Methods inherited from class org.apache.jena.riot.system.MapWithScope
clear, create, get
-
Constructor Details
-
LabelToNode
public LabelToNode(MapWithScope.ScopePolicy<String, org.apache.jena.graph.Node, org.apache.jena.graph.Node> scopePolicy, MapWithScope.Allocator<String, org.apache.jena.graph.Node, org.apache.jena.graph.Node> allocator)
-
-
Method Details
-
createScopeByDocumentHash
Allocation from a single scope; just the label matters. This is the RDF syntax correct policy. SeecreateScopeGlobal()
for some history. -
createScopeByDocumentHash
Allocation from a single scope; just the label matters. Use this policy if repeated runs must give identical allocations- Parameters:
seed
- Seed
-
createScopeGlobal
Allocation, with a map from seen label to node. It uses the jena-core blank node allocator and a map from label to blank node. This style works for any blank node allocation style but the map can grow to arbitrary size.This was the policy up to Jena 2.10.0 but it occasionally ran into problems at very large scale because it generates and remembers a new UUIDs for new each blank node. The policy changed to
createScopeByDocumentHash()
which calculates the blank node label needed without needing to retain previous allocations. -
createScopeByGraph
Allocation scoped by graph and label. -
createUseLabelAsGiven
Allocation using syntax label; output is unsafe for reading (usecreateUseLabelEncoded()
for output-input). The reverse operation is provided byNodeToLabel.createBNodeByLabelAsGiven()
but the pair is unsafe for output-input. Use encoded labels for that. The main purpose of this LabelToNode is to preserve the used label for debugging. -
createUseLabelEncoded
Allocation using an encoded syntax label (i.e. _:B<encoded> format fromNodeFmtLib.encodeBNodeLabel(java.lang.String)
). The reverse operation is provided byNodeToLabel.createBNodeByLabelEncoded()
. This pair should be used to write out and recover blank node by internal id. -
createIncremental
Allocation, globally scoped, that uses a incrementing field to create new nodes
-