public class NamedGraph extends Object implements Comparable<NamedGraph>
GraphCollection).| Constructor and Description |
|---|
NamedGraph(String name,
int depth,
NamedGraph parent) |
| Modifier and Type | Method and Description |
|---|---|
void |
addMSGSignature(String[] data)
Adds a MSG signature to this named graph
|
void |
addTriple(Triple t)
Adds a triple to the graph
|
void |
applyPrefixes(LinkedList<Prefix> pre)
Applies prefixes to a graph and all subgraphs (recursive) - replaces IRIs with prefixes
|
int |
blankNodeCount(boolean recursive,
boolean distinct)
Deprecated.
|
void |
clear()
Clears graph by removing all MSGs and sub graphs (recursive)
|
int |
compareTo(NamedGraph g)
Compares graph with another graph (used for sorting, lexicographic order)
|
int |
countDuplicates()
Counts duplicates
|
static int |
countOccurrences(ArrayList<Triple> triples,
String node)
Count occurrences of a node (ignores predicates)
|
int |
countPredicate(String predicate)
Counts triples with specified predicate
|
LinkedList<NamedGraph> |
getChildren() |
int |
getDepth() |
String |
getHierarchyString()
Gets graph hierarchy as string
|
ArrayList<MSG> |
getMSGs() |
ArrayList<String[]> |
getMSGSignatures() |
String |
getName() |
NamedGraph |
getParent() |
int[] |
getStats(boolean recursive)
Gets statistics of a named graph (can be recursive to include sub graphs if recursive is set to true)
Array index - value
0 - total triple count
1 - IRIs / resources
2 - literals
3 - blank nodes
4 - distinct blank nodes
5 - Unique subject URIs
|
static int[] |
getStatsTripleList(ArrayList<Triple> triples,
HashSet<String> blankNodes,
HashSet<String> USUs)
Get statistics of a triple list
Array index - value
0 - total triple count
1 - IRIs / resources
2 - literals
3 - blank nodes
4 - distinct blank nodes
5 - Unique subject URIs
|
ArrayList<Triple> |
getTriples() |
ArrayList<NodeHash> |
getVariableHashes() |
boolean |
isHashed()
Checks if hash value for triples in graph is set (recursive)
Note: function assumes that either all or no triples are hashed, does not check MSGs
|
boolean |
isUsingMSGs()
Checks if there are any MSGs in the
NamedGraph |
boolean |
isValid()
Checks if the graph and all it's content is well-formed
|
void |
mergeMSGs()
Merges all MSGs back to plain triple lists
All values associated with MSGs (hash, signature, certificate) will get lost
|
void |
removeTriple(Triple t)
Removes a triple from the graph
|
void |
resolvePrefixes(LinkedList<Prefix> pre)
Resolves prefixes in a graph and all subgraphs (recursive) - replaces prefixes with IRIs
|
void |
setChildren(LinkedList<NamedGraph> children) |
void |
setName(String name) |
void |
setVariableHashes(ArrayList<NodeHash> variableHashes) |
void |
sortGraphs()
Sorts all children graphs by their name (recursive)
|
void |
splitIntoMSGs()
Splits graph into MSGs (recursive)
|
String |
toString()
Converts the graph to a string (used for printing and debugging)
Attention: May not work properly with very big named graphs
|
String |
toString(int padding)
Converts the graph to a string (used for printing and debugging)
Attention: May not work properly with very big named graphs
|
int |
tripleCount(boolean recursive)
Gets triple count (can be recursive to include all sub graphs)
|
void |
updateDepths(int _depth,
NamedGraph _parent)
Updates the depth of this graphs and all sub graphs (recursive)
|
public NamedGraph(String name, int depth, NamedGraph parent)
public String getName()
public void setName(String name)
public int getDepth()
public LinkedList<NamedGraph> getChildren()
public void setChildren(LinkedList<NamedGraph> children)
public NamedGraph getParent()
public int tripleCount(boolean recursive)
recursive - count recursively in all sub graphs?@Deprecated public int blankNodeCount(boolean recursive, boolean distinct)
recursive - count recursively in all sub graphs?distinct - count distinct blank nodes only?public int[] getStats(boolean recursive)
recursive - count recursively in all sub graphs?public static int[] getStatsTripleList(ArrayList<Triple> triples, HashSet<String> blankNodes, HashSet<String> USUs)
triples - triples to get stats fromblankNodes - list of detected blank nodesUSUs - list of detected USUs (unique subject URIs)public int countPredicate(String predicate)
predicate - URI of the predicatepublic int countDuplicates()
public static int countOccurrences(ArrayList<Triple> triples, String node)
triples - ArrayList of triples to scannode - node value to countpublic void sortGraphs()
public String getHierarchyString()
public void addTriple(Triple t)
t - triple to addpublic void removeTriple(Triple t)
t - triple to removepublic void resolvePrefixes(LinkedList<Prefix> pre)
pre - ArrayList with prefixespublic void applyPrefixes(LinkedList<Prefix> pre)
pre - ArrayList with prefixespublic void splitIntoMSGs()
public void mergeMSGs()
public boolean isHashed()
public boolean isUsingMSGs()
NamedGraphpublic void addMSGSignature(String[] data)
data - signature datapublic boolean isValid()
throws Exception
Exception - if its malformedpublic void clear()
public void updateDepths(int _depth,
NamedGraph _parent)
public String toString()
public String toString(int padding)
padding - indention levelpublic int compareTo(NamedGraph g)
compareTo in interface Comparable<NamedGraph>g - graph to compare this graph withCopyright © 2018. All rights reserved.