id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
22,900 | graknlabs/grakn | server/src/graql/executor/ComputeExecutor.java | ComputeExecutor.scopeTypeLabels | private ImmutableSet<Label> scopeTypeLabels(GraqlCompute query) {
return scopeTypes(query).map(SchemaConcept::label).collect(CommonUtil.toImmutableSet());
} | java | private ImmutableSet<Label> scopeTypeLabels(GraqlCompute query) {
return scopeTypes(query).map(SchemaConcept::label).collect(CommonUtil.toImmutableSet());
} | [
"private",
"ImmutableSet",
"<",
"Label",
">",
"scopeTypeLabels",
"(",
"GraqlCompute",
"query",
")",
"{",
"return",
"scopeTypes",
"(",
"query",
")",
".",
"map",
"(",
"SchemaConcept",
"::",
"label",
")",
".",
"collect",
"(",
"CommonUtil",
".",
"toImmutableSet",
... | Helper method to get the labels of the type in the query scope
@return a set of Concept Type Labels | [
"Helper",
"method",
"to",
"get",
"the",
"labels",
"of",
"the",
"type",
"in",
"the",
"query",
"scope"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/executor/ComputeExecutor.java#L765-L767 |
22,901 | graknlabs/grakn | server/src/graql/executor/ComputeExecutor.java | ComputeExecutor.scopeContainsInstance | private boolean scopeContainsInstance(GraqlCompute query) {
if (scopeTypeLabels(query).isEmpty()) return false;
List<Pattern> checkSubtypes = scopeTypeLabels(query).stream()
.map(type -> Graql.var("x").isa(Graql.type(type.getValue()))).collect(Collectors.toList());
return tx.str... | java | private boolean scopeContainsInstance(GraqlCompute query) {
if (scopeTypeLabels(query).isEmpty()) return false;
List<Pattern> checkSubtypes = scopeTypeLabels(query).stream()
.map(type -> Graql.var("x").isa(Graql.type(type.getValue()))).collect(Collectors.toList());
return tx.str... | [
"private",
"boolean",
"scopeContainsInstance",
"(",
"GraqlCompute",
"query",
")",
"{",
"if",
"(",
"scopeTypeLabels",
"(",
"query",
")",
".",
"isEmpty",
"(",
")",
")",
"return",
"false",
";",
"List",
"<",
"Pattern",
">",
"checkSubtypes",
"=",
"scopeTypeLabels",... | Helper method to check whether the concept types in the scope have any instances
@return | [
"Helper",
"method",
"to",
"check",
"whether",
"the",
"concept",
"types",
"in",
"the",
"scope",
"have",
"any",
"instances"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/executor/ComputeExecutor.java#L775-L781 |
22,902 | graknlabs/grakn | server/src/graql/executor/ComputeExecutor.java | ComputeExecutor.scopeContainsInstances | private boolean scopeContainsInstances(GraqlCompute query, ConceptId... ids) {
for (ConceptId id : ids) {
Thing thing = tx.getConcept(id);
if (thing == null || !scopeTypeLabels(query).contains(thing.type().label())) return false;
}
return true;
} | java | private boolean scopeContainsInstances(GraqlCompute query, ConceptId... ids) {
for (ConceptId id : ids) {
Thing thing = tx.getConcept(id);
if (thing == null || !scopeTypeLabels(query).contains(thing.type().label())) return false;
}
return true;
} | [
"private",
"boolean",
"scopeContainsInstances",
"(",
"GraqlCompute",
"query",
",",
"ConceptId",
"...",
"ids",
")",
"{",
"for",
"(",
"ConceptId",
"id",
":",
"ids",
")",
"{",
"Thing",
"thing",
"=",
"tx",
".",
"getConcept",
"(",
"id",
")",
";",
"if",
"(",
... | Helper method to check if concept instances exist in the query scope
@param ids
@return true if they exist, false if they don't | [
"Helper",
"method",
"to",
"check",
"if",
"concept",
"instances",
"exist",
"in",
"the",
"query",
"scope"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/executor/ComputeExecutor.java#L789-L795 |
22,903 | graknlabs/grakn | server/src/graql/executor/ComputeExecutor.java | ComputeExecutor.scopeIncludesImplicitOrAttributeTypes | private boolean scopeIncludesImplicitOrAttributeTypes(GraqlCompute query) {
if (query.in().isEmpty()) return false;
return query.in().stream().anyMatch(t -> {
Label label = Label.of(t);
SchemaConcept type = tx.getSchemaConcept(label);
return (type != null && (type.isA... | java | private boolean scopeIncludesImplicitOrAttributeTypes(GraqlCompute query) {
if (query.in().isEmpty()) return false;
return query.in().stream().anyMatch(t -> {
Label label = Label.of(t);
SchemaConcept type = tx.getSchemaConcept(label);
return (type != null && (type.isA... | [
"private",
"boolean",
"scopeIncludesImplicitOrAttributeTypes",
"(",
"GraqlCompute",
"query",
")",
"{",
"if",
"(",
"query",
".",
"in",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"return",
"false",
";",
"return",
"query",
".",
"in",
"(",
")",
".",
"stream",
... | Helper method to check whether implicit or attribute types are included in the query scope
@return true if they exist, false if they don't | [
"Helper",
"method",
"to",
"check",
"whether",
"implicit",
"or",
"attribute",
"types",
"are",
"included",
"in",
"the",
"query",
"scope"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/executor/ComputeExecutor.java#L811-L818 |
22,904 | graknlabs/grakn | server/src/graql/executor/ComputeExecutor.java | ComputeExecutor.convertLabelsToIds | private Set<LabelId> convertLabelsToIds(Set<Label> labelSet) {
return labelSet.stream()
.map(tx::convertToId)
.filter(LabelId::isValid)
.collect(toSet());
} | java | private Set<LabelId> convertLabelsToIds(Set<Label> labelSet) {
return labelSet.stream()
.map(tx::convertToId)
.filter(LabelId::isValid)
.collect(toSet());
} | [
"private",
"Set",
"<",
"LabelId",
">",
"convertLabelsToIds",
"(",
"Set",
"<",
"Label",
">",
"labelSet",
")",
"{",
"return",
"labelSet",
".",
"stream",
"(",
")",
".",
"map",
"(",
"tx",
"::",
"convertToId",
")",
".",
"filter",
"(",
"LabelId",
"::",
"isVa... | Helper method to convert type labels to IDs
@param labelSet
@return a set of LabelIds | [
"Helper",
"method",
"to",
"convert",
"type",
"labels",
"to",
"IDs"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/executor/ComputeExecutor.java#L826-L831 |
22,905 | graknlabs/grakn | server/src/graql/analytics/KCoreVertexProgram.java | KCoreVertexProgram.getMessageCountExcludeSelf | private static int getMessageCountExcludeSelf(Messenger<String> messenger, String id) {
Set<String> messageSet = newHashSet(messenger.receiveMessages());
messageSet.remove(id);
return messageSet.size();
} | java | private static int getMessageCountExcludeSelf(Messenger<String> messenger, String id) {
Set<String> messageSet = newHashSet(messenger.receiveMessages());
messageSet.remove(id);
return messageSet.size();
} | [
"private",
"static",
"int",
"getMessageCountExcludeSelf",
"(",
"Messenger",
"<",
"String",
">",
"messenger",
",",
"String",
"id",
")",
"{",
"Set",
"<",
"String",
">",
"messageSet",
"=",
"newHashSet",
"(",
"messenger",
".",
"receiveMessages",
"(",
")",
")",
"... | count the messages from relations, so need to filter its own msg | [
"count",
"the",
"messages",
"from",
"relations",
"so",
"need",
"to",
"filter",
"its",
"own",
"msg"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/analytics/KCoreVertexProgram.java#L215-L219 |
22,906 | graknlabs/grakn | server/src/server/exception/TemporaryWriteException.java | TemporaryWriteException.indexOverlap | public static TemporaryWriteException indexOverlap(Vertex vertex, Exception e){
return new TemporaryWriteException(String.format("Index overlap has led to the accidental sharing of a partially complete vertex {%s}", vertex), e);
} | java | public static TemporaryWriteException indexOverlap(Vertex vertex, Exception e){
return new TemporaryWriteException(String.format("Index overlap has led to the accidental sharing of a partially complete vertex {%s}", vertex), e);
} | [
"public",
"static",
"TemporaryWriteException",
"indexOverlap",
"(",
"Vertex",
"vertex",
",",
"Exception",
"e",
")",
"{",
"return",
"new",
"TemporaryWriteException",
"(",
"String",
".",
"format",
"(",
"\"Index overlap has led to the accidental sharing of a partially complete v... | Thrown when multiple transactions overlap in using an index. This results in incomplete vertices being shared
between transactions. | [
"Thrown",
"when",
"multiple",
"transactions",
"overlap",
"in",
"using",
"an",
"index",
".",
"This",
"results",
"in",
"incomplete",
"vertices",
"being",
"shared",
"between",
"transactions",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/exception/TemporaryWriteException.java#L54-L56 |
22,907 | graknlabs/grakn | server/src/server/exception/TransactionException.java | TransactionException.addingInstancesToAbstractType | public static TransactionException addingInstancesToAbstractType(Type type) {
return create(ErrorMessage.IS_ABSTRACT.getMessage(type.label()));
} | java | public static TransactionException addingInstancesToAbstractType(Type type) {
return create(ErrorMessage.IS_ABSTRACT.getMessage(type.label()));
} | [
"public",
"static",
"TransactionException",
"addingInstancesToAbstractType",
"(",
"Type",
"type",
")",
"{",
"return",
"create",
"(",
"ErrorMessage",
".",
"IS_ABSTRACT",
".",
"getMessage",
"(",
"type",
".",
"label",
"(",
")",
")",
")",
";",
"}"
] | Throw when trying to add instances to an abstract Type | [
"Throw",
"when",
"trying",
"to",
"add",
"instances",
"to",
"an",
"abstract",
"Type"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/exception/TransactionException.java#L86-L88 |
22,908 | graknlabs/grakn | server/src/server/exception/TransactionException.java | TransactionException.hasNotAllowed | public static TransactionException hasNotAllowed(Thing thing, Attribute attribute) {
return create(HAS_INVALID.getMessage(thing.type().label(), attribute.type().label()));
} | java | public static TransactionException hasNotAllowed(Thing thing, Attribute attribute) {
return create(HAS_INVALID.getMessage(thing.type().label(), attribute.type().label()));
} | [
"public",
"static",
"TransactionException",
"hasNotAllowed",
"(",
"Thing",
"thing",
",",
"Attribute",
"attribute",
")",
"{",
"return",
"create",
"(",
"HAS_INVALID",
".",
"getMessage",
"(",
"thing",
".",
"type",
"(",
")",
".",
"label",
"(",
")",
",",
"attribu... | Thrown when a Thing is not allowed to have Attribute of that AttributeType | [
"Thrown",
"when",
"a",
"Thing",
"is",
"not",
"allowed",
"to",
"have",
"Attribute",
"of",
"that",
"AttributeType"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/exception/TransactionException.java#L93-L95 |
22,909 | graknlabs/grakn | server/src/server/exception/TransactionException.java | TransactionException.cannotBeDeleted | public static TransactionException cannotBeDeleted(SchemaConcept schemaConcept) {
return create(ErrorMessage.CANNOT_DELETE.getMessage(schemaConcept.label()));
} | java | public static TransactionException cannotBeDeleted(SchemaConcept schemaConcept) {
return create(ErrorMessage.CANNOT_DELETE.getMessage(schemaConcept.label()));
} | [
"public",
"static",
"TransactionException",
"cannotBeDeleted",
"(",
"SchemaConcept",
"schemaConcept",
")",
"{",
"return",
"create",
"(",
"ErrorMessage",
".",
"CANNOT_DELETE",
".",
"getMessage",
"(",
"schemaConcept",
".",
"label",
"(",
")",
")",
")",
";",
"}"
] | Thrown when a Type has incoming edges and therefore cannot be deleted | [
"Thrown",
"when",
"a",
"Type",
"has",
"incoming",
"edges",
"and",
"therefore",
"cannot",
"be",
"deleted"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/exception/TransactionException.java#L108-L110 |
22,910 | graknlabs/grakn | server/src/server/exception/TransactionException.java | TransactionException.invalidAttributeValue | public static TransactionException invalidAttributeValue(Object object, AttributeType.DataType dataType) {
return create(ErrorMessage.INVALID_DATATYPE.getMessage(object, object.getClass().getSimpleName(), dataType.name()));
} | java | public static TransactionException invalidAttributeValue(Object object, AttributeType.DataType dataType) {
return create(ErrorMessage.INVALID_DATATYPE.getMessage(object, object.getClass().getSimpleName(), dataType.name()));
} | [
"public",
"static",
"TransactionException",
"invalidAttributeValue",
"(",
"Object",
"object",
",",
"AttributeType",
".",
"DataType",
"dataType",
")",
"{",
"return",
"create",
"(",
"ErrorMessage",
".",
"INVALID_DATATYPE",
".",
"getMessage",
"(",
"object",
",",
"objec... | Thrown when creating an Attribute whose value Object does not match attribute data type | [
"Thrown",
"when",
"creating",
"an",
"Attribute",
"whose",
"value",
"Object",
"does",
"not",
"match",
"attribute",
"data",
"type"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/exception/TransactionException.java#L150-L152 |
22,911 | graknlabs/grakn | server/src/server/exception/TransactionException.java | TransactionException.immutableProperty | public static TransactionException immutableProperty(Object oldValue, Object newValue, Enum vertexProperty) {
return create(ErrorMessage.IMMUTABLE_VALUE.getMessage(oldValue, newValue, vertexProperty.name()));
} | java | public static TransactionException immutableProperty(Object oldValue, Object newValue, Enum vertexProperty) {
return create(ErrorMessage.IMMUTABLE_VALUE.getMessage(oldValue, newValue, vertexProperty.name()));
} | [
"public",
"static",
"TransactionException",
"immutableProperty",
"(",
"Object",
"oldValue",
",",
"Object",
"newValue",
",",
"Enum",
"vertexProperty",
")",
"{",
"return",
"create",
"(",
"ErrorMessage",
".",
"IMMUTABLE_VALUE",
".",
"getMessage",
"(",
"oldValue",
",",
... | Thrown when attempting to mutate a property which is immutable | [
"Thrown",
"when",
"attempting",
"to",
"mutate",
"a",
"property",
"which",
"is",
"immutable"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/exception/TransactionException.java#L173-L175 |
22,912 | graknlabs/grakn | server/src/server/exception/TransactionException.java | TransactionException.transactionOpen | public static TransactionException transactionOpen(TransactionOLTP tx) {
return create(ErrorMessage.TRANSACTION_ALREADY_OPEN.getMessage(tx.keyspace()));
} | java | public static TransactionException transactionOpen(TransactionOLTP tx) {
return create(ErrorMessage.TRANSACTION_ALREADY_OPEN.getMessage(tx.keyspace()));
} | [
"public",
"static",
"TransactionException",
"transactionOpen",
"(",
"TransactionOLTP",
"tx",
")",
"{",
"return",
"create",
"(",
"ErrorMessage",
".",
"TRANSACTION_ALREADY_OPEN",
".",
"getMessage",
"(",
"tx",
".",
"keyspace",
"(",
")",
")",
")",
";",
"}"
] | Thrown when attempting to open a transaction which is already open | [
"Thrown",
"when",
"attempting",
"to",
"open",
"a",
"transaction",
"which",
"is",
"already",
"open"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/exception/TransactionException.java#L187-L189 |
22,913 | graknlabs/grakn | server/src/server/exception/TransactionException.java | TransactionException.transactionReadOnly | public static TransactionException transactionReadOnly(TransactionOLTP tx) {
return create(ErrorMessage.TRANSACTION_READ_ONLY.getMessage(tx.keyspace()));
} | java | public static TransactionException transactionReadOnly(TransactionOLTP tx) {
return create(ErrorMessage.TRANSACTION_READ_ONLY.getMessage(tx.keyspace()));
} | [
"public",
"static",
"TransactionException",
"transactionReadOnly",
"(",
"TransactionOLTP",
"tx",
")",
"{",
"return",
"create",
"(",
"ErrorMessage",
".",
"TRANSACTION_READ_ONLY",
".",
"getMessage",
"(",
"tx",
".",
"keyspace",
"(",
")",
")",
")",
";",
"}"
] | Thrown when attempting to mutate a read only transaction | [
"Thrown",
"when",
"attempting",
"to",
"mutate",
"a",
"read",
"only",
"transaction"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/exception/TransactionException.java#L201-L203 |
22,914 | graknlabs/grakn | server/src/server/exception/TransactionException.java | TransactionException.closingFailed | public static TransactionException closingFailed(TransactionOLTP tx, Exception e) {
return new TransactionException(CLOSE_FAILURE.getMessage(tx.keyspace()), e);
} | java | public static TransactionException closingFailed(TransactionOLTP tx, Exception e) {
return new TransactionException(CLOSE_FAILURE.getMessage(tx.keyspace()), e);
} | [
"public",
"static",
"TransactionException",
"closingFailed",
"(",
"TransactionOLTP",
"tx",
",",
"Exception",
"e",
")",
"{",
"return",
"new",
"TransactionException",
"(",
"CLOSE_FAILURE",
".",
"getMessage",
"(",
"tx",
".",
"keyspace",
"(",
")",
")",
",",
"e",
"... | Thrown when the graph can not be closed due to an unknown reason. | [
"Thrown",
"when",
"the",
"graph",
"can",
"not",
"be",
"closed",
"due",
"to",
"an",
"unknown",
"reason",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/exception/TransactionException.java#L227-L229 |
22,915 | graknlabs/grakn | server/src/server/exception/TransactionException.java | TransactionException.invalidPropertyUse | public static TransactionException invalidPropertyUse(Concept concept, Schema.VertexProperty property) {
return create(INVALID_PROPERTY_USE.getMessage(concept, property));
} | java | public static TransactionException invalidPropertyUse(Concept concept, Schema.VertexProperty property) {
return create(INVALID_PROPERTY_USE.getMessage(concept, property));
} | [
"public",
"static",
"TransactionException",
"invalidPropertyUse",
"(",
"Concept",
"concept",
",",
"Schema",
".",
"VertexProperty",
"property",
")",
"{",
"return",
"create",
"(",
"INVALID_PROPERTY_USE",
".",
"getMessage",
"(",
"concept",
",",
"property",
")",
")",
... | Thrown when trying to add a Schema.VertexProperty to a Concept which does not accept that type
of Schema.VertexProperty | [
"Thrown",
"when",
"trying",
"to",
"add",
"a",
"Schema",
".",
"VertexProperty",
"to",
"a",
"Concept",
"which",
"does",
"not",
"accept",
"that",
"type",
"of",
"Schema",
".",
"VertexProperty"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/exception/TransactionException.java#L256-L258 |
22,916 | graknlabs/grakn | server/src/server/exception/TransactionException.java | TransactionException.changingSuperWillDisconnectRole | public static TransactionException changingSuperWillDisconnectRole(Type oldSuper, Type newSuper, Role role) {
return create(String.format("Cannot change the super type {%s} to {%s} because {%s} is connected to role {%s} which {%s} is not connected to.",
oldSuper.label(), newS... | java | public static TransactionException changingSuperWillDisconnectRole(Type oldSuper, Type newSuper, Role role) {
return create(String.format("Cannot change the super type {%s} to {%s} because {%s} is connected to role {%s} which {%s} is not connected to.",
oldSuper.label(), newS... | [
"public",
"static",
"TransactionException",
"changingSuperWillDisconnectRole",
"(",
"Type",
"oldSuper",
",",
"Type",
"newSuper",
",",
"Role",
"role",
")",
"{",
"return",
"create",
"(",
"String",
".",
"format",
"(",
"\"Cannot change the super type {%s} to {%s} because {%s}... | Thrown when changing the super of a Type will result in a Role disconnection which is in use. | [
"Thrown",
"when",
"changing",
"the",
"super",
"of",
"a",
"Type",
"will",
"result",
"in",
"a",
"Role",
"disconnection",
"which",
"is",
"in",
"use",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/exception/TransactionException.java#L284-L287 |
22,917 | graknlabs/grakn | server/src/graql/gremlin/NodesUtil.java | NodesUtil.nodeToPlanFragments | static List<Fragment> nodeToPlanFragments(Node node, Map<NodeId, Node> nodes, boolean visited) {
List<Fragment> subplan = new LinkedList<>();
if (!visited) {
node.getFragmentsWithoutDependency().stream()
.min(Comparator.comparingDouble(Fragment::fragmentCost))
... | java | static List<Fragment> nodeToPlanFragments(Node node, Map<NodeId, Node> nodes, boolean visited) {
List<Fragment> subplan = new LinkedList<>();
if (!visited) {
node.getFragmentsWithoutDependency().stream()
.min(Comparator.comparingDouble(Fragment::fragmentCost))
... | [
"static",
"List",
"<",
"Fragment",
">",
"nodeToPlanFragments",
"(",
"Node",
"node",
",",
"Map",
"<",
"NodeId",
",",
"Node",
">",
"nodes",
",",
"boolean",
"visited",
")",
"{",
"List",
"<",
"Fragment",
">",
"subplan",
"=",
"new",
"LinkedList",
"<>",
"(",
... | convert a Node to a sub-plan, updating dependants' dependency map | [
"convert",
"a",
"Node",
"to",
"a",
"sub",
"-",
"plan",
"updating",
"dependants",
"dependency",
"map"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/NodesUtil.java#L101-L132 |
22,918 | graknlabs/grakn | concept/printer/Printer.java | Printer.toStream | public Stream<String> toStream(Stream<?> objects) {
if (objects == null) return Stream.empty();
return objects.map(this::toString);
} | java | public Stream<String> toStream(Stream<?> objects) {
if (objects == null) return Stream.empty();
return objects.map(this::toString);
} | [
"public",
"Stream",
"<",
"String",
">",
"toStream",
"(",
"Stream",
"<",
"?",
">",
"objects",
")",
"{",
"if",
"(",
"objects",
"==",
"null",
")",
"return",
"Stream",
".",
"empty",
"(",
")",
";",
"return",
"objects",
".",
"map",
"(",
"this",
"::",
"to... | Convert a stream of objects into a stream of Strings to be printed
@param objects the objects to be printed
@return the stream of String print output for the object | [
"Convert",
"a",
"stream",
"of",
"objects",
"into",
"a",
"stream",
"of",
"Strings",
"to",
"be",
"printed"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/concept/printer/Printer.java#L64-L67 |
22,919 | graknlabs/grakn | concept/printer/Printer.java | Printer.build | @CheckReturnValue
protected Builder build(Object object) {
if (object instanceof Concept) {
return concept((Concept) object);
}
else if (object instanceof Boolean) {
return bool((boolean) object);
}
else if (object instanceof Collection) {
... | java | @CheckReturnValue
protected Builder build(Object object) {
if (object instanceof Concept) {
return concept((Concept) object);
}
else if (object instanceof Boolean) {
return bool((boolean) object);
}
else if (object instanceof Collection) {
... | [
"@",
"CheckReturnValue",
"protected",
"Builder",
"build",
"(",
"Object",
"object",
")",
"{",
"if",
"(",
"object",
"instanceof",
"Concept",
")",
"{",
"return",
"concept",
"(",
"(",
"Concept",
")",
"object",
")",
";",
"}",
"else",
"if",
"(",
"object",
"ins... | Convert any object into its print builder
@param object the object to convert into its print builder
@return the object as a builder | [
"Convert",
"any",
"object",
"into",
"its",
"print",
"builder"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/concept/printer/Printer.java#L87-L124 |
22,920 | graknlabs/grakn | server/src/graql/gremlin/spanningtree/datastructure/FibonacciHeap.java | FibonacciHeap.create | public static <T, C extends Comparable> FibonacciHeap<T, C> create() {
return FibonacciHeap.create(Ordering.<C>natural());
} | java | public static <T, C extends Comparable> FibonacciHeap<T, C> create() {
return FibonacciHeap.create(Ordering.<C>natural());
} | [
"public",
"static",
"<",
"T",
",",
"C",
"extends",
"Comparable",
">",
"FibonacciHeap",
"<",
"T",
",",
"C",
">",
"create",
"(",
")",
"{",
"return",
"FibonacciHeap",
".",
"create",
"(",
"Ordering",
".",
"<",
"C",
">",
"natural",
"(",
")",
")",
";",
"... | Create a new FibonacciHeap based on the natural ordering on `C` | [
"Create",
"a",
"new",
"FibonacciHeap",
"based",
"on",
"the",
"natural",
"ordering",
"on",
"C"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/spanningtree/datastructure/FibonacciHeap.java#L77-L79 |
22,921 | graknlabs/grakn | server/src/graql/gremlin/spanningtree/datastructure/FibonacciHeap.java | FibonacciHeap.siblingsAndBelow | private List<Entry> siblingsAndBelow(Entry oEntry) {
if (oEntry == null) return Collections.emptyList();
List<Entry> output = new LinkedList<>();
for (Entry entry : getCycle(oEntry)) {
if (entry != null) {
output.add(entry);
output.addAll(siblingsAndB... | java | private List<Entry> siblingsAndBelow(Entry oEntry) {
if (oEntry == null) return Collections.emptyList();
List<Entry> output = new LinkedList<>();
for (Entry entry : getCycle(oEntry)) {
if (entry != null) {
output.add(entry);
output.addAll(siblingsAndB... | [
"private",
"List",
"<",
"Entry",
">",
"siblingsAndBelow",
"(",
"Entry",
"oEntry",
")",
"{",
"if",
"(",
"oEntry",
"==",
"null",
")",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"List",
"<",
"Entry",
">",
"output",
"=",
"new",
"LinkedList",
... | Depth-first iteration | [
"Depth",
"-",
"first",
"iteration"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/spanningtree/datastructure/FibonacciHeap.java#L236-L248 |
22,922 | graknlabs/grakn | server/src/graql/gremlin/spanningtree/datastructure/FibonacciHeap.java | FibonacciHeap.mergeLists | private Entry mergeLists(Entry a, Entry b) {
if (a == null) return b;
if (b == null) return a;
// splice the two circular lists together like a Mobius strip
final Entry aOldNext = a.next;
a.next = b.next;
a.next.previous = a;
b.next = aOldNext;
b.next.pre... | java | private Entry mergeLists(Entry a, Entry b) {
if (a == null) return b;
if (b == null) return a;
// splice the two circular lists together like a Mobius strip
final Entry aOldNext = a.next;
a.next = b.next;
a.next.previous = a;
b.next = aOldNext;
b.next.pre... | [
"private",
"Entry",
"mergeLists",
"(",
"Entry",
"a",
",",
"Entry",
"b",
")",
"{",
"if",
"(",
"a",
"==",
"null",
")",
"return",
"b",
";",
"if",
"(",
"b",
"==",
"null",
")",
"return",
"a",
";",
"// splice the two circular lists together like a Mobius strip",
... | Merge two doubly-linked circular lists, given a pointer into each.
Return the smaller of the two arguments. | [
"Merge",
"two",
"doubly",
"-",
"linked",
"circular",
"lists",
"given",
"a",
"pointer",
"into",
"each",
".",
"Return",
"the",
"smaller",
"of",
"the",
"two",
"arguments",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/spanningtree/datastructure/FibonacciHeap.java#L266-L278 |
22,923 | graknlabs/grakn | server/src/graql/gremlin/spanningtree/datastructure/FibonacciHeap.java | FibonacciHeap.setParent | private Entry setParent(Entry entry, Entry parent) {
unlinkFromNeighbors(entry);
entry.oParent = parent;
parent.oFirstChild = mergeLists(entry, parent.oFirstChild);
parent.degree++;
entry.isMarked = false;
return parent;
} | java | private Entry setParent(Entry entry, Entry parent) {
unlinkFromNeighbors(entry);
entry.oParent = parent;
parent.oFirstChild = mergeLists(entry, parent.oFirstChild);
parent.degree++;
entry.isMarked = false;
return parent;
} | [
"private",
"Entry",
"setParent",
"(",
"Entry",
"entry",
",",
"Entry",
"parent",
")",
"{",
"unlinkFromNeighbors",
"(",
"entry",
")",
";",
"entry",
".",
"oParent",
"=",
"parent",
";",
"parent",
".",
"oFirstChild",
"=",
"mergeLists",
"(",
"entry",
",",
"paren... | Attaches `entry` as a child of `parent`. Returns `parent`. | [
"Attaches",
"entry",
"as",
"a",
"child",
"of",
"parent",
".",
"Returns",
"parent",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/spanningtree/datastructure/FibonacciHeap.java#L323-L331 |
22,924 | graknlabs/grakn | daemon/GraknDaemon.java | GraknDaemon.assertEnvironment | private static void assertEnvironment(Path graknHome, Path graknProperties) {
String javaVersion = System.getProperty("java.specification.version");
if (!javaVersion.equals("1.8")) {
throw new RuntimeException(ErrorMessage.UNSUPPORTED_JAVA_VERSION.getMessage(javaVersion));
}
... | java | private static void assertEnvironment(Path graknHome, Path graknProperties) {
String javaVersion = System.getProperty("java.specification.version");
if (!javaVersion.equals("1.8")) {
throw new RuntimeException(ErrorMessage.UNSUPPORTED_JAVA_VERSION.getMessage(javaVersion));
}
... | [
"private",
"static",
"void",
"assertEnvironment",
"(",
"Path",
"graknHome",
",",
"Path",
"graknProperties",
")",
"{",
"String",
"javaVersion",
"=",
"System",
".",
"getProperty",
"(",
"\"java.specification.version\"",
")",
";",
"if",
"(",
"!",
"javaVersion",
".",
... | Basic environment checks. Grakn should only be ran if users are running Java 8,
home folder can be detected, and the configuration file 'grakn.properties' exists.
@param graknHome path to $GRAKN_HOME
@param graknProperties path to the 'grakn.properties' file | [
"Basic",
"environment",
"checks",
".",
"Grakn",
"should",
"only",
"be",
"ran",
"if",
"users",
"are",
"running",
"Java",
"8",
"home",
"folder",
"can",
"be",
"detected",
"and",
"the",
"configuration",
"file",
"grakn",
".",
"properties",
"exists",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/daemon/GraknDaemon.java#L94-L105 |
22,925 | graknlabs/grakn | common/config/ConfigKey.java | ConfigKey.parse | public final T parse(String value, Path configFilePath) {
if (value == null) {
throw new RuntimeException(ErrorMessage.UNAVAILABLE_PROPERTY.getMessage(name(), configFilePath));
}
return parser().read(value);
} | java | public final T parse(String value, Path configFilePath) {
if (value == null) {
throw new RuntimeException(ErrorMessage.UNAVAILABLE_PROPERTY.getMessage(name(), configFilePath));
}
return parser().read(value);
} | [
"public",
"final",
"T",
"parse",
"(",
"String",
"value",
",",
"Path",
"configFilePath",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"ErrorMessage",
".",
"UNAVAILABLE_PROPERTY",
".",
"getMessage",
"(",
"name"... | Parse the value of a property.
This function should return an empty optional if the key was not present and there is no default value.
@param value the value of the property. Empty if the property isn't in the property file.
@param configFilePath path to the config file
@return the parsed value
@throws RuntimeExcept... | [
"Parse",
"the",
"value",
"of",
"a",
"property",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/common/config/ConfigKey.java#L94-L100 |
22,926 | graknlabs/grakn | common/config/ConfigKey.java | ConfigKey.key | public static <T> ConfigKey<T> key(String value, KeyParser<T> parser) {
return new AutoValue_ConfigKey<>(value, parser);
} | java | public static <T> ConfigKey<T> key(String value, KeyParser<T> parser) {
return new AutoValue_ConfigKey<>(value, parser);
} | [
"public",
"static",
"<",
"T",
">",
"ConfigKey",
"<",
"T",
">",
"key",
"(",
"String",
"value",
",",
"KeyParser",
"<",
"T",
">",
"parser",
")",
"{",
"return",
"new",
"AutoValue_ConfigKey",
"<>",
"(",
"value",
",",
"parser",
")",
";",
"}"
] | Create a key with the given parser | [
"Create",
"a",
"key",
"with",
"the",
"given",
"parser"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/common/config/ConfigKey.java#L119-L121 |
22,927 | graknlabs/grakn | server/src/graql/reasoner/query/ReasonerAtomicQuery.java | ReasonerAtomicQuery.materialise | public Stream<ConceptMap> materialise(ConceptMap answer) {
return this.withSubstitution(answer)
.getAtom()
.materialise()
.map(ans -> ans.explain(answer.explanation()));
} | java | public Stream<ConceptMap> materialise(ConceptMap answer) {
return this.withSubstitution(answer)
.getAtom()
.materialise()
.map(ans -> ans.explain(answer.explanation()));
} | [
"public",
"Stream",
"<",
"ConceptMap",
">",
"materialise",
"(",
"ConceptMap",
"answer",
")",
"{",
"return",
"this",
".",
"withSubstitution",
"(",
"answer",
")",
".",
"getAtom",
"(",
")",
".",
"materialise",
"(",
")",
".",
"map",
"(",
"ans",
"->",
"ans",
... | materialise this query with the accompanying answer - persist to kb
@param answer to be materialised
@return stream of materialised answers | [
"materialise",
"this",
"query",
"with",
"the",
"accompanying",
"answer",
"-",
"persist",
"to",
"kb"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/reasoner/query/ReasonerAtomicQuery.java#L184-L189 |
22,928 | graknlabs/grakn | server/src/server/session/cache/TransactionCache.java | TransactionCache.cacheConcept | public void cacheConcept(Concept concept) {
conceptCache.put(concept.id(), concept);
if (concept.isSchemaConcept()) {
SchemaConcept schemaConcept = concept.asSchemaConcept();
schemaConceptCache.put(schemaConcept.label(), schemaConcept);
labelCache.put(schemaConcept.la... | java | public void cacheConcept(Concept concept) {
conceptCache.put(concept.id(), concept);
if (concept.isSchemaConcept()) {
SchemaConcept schemaConcept = concept.asSchemaConcept();
schemaConceptCache.put(schemaConcept.label(), schemaConcept);
labelCache.put(schemaConcept.la... | [
"public",
"void",
"cacheConcept",
"(",
"Concept",
"concept",
")",
"{",
"conceptCache",
".",
"put",
"(",
"concept",
".",
"id",
"(",
")",
",",
"concept",
")",
";",
"if",
"(",
"concept",
".",
"isSchemaConcept",
"(",
")",
")",
"{",
"SchemaConcept",
"schemaCo... | Caches a concept so it does not have to be rebuilt later.
@param concept The concept to be cached. | [
"Caches",
"a",
"concept",
"so",
"it",
"does",
"not",
"have",
"to",
"be",
"rebuilt",
"later",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/session/cache/TransactionCache.java#L173-L180 |
22,929 | graknlabs/grakn | server/src/server/session/cache/TransactionCache.java | TransactionCache.getCachedConcept | public <X extends Concept> X getCachedConcept(ConceptId id) {
//noinspection unchecked
return (X) conceptCache.get(id);
} | java | public <X extends Concept> X getCachedConcept(ConceptId id) {
//noinspection unchecked
return (X) conceptCache.get(id);
} | [
"public",
"<",
"X",
"extends",
"Concept",
">",
"X",
"getCachedConcept",
"(",
"ConceptId",
"id",
")",
"{",
"//noinspection unchecked",
"return",
"(",
"X",
")",
"conceptCache",
".",
"get",
"(",
"id",
")",
";",
"}"
] | Returns a previously built concept
@param id The id of the concept
@param <X> The type of the concept
@return The cached concept | [
"Returns",
"a",
"previously",
"built",
"concept"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/session/cache/TransactionCache.java#L226-L229 |
22,930 | graknlabs/grakn | server/src/server/session/cache/TransactionCache.java | TransactionCache.getCachedSchemaConcept | public <X extends SchemaConcept> X getCachedSchemaConcept(Label label) {
//noinspection unchecked
return (X) schemaConceptCache.get(label);
} | java | public <X extends SchemaConcept> X getCachedSchemaConcept(Label label) {
//noinspection unchecked
return (X) schemaConceptCache.get(label);
} | [
"public",
"<",
"X",
"extends",
"SchemaConcept",
">",
"X",
"getCachedSchemaConcept",
"(",
"Label",
"label",
")",
"{",
"//noinspection unchecked",
"return",
"(",
"X",
")",
"schemaConceptCache",
".",
"get",
"(",
"label",
")",
";",
"}"
] | Returns a previously built type
@param label The label of the type
@param <X> The type of the type
@return The cached type | [
"Returns",
"a",
"previously",
"built",
"type"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/session/cache/TransactionCache.java#L248-L251 |
22,931 | graknlabs/grakn | server/src/graql/gremlin/TraversalPlanner.java | TraversalPlanner.createTraversal | public static GraqlTraversal createTraversal(Pattern pattern, TransactionOLTP tx) {
Collection<Conjunction<Statement>> patterns = pattern.getDisjunctiveNormalForm().getPatterns();
Set<? extends List<Fragment>> fragments = patterns.stream()
.map(conjunction -> new ConjunctionQuery(conjun... | java | public static GraqlTraversal createTraversal(Pattern pattern, TransactionOLTP tx) {
Collection<Conjunction<Statement>> patterns = pattern.getDisjunctiveNormalForm().getPatterns();
Set<? extends List<Fragment>> fragments = patterns.stream()
.map(conjunction -> new ConjunctionQuery(conjun... | [
"public",
"static",
"GraqlTraversal",
"createTraversal",
"(",
"Pattern",
"pattern",
",",
"TransactionOLTP",
"tx",
")",
"{",
"Collection",
"<",
"Conjunction",
"<",
"Statement",
">>",
"patterns",
"=",
"pattern",
".",
"getDisjunctiveNormalForm",
"(",
")",
".",
"getPa... | Create a traversal plan.
@param pattern a pattern to find a query plan for
@return a semi-optimal traversal plan | [
"Create",
"a",
"traversal",
"plan",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/TraversalPlanner.java#L77-L86 |
22,932 | graknlabs/grakn | server/src/graql/gremlin/TraversalPlanner.java | TraversalPlanner.planForConjunction | private static List<Fragment> planForConjunction(ConjunctionQuery query, TransactionOLTP tx) {
// a query plan is an ordered list of fragments
final List<Fragment> plan = new ArrayList<>();
// flatten all the possible fragments from the conjunction query (these become edges in the query graph)
... | java | private static List<Fragment> planForConjunction(ConjunctionQuery query, TransactionOLTP tx) {
// a query plan is an ordered list of fragments
final List<Fragment> plan = new ArrayList<>();
// flatten all the possible fragments from the conjunction query (these become edges in the query graph)
... | [
"private",
"static",
"List",
"<",
"Fragment",
">",
"planForConjunction",
"(",
"ConjunctionQuery",
"query",
",",
"TransactionOLTP",
"tx",
")",
"{",
"// a query plan is an ordered list of fragments",
"final",
"List",
"<",
"Fragment",
">",
"plan",
"=",
"new",
"ArrayList"... | Create a plan using Edmonds' algorithm with greedy approach to execute a single conjunction
@param query the conjunction query to find a traversal plan
@return a semi-optimal traversal plan to execute the given conjunction | [
"Create",
"a",
"plan",
"using",
"Edmonds",
"algorithm",
"with",
"greedy",
"approach",
"to",
"execute",
"a",
"single",
"conjunction"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/TraversalPlanner.java#L94-L143 |
22,933 | graknlabs/grakn | server/src/graql/gremlin/TraversalPlanner.java | TraversalPlanner.fragmentsForUnvisitedNodes | private static List<Fragment> fragmentsForUnvisitedNodes(Map<NodeId, Node> allNodes, Collection<Node> connectedNodes) {
List<Fragment> subplan = new LinkedList<>();
Set<Node> nodeWithFragment = connectedNodes.stream()
// make sure the fragment either has no dependency or dependencies ha... | java | private static List<Fragment> fragmentsForUnvisitedNodes(Map<NodeId, Node> allNodes, Collection<Node> connectedNodes) {
List<Fragment> subplan = new LinkedList<>();
Set<Node> nodeWithFragment = connectedNodes.stream()
// make sure the fragment either has no dependency or dependencies ha... | [
"private",
"static",
"List",
"<",
"Fragment",
">",
"fragmentsForUnvisitedNodes",
"(",
"Map",
"<",
"NodeId",
",",
"Node",
">",
"allNodes",
",",
"Collection",
"<",
"Node",
">",
"connectedNodes",
")",
"{",
"List",
"<",
"Fragment",
">",
"subplan",
"=",
"new",
... | add unvisited node fragments to plan | [
"add",
"unvisited",
"node",
"fragments",
"to",
"plan"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/TraversalPlanner.java#L232-L249 |
22,934 | graknlabs/grakn | server/src/graql/gremlin/TraversalPlanner.java | TraversalPlanner.getConnectedFragmentSets | private static Collection<Set<Fragment>> getConnectedFragmentSets(Set<Fragment> allFragments) {
// TODO this could be implemented in a more readable way (eg. using a graph + BFS etc.)
final Map<Integer, Set<Variable>> varSetMap = new HashMap<>();
final Map<Integer, Set<Fragment>> fragmentSetMap ... | java | private static Collection<Set<Fragment>> getConnectedFragmentSets(Set<Fragment> allFragments) {
// TODO this could be implemented in a more readable way (eg. using a graph + BFS etc.)
final Map<Integer, Set<Variable>> varSetMap = new HashMap<>();
final Map<Integer, Set<Fragment>> fragmentSetMap ... | [
"private",
"static",
"Collection",
"<",
"Set",
"<",
"Fragment",
">",
">",
"getConnectedFragmentSets",
"(",
"Set",
"<",
"Fragment",
">",
"allFragments",
")",
"{",
"// TODO this could be implemented in a more readable way (eg. using a graph + BFS etc.)",
"final",
"Map",
"<",
... | return a collection of set, in each set, all the fragments are connected | [
"return",
"a",
"collection",
"of",
"set",
"in",
"each",
"set",
"all",
"the",
"fragments",
"are",
"connected"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/TraversalPlanner.java#L252-L283 |
22,935 | graknlabs/grakn | server/src/graql/gremlin/TraversalPlanner.java | TraversalPlanner.updateFixedCostSubsReachableByIndex | private static void updateFixedCostSubsReachableByIndex(ImmutableMap<NodeId, Node> allNodes,
Map<Node, Double> nodesWithFixedCost,
Set<Fragment> fragments) {
Set<Fragment> validSubFragments =... | java | private static void updateFixedCostSubsReachableByIndex(ImmutableMap<NodeId, Node> allNodes,
Map<Node, Double> nodesWithFixedCost,
Set<Fragment> fragments) {
Set<Fragment> validSubFragments =... | [
"private",
"static",
"void",
"updateFixedCostSubsReachableByIndex",
"(",
"ImmutableMap",
"<",
"NodeId",
",",
"Node",
">",
"allNodes",
",",
"Map",
"<",
"Node",
",",
"Double",
">",
"nodesWithFixedCost",
",",
"Set",
"<",
"Fragment",
">",
"fragments",
")",
"{",
"S... | if in-sub starts from an indexed supertype, update the fragment cost of in-isa starting from the subtypes | [
"if",
"in",
"-",
"sub",
"starts",
"from",
"an",
"indexed",
"supertype",
"update",
"the",
"fragment",
"cost",
"of",
"in",
"-",
"isa",
"starting",
"from",
"the",
"subtypes"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/TraversalPlanner.java#L301-L325 |
22,936 | graknlabs/grakn | server/src/graql/gremlin/GraqlTraversal.java | GraqlTraversal.getGraphTraversal | @SuppressWarnings("unchecked")
public GraphTraversal<Vertex, Map<String, Element>> getGraphTraversal(TransactionOLTP tx, Set<Variable> vars) {
if (fragments().size() == 1) {
// If there are no disjunctions, we don't need to union them and get a performance boost
ImmutableList<Fragme... | java | @SuppressWarnings("unchecked")
public GraphTraversal<Vertex, Map<String, Element>> getGraphTraversal(TransactionOLTP tx, Set<Variable> vars) {
if (fragments().size() == 1) {
// If there are no disjunctions, we don't need to union them and get a performance boost
ImmutableList<Fragme... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"GraphTraversal",
"<",
"Vertex",
",",
"Map",
"<",
"String",
",",
"Element",
">",
">",
"getGraphTraversal",
"(",
"TransactionOLTP",
"tx",
",",
"Set",
"<",
"Variable",
">",
"vars",
")",
"{",
"if",
... | Because 'union' accepts an array, we can't use generics | [
"Because",
"union",
"accepts",
"an",
"array",
"we",
"can",
"t",
"use",
"generics"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/GraqlTraversal.java#L70-L88 |
22,937 | graknlabs/grakn | server/src/graql/gremlin/GraqlTraversal.java | GraqlTraversal.getComplexity | public double getComplexity() {
double totalCost = 0;
for (List<Fragment> list : fragments()) {
totalCost += fragmentListCost(list);
}
return totalCost;
} | java | public double getComplexity() {
double totalCost = 0;
for (List<Fragment> list : fragments()) {
totalCost += fragmentListCost(list);
}
return totalCost;
} | [
"public",
"double",
"getComplexity",
"(",
")",
"{",
"double",
"totalCost",
"=",
"0",
";",
"for",
"(",
"List",
"<",
"Fragment",
">",
"list",
":",
"fragments",
"(",
")",
")",
"{",
"totalCost",
"+=",
"fragmentListCost",
"(",
"list",
")",
";",
"}",
"return... | Get the estimated complexity of the traversal. | [
"Get",
"the",
"estimated",
"complexity",
"of",
"the",
"traversal",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/GraqlTraversal.java#L147-L156 |
22,938 | graknlabs/grakn | server/src/server/session/TransactionOLTP.java | TransactionOLTP.addVertexElementWithEdgeIdProperty | public VertexElement addVertexElementWithEdgeIdProperty(Schema.BaseType baseType, ConceptId conceptId) {
return executeLockingMethod(() -> factory().addVertexElementWithEdgeIdProperty(baseType, conceptId));
} | java | public VertexElement addVertexElementWithEdgeIdProperty(Schema.BaseType baseType, ConceptId conceptId) {
return executeLockingMethod(() -> factory().addVertexElementWithEdgeIdProperty(baseType, conceptId));
} | [
"public",
"VertexElement",
"addVertexElementWithEdgeIdProperty",
"(",
"Schema",
".",
"BaseType",
"baseType",
",",
"ConceptId",
"conceptId",
")",
"{",
"return",
"executeLockingMethod",
"(",
"(",
")",
"->",
"factory",
"(",
")",
".",
"addVertexElementWithEdgeIdProperty",
... | This is only used when reifying a Relation
@param baseType Concept BaseType which will become the VertexLabel
@param conceptId ConceptId to be set on the vertex
@return just created Vertex | [
"This",
"is",
"only",
"used",
"when",
"reifying",
"a",
"Relation"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/session/TransactionOLTP.java#L212-L214 |
22,939 | graknlabs/grakn | server/src/server/session/TransactionOLTP.java | TransactionOLTP.executeLockingMethod | private <X> X executeLockingMethod(Supplier<X> method) {
try {
return method.get();
} catch (JanusGraphException e) {
if (e.isCausedBy(TemporaryLockingException.class) || e.isCausedBy(PermanentLockingException.class)) {
throw TemporaryWriteException.temporaryLock(... | java | private <X> X executeLockingMethod(Supplier<X> method) {
try {
return method.get();
} catch (JanusGraphException e) {
if (e.isCausedBy(TemporaryLockingException.class) || e.isCausedBy(PermanentLockingException.class)) {
throw TemporaryWriteException.temporaryLock(... | [
"private",
"<",
"X",
">",
"X",
"executeLockingMethod",
"(",
"Supplier",
"<",
"X",
">",
"method",
")",
"{",
"try",
"{",
"return",
"method",
".",
"get",
"(",
")",
";",
"}",
"catch",
"(",
"JanusGraphException",
"e",
")",
"{",
"if",
"(",
"e",
".",
"isC... | Executes a method which has the potential to throw a TemporaryLockingException or a PermanentLockingException.
If the exception is thrown it is wrapped in a GraknServerException so that the transaction can be retried.
@param method The locking method to execute | [
"Executes",
"a",
"method",
"which",
"has",
"the",
"potential",
"to",
"throw",
"a",
"TemporaryLockingException",
"or",
"a",
"PermanentLockingException",
".",
"If",
"the",
"exception",
"is",
"thrown",
"it",
"is",
"wrapped",
"in",
"a",
"GraknServerException",
"so",
... | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/session/TransactionOLTP.java#L222-L232 |
22,940 | graknlabs/grakn | server/src/server/session/TransactionOLTP.java | TransactionOLTP.convertToId | public LabelId convertToId(Label label) {
if (transactionCache.isLabelCached(label)) {
return transactionCache.convertLabelToId(label);
}
return LabelId.invalid();
} | java | public LabelId convertToId(Label label) {
if (transactionCache.isLabelCached(label)) {
return transactionCache.convertLabelToId(label);
}
return LabelId.invalid();
} | [
"public",
"LabelId",
"convertToId",
"(",
"Label",
"label",
")",
"{",
"if",
"(",
"transactionCache",
".",
"isLabelCached",
"(",
"label",
")",
")",
"{",
"return",
"transactionCache",
".",
"convertLabelToId",
"(",
"label",
")",
";",
"}",
"return",
"LabelId",
".... | Converts a Type Label into a type Id for this specific graph. Mapping labels to ids will differ between graphs
so be sure to use the correct graph when performing the mapping.
@param label The label to be converted to the id
@return The matching type id | [
"Converts",
"a",
"Type",
"Label",
"into",
"a",
"type",
"Id",
"for",
"this",
"specific",
"graph",
".",
"Mapping",
"labels",
"to",
"ids",
"will",
"differ",
"between",
"graphs",
"so",
"be",
"sure",
"to",
"use",
"the",
"correct",
"graph",
"when",
"performing",... | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/session/TransactionOLTP.java#L321-L326 |
22,941 | graknlabs/grakn | server/src/server/session/TransactionOLTP.java | TransactionOLTP.getNextId | private LabelId getNextId() {
TypeImpl<?, ?> metaConcept = (TypeImpl<?, ?>) getMetaConcept();
Integer currentValue = metaConcept.vertex().property(Schema.VertexProperty.CURRENT_LABEL_ID);
if (currentValue == null) {
currentValue = Schema.MetaSchema.values().length + 1;
} else... | java | private LabelId getNextId() {
TypeImpl<?, ?> metaConcept = (TypeImpl<?, ?>) getMetaConcept();
Integer currentValue = metaConcept.vertex().property(Schema.VertexProperty.CURRENT_LABEL_ID);
if (currentValue == null) {
currentValue = Schema.MetaSchema.values().length + 1;
} else... | [
"private",
"LabelId",
"getNextId",
"(",
")",
"{",
"TypeImpl",
"<",
"?",
",",
"?",
">",
"metaConcept",
"=",
"(",
"TypeImpl",
"<",
"?",
",",
"?",
">",
")",
"getMetaConcept",
"(",
")",
";",
"Integer",
"currentValue",
"=",
"metaConcept",
".",
"vertex",
"("... | Gets and increments the current available type id.
@return the current available Grakn id which can be used for types | [
"Gets",
"and",
"increments",
"the",
"current",
"available",
"type",
"id",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/session/TransactionOLTP.java#L333-L344 |
22,942 | graknlabs/grakn | server/src/server/session/TransactionOLTP.java | TransactionOLTP.getTinkerTraversal | public GraphTraversalSource getTinkerTraversal() {
operateOnOpenGraph(() -> null); //This is to check if the graph is open
if (graphTraversalSource == null) {
graphTraversalSource = janusGraph.traversal().withStrategies(ReadOnlyStrategy.instance());
}
return graphTraversalSou... | java | public GraphTraversalSource getTinkerTraversal() {
operateOnOpenGraph(() -> null); //This is to check if the graph is open
if (graphTraversalSource == null) {
graphTraversalSource = janusGraph.traversal().withStrategies(ReadOnlyStrategy.instance());
}
return graphTraversalSou... | [
"public",
"GraphTraversalSource",
"getTinkerTraversal",
"(",
")",
"{",
"operateOnOpenGraph",
"(",
"(",
")",
"->",
"null",
")",
";",
"//This is to check if the graph is open",
"if",
"(",
"graphTraversalSource",
"==",
"null",
")",
"{",
"graphTraversalSource",
"=",
"janu... | Utility function to get a read-only Tinkerpop traversal.
@return A read-only Tinkerpop traversal for manually traversing the graph | [
"Utility",
"function",
"to",
"get",
"a",
"read",
"-",
"only",
"Tinkerpop",
"traversal",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/session/TransactionOLTP.java#L394-L400 |
22,943 | graknlabs/grakn | server/src/server/session/TransactionOLTP.java | TransactionOLTP.addTypeVertex | protected VertexElement addTypeVertex(LabelId id, Label label, Schema.BaseType baseType) {
VertexElement vertexElement = addVertexElement(baseType);
vertexElement.property(Schema.VertexProperty.SCHEMA_LABEL, label.getValue());
vertexElement.property(Schema.VertexProperty.LABEL_ID, id.getValue())... | java | protected VertexElement addTypeVertex(LabelId id, Label label, Schema.BaseType baseType) {
VertexElement vertexElement = addVertexElement(baseType);
vertexElement.property(Schema.VertexProperty.SCHEMA_LABEL, label.getValue());
vertexElement.property(Schema.VertexProperty.LABEL_ID, id.getValue())... | [
"protected",
"VertexElement",
"addTypeVertex",
"(",
"LabelId",
"id",
",",
"Label",
"label",
",",
"Schema",
".",
"BaseType",
"baseType",
")",
"{",
"VertexElement",
"vertexElement",
"=",
"addVertexElement",
"(",
"baseType",
")",
";",
"vertexElement",
".",
"property"... | Adds a new type vertex which occupies a grakn id. This result in the grakn id count on the meta concept to be
incremented.
@param label The label of the new type vertex
@param baseType The base type of the new type
@return The new type vertex | [
"Adds",
"a",
"new",
"type",
"vertex",
"which",
"occupies",
"a",
"grakn",
"id",
".",
"This",
"result",
"in",
"the",
"grakn",
"id",
"count",
"on",
"the",
"meta",
"concept",
"to",
"be",
"incremented",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/session/TransactionOLTP.java#L463-L468 |
22,944 | graknlabs/grakn | server/src/server/session/TransactionOLTP.java | TransactionOLTP.operateOnOpenGraph | private <X> X operateOnOpenGraph(Supplier<X> supplier) {
if (!isLocal() || isClosed()) throw TransactionException.transactionClosed(this, this.closedReason);
return supplier.get();
} | java | private <X> X operateOnOpenGraph(Supplier<X> supplier) {
if (!isLocal() || isClosed()) throw TransactionException.transactionClosed(this, this.closedReason);
return supplier.get();
} | [
"private",
"<",
"X",
">",
"X",
"operateOnOpenGraph",
"(",
"Supplier",
"<",
"X",
">",
"supplier",
")",
"{",
"if",
"(",
"!",
"isLocal",
"(",
")",
"||",
"isClosed",
"(",
")",
")",
"throw",
"TransactionException",
".",
"transactionClosed",
"(",
"this",
",",
... | An operation on the graph which requires it to be open.
@param supplier The operation to be performed on the graph
@return The result of the operation on the graph.
@throws TransactionException if the graph is closed. | [
"An",
"operation",
"on",
"the",
"graph",
"which",
"requires",
"it",
"to",
"be",
"open",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/session/TransactionOLTP.java#L477-L480 |
22,945 | graknlabs/grakn | server/src/server/session/TransactionOLTP.java | TransactionOLTP.labelTaken | private TransactionException labelTaken(SchemaConcept schemaConcept) {
if (Schema.MetaSchema.isMetaLabel(schemaConcept.label())) {
return TransactionException.reservedLabel(schemaConcept.label());
}
return PropertyNotUniqueException.cannotCreateProperty(schemaConcept, Schema.VertexPr... | java | private TransactionException labelTaken(SchemaConcept schemaConcept) {
if (Schema.MetaSchema.isMetaLabel(schemaConcept.label())) {
return TransactionException.reservedLabel(schemaConcept.label());
}
return PropertyNotUniqueException.cannotCreateProperty(schemaConcept, Schema.VertexPr... | [
"private",
"TransactionException",
"labelTaken",
"(",
"SchemaConcept",
"schemaConcept",
")",
"{",
"if",
"(",
"Schema",
".",
"MetaSchema",
".",
"isMetaLabel",
"(",
"schemaConcept",
".",
"label",
"(",
")",
")",
")",
"{",
"return",
"TransactionException",
".",
"res... | Throws an exception when adding a SchemaConcept using a Label which is already taken | [
"Throws",
"an",
"exception",
"when",
"adding",
"a",
"SchemaConcept",
"using",
"a",
"Label",
"which",
"is",
"already",
"taken"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/session/TransactionOLTP.java#L544-L549 |
22,946 | graknlabs/grakn | server/src/server/session/TransactionOLTP.java | TransactionOLTP.commit | @Override
public void commit() throws InvalidKBException {
if (isClosed()) {
return;
}
try {
checkMutationAllowed();
removeInferredConcepts();
validateGraph();
// lock on the keyspace cache shared between concurrent tx's to the same... | java | @Override
public void commit() throws InvalidKBException {
if (isClosed()) {
return;
}
try {
checkMutationAllowed();
removeInferredConcepts();
validateGraph();
// lock on the keyspace cache shared between concurrent tx's to the same... | [
"@",
"Override",
"public",
"void",
"commit",
"(",
")",
"throws",
"InvalidKBException",
"{",
"if",
"(",
"isClosed",
"(",
")",
")",
"{",
"return",
";",
"}",
"try",
"{",
"checkMutationAllowed",
"(",
")",
";",
"removeInferredConcepts",
"(",
")",
";",
"validate... | Commits and closes the transaction without returning CommitLog
@throws InvalidKBException | [
"Commits",
"and",
"closes",
"the",
"transaction",
"without",
"returning",
"CommitLog"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/session/TransactionOLTP.java#L832-L851 |
22,947 | graknlabs/grakn | server/src/server/session/TransactionOLTP.java | TransactionOLTP.commitAndGetLogs | public Optional<CommitLog> commitAndGetLogs() throws InvalidKBException {
if (isClosed()) {
return Optional.empty();
}
try {
return commitWithLogs();
} finally {
String closeMessage = ErrorMessage.TX_CLOSED_ON_ACTION.getMessage("committed", keyspace())... | java | public Optional<CommitLog> commitAndGetLogs() throws InvalidKBException {
if (isClosed()) {
return Optional.empty();
}
try {
return commitWithLogs();
} finally {
String closeMessage = ErrorMessage.TX_CLOSED_ON_ACTION.getMessage("committed", keyspace())... | [
"public",
"Optional",
"<",
"CommitLog",
">",
"commitAndGetLogs",
"(",
")",
"throws",
"InvalidKBException",
"{",
"if",
"(",
"isClosed",
"(",
")",
")",
"{",
"return",
"Optional",
".",
"empty",
"(",
")",
";",
"}",
"try",
"{",
"return",
"commitWithLogs",
"(",
... | Commits, closes transaction and returns CommitLog.
@return the commit log that would have been submitted if it is needed.
@throws InvalidKBException when the graph does not conform to the object concept | [
"Commits",
"closes",
"transaction",
"and",
"returns",
"CommitLog",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/session/TransactionOLTP.java#L859-L869 |
22,948 | graknlabs/grakn | server/src/server/session/TransactionOLTP.java | TransactionOLTP.shard | public void shard(ConceptId conceptId) {
ConceptImpl type = getConcept(conceptId);
if (type == null) {
LOG.warn("Cannot shard concept [" + conceptId + "] due to it not existing in the graph");
} else {
type.createShard();
}
} | java | public void shard(ConceptId conceptId) {
ConceptImpl type = getConcept(conceptId);
if (type == null) {
LOG.warn("Cannot shard concept [" + conceptId + "] due to it not existing in the graph");
} else {
type.createShard();
}
} | [
"public",
"void",
"shard",
"(",
"ConceptId",
"conceptId",
")",
"{",
"ConceptImpl",
"type",
"=",
"getConcept",
"(",
"conceptId",
")",
";",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"Cannot shard concept [\"",
"+",
"conceptId",
"+... | Creates a new shard for the concept
@param conceptId the id of the concept to shard | [
"Creates",
"a",
"new",
"shard",
"for",
"the",
"concept"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/session/TransactionOLTP.java#L946-L953 |
22,949 | graknlabs/grakn | server/src/server/session/TransactionOLTP.java | TransactionOLTP.getShardCount | public long getShardCount(grakn.core.concept.type.Type concept) {
return TypeImpl.from(concept).shardCount();
} | java | public long getShardCount(grakn.core.concept.type.Type concept) {
return TypeImpl.from(concept).shardCount();
} | [
"public",
"long",
"getShardCount",
"(",
"grakn",
".",
"core",
".",
"concept",
".",
"type",
".",
"Type",
"concept",
")",
"{",
"return",
"TypeImpl",
".",
"from",
"(",
"concept",
")",
".",
"shardCount",
"(",
")",
";",
"}"
] | Returns the current number of shards the provided grakn.core.concept.type.Type has. This is used in creating more
efficient query plans.
@param concept The grakn.core.concept.type.Type which may contain some shards.
@return the number of Shards the grakn.core.concept.type.Type currently has. | [
"Returns",
"the",
"current",
"number",
"of",
"shards",
"the",
"provided",
"grakn",
".",
"core",
".",
"concept",
".",
"type",
".",
"Type",
"has",
".",
"This",
"is",
"used",
"in",
"creating",
"more",
"efficient",
"query",
"plans",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/session/TransactionOLTP.java#L962-L964 |
22,950 | graknlabs/grakn | server/src/server/session/SessionFactory.java | SessionFactory.session | public SessionImpl session(KeyspaceImpl keyspace) {
JanusGraph graph;
KeyspaceCache cache;
KeyspaceCacheContainer cacheContainer;
ReadWriteLock graphLock;
Lock lock = lockManager.getLock(getLockingKey(keyspace));
lock.lock();
try {
// If keyspace ref... | java | public SessionImpl session(KeyspaceImpl keyspace) {
JanusGraph graph;
KeyspaceCache cache;
KeyspaceCacheContainer cacheContainer;
ReadWriteLock graphLock;
Lock lock = lockManager.getLock(getLockingKey(keyspace));
lock.lock();
try {
// If keyspace ref... | [
"public",
"SessionImpl",
"session",
"(",
"KeyspaceImpl",
"keyspace",
")",
"{",
"JanusGraph",
"graph",
";",
"KeyspaceCache",
"cache",
";",
"KeyspaceCacheContainer",
"cacheContainer",
";",
"ReadWriteLock",
"graphLock",
";",
"Lock",
"lock",
"=",
"lockManager",
".",
"ge... | Retrieves the Session needed to open the Transaction.
This will open a new one Session if it hasn't been opened before
@param keyspace The keyspace of the Session to retrieve
@return a new Session connecting to the provided keyspace | [
"Retrieves",
"the",
"Session",
"needed",
"to",
"open",
"the",
"Transaction",
".",
"This",
"will",
"open",
"a",
"new",
"one",
"Session",
"if",
"it",
"hasn",
"t",
"been",
"opened",
"before"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/session/SessionFactory.java#L64-L95 |
22,951 | graknlabs/grakn | server/src/server/session/SessionFactory.java | SessionFactory.deleteKeyspace | public void deleteKeyspace(KeyspaceImpl keyspace) {
Lock lock = lockManager.getLock(getLockingKey(keyspace));
lock.lock();
try {
if (keyspaceCacheMap.containsKey(keyspace)) {
KeyspaceCacheContainer container = keyspaceCacheMap.remove(keyspace);
contain... | java | public void deleteKeyspace(KeyspaceImpl keyspace) {
Lock lock = lockManager.getLock(getLockingKey(keyspace));
lock.lock();
try {
if (keyspaceCacheMap.containsKey(keyspace)) {
KeyspaceCacheContainer container = keyspaceCacheMap.remove(keyspace);
contain... | [
"public",
"void",
"deleteKeyspace",
"(",
"KeyspaceImpl",
"keyspace",
")",
"{",
"Lock",
"lock",
"=",
"lockManager",
".",
"getLock",
"(",
"getLockingKey",
"(",
"keyspace",
")",
")",
";",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"keyspaceC... | Invoked when user deletes a keyspace.
Remove keyspace reference from internal cache, closes graph associated to it and
invalidates all the open sessions.
@param keyspace keyspace that is being deleted | [
"Invoked",
"when",
"user",
"deletes",
"a",
"keyspace",
".",
"Remove",
"keyspace",
"reference",
"from",
"internal",
"cache",
"closes",
"graph",
"associated",
"to",
"it",
"and",
"invalidates",
"all",
"the",
"open",
"sessions",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/session/SessionFactory.java#L104-L116 |
22,952 | graknlabs/grakn | server/src/server/session/SessionFactory.java | SessionFactory.onSessionClose | protected void onSessionClose(SessionImpl session) {
Lock lock = lockManager.getLock(getLockingKey(session.keyspace()));
lock.lock();
try {
if (keyspaceCacheMap.containsKey(session.keyspace())) {
KeyspaceCacheContainer cacheContainer = keyspaceCacheMap.get(session.key... | java | protected void onSessionClose(SessionImpl session) {
Lock lock = lockManager.getLock(getLockingKey(session.keyspace()));
lock.lock();
try {
if (keyspaceCacheMap.containsKey(session.keyspace())) {
KeyspaceCacheContainer cacheContainer = keyspaceCacheMap.get(session.key... | [
"protected",
"void",
"onSessionClose",
"(",
"SessionImpl",
"session",
")",
"{",
"Lock",
"lock",
"=",
"lockManager",
".",
"getLock",
"(",
"getLockingKey",
"(",
"session",
".",
"keyspace",
"(",
")",
")",
")",
";",
"lock",
".",
"lock",
"(",
")",
";",
"try",... | Callback function invoked by Session when it gets closed.
This access the keyspaceCacheMap to remove the reference of closed session.
@param session SessionImpl that is being closed | [
"Callback",
"function",
"invoked",
"by",
"Session",
"when",
"it",
"gets",
"closed",
".",
"This",
"access",
"the",
"keyspaceCacheMap",
"to",
"remove",
"the",
"reference",
"of",
"closed",
"session",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/session/SessionFactory.java#L125-L143 |
22,953 | graknlabs/grakn | server/src/server/kb/ValidateGlobalRules.java | ValidateGlobalRules.validatePlaysAndRelatesStructure | static Set<String> validatePlaysAndRelatesStructure(Casting casting) {
Set<String> errors = new HashSet<>();
//Gets here to make sure we traverse/read only once
Thing thing = casting.getRolePlayer();
Role role = casting.getRole();
Relation relation = casting.getRelation();
... | java | static Set<String> validatePlaysAndRelatesStructure(Casting casting) {
Set<String> errors = new HashSet<>();
//Gets here to make sure we traverse/read only once
Thing thing = casting.getRolePlayer();
Role role = casting.getRole();
Relation relation = casting.getRelation();
... | [
"static",
"Set",
"<",
"String",
">",
"validatePlaysAndRelatesStructure",
"(",
"Casting",
"casting",
")",
"{",
"Set",
"<",
"String",
">",
"errors",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"//Gets here to make sure we traverse/read only once",
"Thing",
"thing",
... | This method checks if the plays edge has been added between the roleplayer's Type and
the Role being played.
It also checks if the Role of the Casting has been linked to the RelationType of the
Relation which the Casting connects to.
@return Specific errors if any are found | [
"This",
"method",
"checks",
"if",
"the",
"plays",
"edge",
"has",
"been",
"added",
"between",
"the",
"roleplayer",
"s",
"Type",
"and",
"the",
"Role",
"being",
"played",
".",
"It",
"also",
"checks",
"if",
"the",
"Role",
"of",
"the",
"Casting",
"has",
"been... | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/ValidateGlobalRules.java#L99-L112 |
22,954 | graknlabs/grakn | server/src/server/kb/ValidateGlobalRules.java | ValidateGlobalRules.roleNotLinkedToRelation | private static Optional<String> roleNotLinkedToRelation(Role role, RelationType relationType, Relation relation) {
boolean notFound = role.relations().
noneMatch(innerRelationType -> innerRelationType.label().equals(relationType.label()));
if (notFound) {
return Optional.of(V... | java | private static Optional<String> roleNotLinkedToRelation(Role role, RelationType relationType, Relation relation) {
boolean notFound = role.relations().
noneMatch(innerRelationType -> innerRelationType.label().equals(relationType.label()));
if (notFound) {
return Optional.of(V... | [
"private",
"static",
"Optional",
"<",
"String",
">",
"roleNotLinkedToRelation",
"(",
"Role",
"role",
",",
"RelationType",
"relationType",
",",
"Relation",
"relation",
")",
"{",
"boolean",
"notFound",
"=",
"role",
".",
"relations",
"(",
")",
".",
"noneMatch",
"... | Checks if the Role of the Casting has been linked to the RelationType of
the Relation which the Casting connects to.
@param role the Role which the Casting refers to
@param relationType the RelationType which should connect to the role
@param relation the Relation which the Casting refers to
@return an... | [
"Checks",
"if",
"the",
"Role",
"of",
"the",
"Casting",
"has",
"been",
"linked",
"to",
"the",
"RelationType",
"of",
"the",
"Relation",
"which",
"the",
"Casting",
"connects",
"to",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/ValidateGlobalRules.java#L123-L130 |
22,955 | graknlabs/grakn | server/src/server/kb/ValidateGlobalRules.java | ValidateGlobalRules.roleNotAllowedToBePlayed | private static Optional<String> roleNotAllowedToBePlayed(Role role, Thing thing) {
TypeImpl<?, ?> currentConcept = (TypeImpl<?, ?>) thing.type();
boolean satisfiesPlays = false;
while (currentConcept != null) {
Map<Role, Boolean> plays = currentConcept.directPlays();
fo... | java | private static Optional<String> roleNotAllowedToBePlayed(Role role, Thing thing) {
TypeImpl<?, ?> currentConcept = (TypeImpl<?, ?>) thing.type();
boolean satisfiesPlays = false;
while (currentConcept != null) {
Map<Role, Boolean> plays = currentConcept.directPlays();
fo... | [
"private",
"static",
"Optional",
"<",
"String",
">",
"roleNotAllowedToBePlayed",
"(",
"Role",
"role",
",",
"Thing",
"thing",
")",
"{",
"TypeImpl",
"<",
"?",
",",
"?",
">",
"currentConcept",
"=",
"(",
"TypeImpl",
"<",
"?",
",",
"?",
">",
")",
"thing",
"... | Checks if the plays edge has been added between the roleplayer's Type and
the Role being played.
Also checks that required Role are satisfied
@param role The Role which the role-player is playing
@param thing the role-player
@return an error if one is found | [
"Checks",
"if",
"the",
"plays",
"edge",
"has",
"been",
"added",
"between",
"the",
"roleplayer",
"s",
"Type",
"and",
"the",
"Role",
"being",
"played",
".",
"Also",
"checks",
"that",
"required",
"Role",
"are",
"satisfied"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/ValidateGlobalRules.java#L141-L168 |
22,956 | graknlabs/grakn | server/src/server/kb/ValidateGlobalRules.java | ValidateGlobalRules.validateRelationHasRolePlayers | static Optional<String> validateRelationHasRolePlayers(Relation relation) {
if (!relation.rolePlayers().findAny().isPresent()) {
return Optional.of(ErrorMessage.VALIDATION_RELATION_WITH_NO_ROLE_PLAYERS.getMessage(relation.id(), relation.type().label()));
}
return Optional.empty();
... | java | static Optional<String> validateRelationHasRolePlayers(Relation relation) {
if (!relation.rolePlayers().findAny().isPresent()) {
return Optional.of(ErrorMessage.VALIDATION_RELATION_WITH_NO_ROLE_PLAYERS.getMessage(relation.id(), relation.type().label()));
}
return Optional.empty();
... | [
"static",
"Optional",
"<",
"String",
">",
"validateRelationHasRolePlayers",
"(",
"Relation",
"relation",
")",
"{",
"if",
"(",
"!",
"relation",
".",
"rolePlayers",
"(",
")",
".",
"findAny",
"(",
")",
".",
"isPresent",
"(",
")",
")",
"{",
"return",
"Optional... | Checks if a Relation has at least one role player.
@param relation The Relation to check | [
"Checks",
"if",
"a",
"Relation",
"has",
"at",
"least",
"one",
"role",
"player",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/ValidateGlobalRules.java#L424-L429 |
22,957 | graknlabs/grakn | server/src/graql/reasoner/atom/Atom.java | Atom.rewriteWithTypeVariable | public Atom rewriteWithTypeVariable(Atom parentAtom) {
if (parentAtom.getPredicateVariable().isReturned()
&& !this.getPredicateVariable().isReturned()
&& this.getClass() == parentAtom.getClass()) {
return rewriteWithTypeVariable();
}
return this;
} | java | public Atom rewriteWithTypeVariable(Atom parentAtom) {
if (parentAtom.getPredicateVariable().isReturned()
&& !this.getPredicateVariable().isReturned()
&& this.getClass() == parentAtom.getClass()) {
return rewriteWithTypeVariable();
}
return this;
} | [
"public",
"Atom",
"rewriteWithTypeVariable",
"(",
"Atom",
"parentAtom",
")",
"{",
"if",
"(",
"parentAtom",
".",
"getPredicateVariable",
"(",
")",
".",
"isReturned",
"(",
")",
"&&",
"!",
"this",
".",
"getPredicateVariable",
"(",
")",
".",
"isReturned",
"(",
"... | rewrites the atom to user-defined type variable
@param parentAtom parent atom that triggers rewrite
@return rewritten atom | [
"rewrites",
"the",
"atom",
"to",
"user",
"-",
"defined",
"type",
"variable"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/reasoner/atom/Atom.java#L373-L380 |
22,958 | graknlabs/grakn | server/src/server/kb/concept/RelationImpl.java | RelationImpl.reify | private RelationReified reify() {
if (relationStructure.isReified()) return relationStructure.reify();
//Get the role players to transfer
Map<Role, Set<Thing>> rolePlayers = structure().allRolePlayers();
//Now Reify
relationStructure = relationStructure.reify();
//Tran... | java | private RelationReified reify() {
if (relationStructure.isReified()) return relationStructure.reify();
//Get the role players to transfer
Map<Role, Set<Thing>> rolePlayers = structure().allRolePlayers();
//Now Reify
relationStructure = relationStructure.reify();
//Tran... | [
"private",
"RelationReified",
"reify",
"(",
")",
"{",
"if",
"(",
"relationStructure",
".",
"isReified",
"(",
")",
")",
"return",
"relationStructure",
".",
"reify",
"(",
")",
";",
"//Get the role players to transfer",
"Map",
"<",
"Role",
",",
"Set",
"<",
"Thing... | Reifys and returns the RelationReified | [
"Reifys",
"and",
"returns",
"the",
"RelationReified"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/RelationImpl.java#L74-L90 |
22,959 | graknlabs/grakn | server/src/server/kb/concept/RelationImpl.java | RelationImpl.readFromReified | private <X> Stream<X> readFromReified(Function<RelationReified, Stream<X>> producer) {
return reified().map(producer).orElseGet(Stream::empty);
} | java | private <X> Stream<X> readFromReified(Function<RelationReified, Stream<X>> producer) {
return reified().map(producer).orElseGet(Stream::empty);
} | [
"private",
"<",
"X",
">",
"Stream",
"<",
"X",
">",
"readFromReified",
"(",
"Function",
"<",
"RelationReified",
",",
"Stream",
"<",
"X",
">",
">",
"producer",
")",
"{",
"return",
"reified",
"(",
")",
".",
"map",
"(",
"producer",
")",
".",
"orElseGet",
... | Reads some data from a RelationReified. If the Relation has not been reified then an empty
Stream is returned. | [
"Reads",
"some",
"data",
"from",
"a",
"RelationReified",
".",
"If",
"the",
"Relation",
"has",
"not",
"been",
"reified",
"then",
"an",
"empty",
"Stream",
"is",
"returned",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/RelationImpl.java#L136-L138 |
22,960 | graknlabs/grakn | server/src/server/kb/concept/RelationImpl.java | RelationImpl.assign | @Override
public Relation assign(Role role, Thing player) {
reify().addRolePlayer(role, player);
return this;
} | java | @Override
public Relation assign(Role role, Thing player) {
reify().addRolePlayer(role, player);
return this;
} | [
"@",
"Override",
"public",
"Relation",
"assign",
"(",
"Role",
"role",
",",
"Thing",
"player",
")",
"{",
"reify",
"(",
")",
".",
"addRolePlayer",
"(",
"role",
",",
"player",
")",
";",
"return",
"this",
";",
"}"
] | Expands this Relation to include a new role player which is playing a specific Role.
@param role The role of the new role player.
@param player The new role player.
@return The Relation itself | [
"Expands",
"this",
"Relation",
"to",
"include",
"a",
"new",
"role",
"player",
"which",
"is",
"playing",
"a",
"specific",
"Role",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/RelationImpl.java#L163-L167 |
22,961 | graknlabs/grakn | server/src/server/kb/concept/RelationImpl.java | RelationImpl.cleanUp | void cleanUp() {
Stream<Thing> rolePlayers = rolePlayers();
boolean performDeletion = rolePlayers.noneMatch(thing -> thing != null && thing.id() != null);
if (performDeletion) delete();
} | java | void cleanUp() {
Stream<Thing> rolePlayers = rolePlayers();
boolean performDeletion = rolePlayers.noneMatch(thing -> thing != null && thing.id() != null);
if (performDeletion) delete();
} | [
"void",
"cleanUp",
"(",
")",
"{",
"Stream",
"<",
"Thing",
">",
"rolePlayers",
"=",
"rolePlayers",
"(",
")",
";",
"boolean",
"performDeletion",
"=",
"rolePlayers",
".",
"noneMatch",
"(",
"thing",
"->",
"thing",
"!=",
"null",
"&&",
"thing",
".",
"id",
"(",... | When a relation is deleted this cleans up any solitary casting and resources. | [
"When",
"a",
"relation",
"is",
"deleted",
"this",
"cleans",
"up",
"any",
"solitary",
"casting",
"and",
"resources",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/RelationImpl.java#L188-L192 |
22,962 | graknlabs/grakn | server/src/server/kb/concept/SchemaConceptImpl.java | SchemaConceptImpl.delete | @Override
public void delete() {
if (deletionAllowed()) {
//Force load of linked concepts whose caches need to be updated
T superConcept = cachedSuperType.get();
deleteNode();
//Update neighbouring caches
SchemaConceptImpl.from(superConcept).dele... | java | @Override
public void delete() {
if (deletionAllowed()) {
//Force load of linked concepts whose caches need to be updated
T superConcept = cachedSuperType.get();
deleteNode();
//Update neighbouring caches
SchemaConceptImpl.from(superConcept).dele... | [
"@",
"Override",
"public",
"void",
"delete",
"(",
")",
"{",
"if",
"(",
"deletionAllowed",
"(",
")",
")",
"{",
"//Force load of linked concepts whose caches need to be updated",
"T",
"superConcept",
"=",
"cachedSuperType",
".",
"get",
"(",
")",
";",
"deleteNode",
"... | Deletes the concept as a SchemaConcept | [
"Deletes",
"the",
"concept",
"as",
"a",
"SchemaConcept"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/SchemaConceptImpl.java#L131-L147 |
22,963 | graknlabs/grakn | server/src/graql/reasoner/plan/ResolutionQueryPlan.java | ResolutionQueryPlan.queryPlan | private static ImmutableList<ReasonerQueryImpl> queryPlan(ReasonerQueryImpl query){
ResolutionPlan resolutionPlan = query.resolutionPlan();
ImmutableList<Atom> plan = resolutionPlan.plan();
TransactionOLTP tx = query.tx();
LinkedList<Atom> atoms = new LinkedList<>(plan);
List<Re... | java | private static ImmutableList<ReasonerQueryImpl> queryPlan(ReasonerQueryImpl query){
ResolutionPlan resolutionPlan = query.resolutionPlan();
ImmutableList<Atom> plan = resolutionPlan.plan();
TransactionOLTP tx = query.tx();
LinkedList<Atom> atoms = new LinkedList<>(plan);
List<Re... | [
"private",
"static",
"ImmutableList",
"<",
"ReasonerQueryImpl",
">",
"queryPlan",
"(",
"ReasonerQueryImpl",
"query",
")",
"{",
"ResolutionPlan",
"resolutionPlan",
"=",
"query",
".",
"resolutionPlan",
"(",
")",
";",
"ImmutableList",
"<",
"Atom",
">",
"plan",
"=",
... | compute the query resolution plan - list of queries ordered by their cost as computed by the graql traversal planner
@return list of prioritised queries | [
"compute",
"the",
"query",
"resolution",
"plan",
"-",
"list",
"of",
"queries",
"ordered",
"by",
"their",
"cost",
"as",
"computed",
"by",
"the",
"graql",
"traversal",
"planner"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/reasoner/plan/ResolutionQueryPlan.java#L66-L91 |
22,964 | graknlabs/grakn | server/src/server/kb/concept/ConceptUtils.java | ConceptUtils.areDisjointTypes | public static boolean areDisjointTypes(SchemaConcept parent, SchemaConcept child, boolean direct) {
return parent != null && child == null || !typesCompatible(parent, child, direct) && !typesCompatible(child, parent, direct);
} | java | public static boolean areDisjointTypes(SchemaConcept parent, SchemaConcept child, boolean direct) {
return parent != null && child == null || !typesCompatible(parent, child, direct) && !typesCompatible(child, parent, direct);
} | [
"public",
"static",
"boolean",
"areDisjointTypes",
"(",
"SchemaConcept",
"parent",
",",
"SchemaConcept",
"child",
",",
"boolean",
"direct",
")",
"{",
"return",
"parent",
"!=",
"null",
"&&",
"child",
"==",
"null",
"||",
"!",
"typesCompatible",
"(",
"parent",
",... | determines disjointness of parent-child types, parent defines the bound on the child
@param parent {@link SchemaConcept}
@param child {@link SchemaConcept}
@return true if types do not belong to the same type hierarchy, also true if parent is null and false if parent non-null and child null | [
"determines",
"disjointness",
"of",
"parent",
"-",
"child",
"types",
"parent",
"defines",
"the",
"bound",
"on",
"the",
"child"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/ConceptUtils.java#L108-L110 |
22,965 | graknlabs/grakn | server/src/graql/reasoner/utils/TarjanSCC.java | TarjanSCC.getCycles | public List<Set<T>> getCycles() {
return scc.stream().filter(cc ->
cc.size() > 1
|| graph.get(Iterables.getOnlyElement(cc)).contains(Iterables.getOnlyElement(cc))
)
.collect(Collectors.toList());
} | java | public List<Set<T>> getCycles() {
return scc.stream().filter(cc ->
cc.size() > 1
|| graph.get(Iterables.getOnlyElement(cc)).contains(Iterables.getOnlyElement(cc))
)
.collect(Collectors.toList());
} | [
"public",
"List",
"<",
"Set",
"<",
"T",
">",
">",
"getCycles",
"(",
")",
"{",
"return",
"scc",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"cc",
"->",
"cc",
".",
"size",
"(",
")",
">",
"1",
"||",
"graph",
".",
"get",
"(",
"Iterables",
".",
"... | A cycle isa a connected component that has more than one vertex or a single vertex linked to itself.
@return list of cycles in the graph | [
"A",
"cycle",
"isa",
"a",
"connected",
"component",
"that",
"has",
"more",
"than",
"one",
"vertex",
"or",
"a",
"single",
"vertex",
"linked",
"to",
"itself",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/reasoner/utils/TarjanSCC.java#L64-L70 |
22,966 | graknlabs/grakn | server/src/server/kb/concept/ThingImpl.java | ThingImpl.delete | @Override
public void delete() {
//Remove links to relations and return them
Set<Relation> relations = castingsInstance().map(casting -> {
Relation relation = casting.getRelation();
Role role = casting.getRole();
relation.unassign(role, this);
return r... | java | @Override
public void delete() {
//Remove links to relations and return them
Set<Relation> relations = castingsInstance().map(casting -> {
Relation relation = casting.getRelation();
Role role = casting.getRole();
relation.unassign(role, this);
return r... | [
"@",
"Override",
"public",
"void",
"delete",
"(",
")",
"{",
"//Remove links to relations and return them",
"Set",
"<",
"Relation",
">",
"relations",
"=",
"castingsInstance",
"(",
")",
".",
"map",
"(",
"casting",
"->",
"{",
"Relation",
"relation",
"=",
"casting",... | Deletes the concept as an Thing | [
"Deletes",
"the",
"concept",
"as",
"an",
"Thing"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/ThingImpl.java#L106-L127 |
22,967 | graknlabs/grakn | server/src/server/kb/concept/ThingImpl.java | ThingImpl.attributes | private <X extends Concept> Stream<Attribute<?>> attributes(Stream<X> conceptStream, Set<ConceptId> attributeTypesIds) {
Stream<Attribute<?>> attributeStream = conceptStream.
filter(concept -> concept.isAttribute() && !this.equals(concept)).
map(Concept::asAttribute);
if... | java | private <X extends Concept> Stream<Attribute<?>> attributes(Stream<X> conceptStream, Set<ConceptId> attributeTypesIds) {
Stream<Attribute<?>> attributeStream = conceptStream.
filter(concept -> concept.isAttribute() && !this.equals(concept)).
map(Concept::asAttribute);
if... | [
"private",
"<",
"X",
"extends",
"Concept",
">",
"Stream",
"<",
"Attribute",
"<",
"?",
">",
">",
"attributes",
"(",
"Stream",
"<",
"X",
">",
"conceptStream",
",",
"Set",
"<",
"ConceptId",
">",
"attributeTypesIds",
")",
"{",
"Stream",
"<",
"Attribute",
"<"... | Helper class which filters a Stream of Attribute to those of a specific set of AttributeType.
@param conceptStream The Stream to filter
@param attributeTypesIds The AttributeType ConceptIds to filter to.
@return the filtered stream | [
"Helper",
"class",
"which",
"filters",
"a",
"Stream",
"of",
"Attribute",
"to",
"those",
"of",
"a",
"specific",
"set",
"of",
"AttributeType",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/ThingImpl.java#L165-L175 |
22,968 | graknlabs/grakn | server/src/server/kb/concept/ThingImpl.java | ThingImpl.castingsInstance | Stream<Casting> castingsInstance() {
return vertex().getEdgesOfType(Direction.IN, Schema.EdgeLabel.ROLE_PLAYER).
map(edge -> Casting.withThing(edge, this));
} | java | Stream<Casting> castingsInstance() {
return vertex().getEdgesOfType(Direction.IN, Schema.EdgeLabel.ROLE_PLAYER).
map(edge -> Casting.withThing(edge, this));
} | [
"Stream",
"<",
"Casting",
">",
"castingsInstance",
"(",
")",
"{",
"return",
"vertex",
"(",
")",
".",
"getEdgesOfType",
"(",
"Direction",
".",
"IN",
",",
"Schema",
".",
"EdgeLabel",
".",
"ROLE_PLAYER",
")",
".",
"map",
"(",
"edge",
"->",
"Casting",
".",
... | Castings are retrieved from the perspective of the Thing which is a role player in a Relation
@return All the Casting which this instance is cast into the role | [
"Castings",
"are",
"retrieved",
"from",
"the",
"perspective",
"of",
"the",
"Thing",
"which",
"is",
"a",
"role",
"player",
"in",
"a",
"Relation"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/ThingImpl.java#L182-L185 |
22,969 | graknlabs/grakn | server/src/server/kb/concept/ThingImpl.java | ThingImpl.filterNulls | private Role[] filterNulls(Role... roles) {
return Arrays.stream(roles).filter(Objects::nonNull).toArray(Role[]::new);
} | java | private Role[] filterNulls(Role... roles) {
return Arrays.stream(roles).filter(Objects::nonNull).toArray(Role[]::new);
} | [
"private",
"Role",
"[",
"]",
"filterNulls",
"(",
"Role",
"...",
"roles",
")",
"{",
"return",
"Arrays",
".",
"stream",
"(",
"roles",
")",
".",
"filter",
"(",
"Objects",
"::",
"nonNull",
")",
".",
"toArray",
"(",
"Role",
"[",
"]",
"::",
"new",
")",
"... | Returns an array with all the nulls filtered out. | [
"Returns",
"an",
"array",
"with",
"all",
"the",
"nulls",
"filtered",
"out",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/ThingImpl.java#L350-L352 |
22,970 | graknlabs/grakn | server/src/server/rpc/SessionService.java | SessionService.shutdown | public void shutdown(){
transactionListenerSet.forEach(transactionListener -> transactionListener.close(null));
transactionListenerSet.clear();
openSessions.values().forEach(SessionImpl::close);
} | java | public void shutdown(){
transactionListenerSet.forEach(transactionListener -> transactionListener.close(null));
transactionListenerSet.clear();
openSessions.values().forEach(SessionImpl::close);
} | [
"public",
"void",
"shutdown",
"(",
")",
"{",
"transactionListenerSet",
".",
"forEach",
"(",
"transactionListener",
"->",
"transactionListener",
".",
"close",
"(",
"null",
")",
")",
";",
"transactionListenerSet",
".",
"clear",
"(",
")",
";",
"openSessions",
".",
... | Close all open transactions, sessions and connections with clients - this is invoked by JVM shutdown hook | [
"Close",
"all",
"open",
"transactions",
"sessions",
"and",
"connections",
"with",
"clients",
"-",
"this",
"is",
"invoked",
"by",
"JVM",
"shutdown",
"hook"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/rpc/SessionService.java#L89-L93 |
22,971 | graknlabs/grakn | server/src/server/kb/structure/VertexElement.java | VertexElement.deleteEdge | public void deleteEdge(Direction direction, Schema.EdgeLabel label, VertexElement... targets) {
Iterator<Edge> edges = element().edges(direction, label.getLabel());
if (targets.length == 0) {
edges.forEachRemaining(Edge::remove);
} else {
Set<Vertex> verticesToDelete = Ar... | java | public void deleteEdge(Direction direction, Schema.EdgeLabel label, VertexElement... targets) {
Iterator<Edge> edges = element().edges(direction, label.getLabel());
if (targets.length == 0) {
edges.forEachRemaining(Edge::remove);
} else {
Set<Vertex> verticesToDelete = Ar... | [
"public",
"void",
"deleteEdge",
"(",
"Direction",
"direction",
",",
"Schema",
".",
"EdgeLabel",
"label",
",",
"VertexElement",
"...",
"targets",
")",
"{",
"Iterator",
"<",
"Edge",
">",
"edges",
"=",
"element",
"(",
")",
".",
"edges",
"(",
"direction",
",",... | Deletes all the edges of a specific Schema.EdgeLabel to or from a specific set of targets.
If no targets are provided then all the edges of the specified type are deleted
@param direction The direction of the edges to delete
@param label The edge label to delete
@param targets An optional set of targets to delet... | [
"Deletes",
"all",
"the",
"edges",
"of",
"a",
"specific",
"Schema",
".",
"EdgeLabel",
"to",
"or",
"from",
"a",
"specific",
"set",
"of",
"targets",
".",
"If",
"no",
"targets",
"are",
"provided",
"then",
"all",
"the",
"edges",
"of",
"the",
"specified",
"typ... | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/structure/VertexElement.java#L93-L116 |
22,972 | graknlabs/grakn | server/src/graql/gremlin/spanningtree/util/Weighted.java | Weighted.weighted | public static <T> Weighted<T> weighted(T value, double weight) {
return new Weighted<>(value, weight);
} | java | public static <T> Weighted<T> weighted(T value, double weight) {
return new Weighted<>(value, weight);
} | [
"public",
"static",
"<",
"T",
">",
"Weighted",
"<",
"T",
">",
"weighted",
"(",
"T",
"value",
",",
"double",
"weight",
")",
"{",
"return",
"new",
"Weighted",
"<>",
"(",
"value",
",",
"weight",
")",
";",
"}"
] | Convenience static constructor | [
"Convenience",
"static",
"constructor"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/spanningtree/util/Weighted.java#L44-L46 |
22,973 | graknlabs/grakn | server/src/graql/gremlin/spanningtree/util/Weighted.java | Weighted.compareTo | public int compareTo(Weighted<DirectedEdge> other) {
return ComparisonChain.start()
.compare(other.weight, weight)
.compare(Objects.hashCode(other.val), Objects.hashCode(val))
.result();
} | java | public int compareTo(Weighted<DirectedEdge> other) {
return ComparisonChain.start()
.compare(other.weight, weight)
.compare(Objects.hashCode(other.val), Objects.hashCode(val))
.result();
} | [
"public",
"int",
"compareTo",
"(",
"Weighted",
"<",
"DirectedEdge",
">",
"other",
")",
"{",
"return",
"ComparisonChain",
".",
"start",
"(",
")",
".",
"compare",
"(",
"other",
".",
"weight",
",",
"weight",
")",
".",
"compare",
"(",
"Objects",
".",
"hashCo... | High weights first, use val.hashCode to break ties | [
"High",
"weights",
"first",
"use",
"val",
".",
"hashCode",
"to",
"break",
"ties"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/spanningtree/util/Weighted.java#L51-L56 |
22,974 | graknlabs/grakn | server/src/server/deduplicator/queue/InMemoryQueue.java | InMemoryQueue.insert | public void insert(Attribute attribute) {
queue.put(attribute.conceptId().getValue(), attribute);
synchronized (this) {
notifyAll();
}
} | java | public void insert(Attribute attribute) {
queue.put(attribute.conceptId().getValue(), attribute);
synchronized (this) {
notifyAll();
}
} | [
"public",
"void",
"insert",
"(",
"Attribute",
"attribute",
")",
"{",
"queue",
".",
"put",
"(",
"attribute",
".",
"conceptId",
"(",
")",
".",
"getValue",
"(",
")",
",",
"attribute",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"notifyAll",
"(",
")",... | insert a new attribute at the end of the queue.
@param attribute the attribute to be inserted | [
"insert",
"a",
"new",
"attribute",
"at",
"the",
"end",
"of",
"the",
"queue",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/deduplicator/queue/InMemoryQueue.java#L49-L54 |
22,975 | graknlabs/grakn | server/src/server/deduplicator/queue/InMemoryQueue.java | InMemoryQueue.ack | public void ack(List<Attribute> attributes) {
for (Attribute attr : attributes) {
queue.remove(attr.conceptId().getValue());
}
} | java | public void ack(List<Attribute> attributes) {
for (Attribute attr : attributes) {
queue.remove(attr.conceptId().getValue());
}
} | [
"public",
"void",
"ack",
"(",
"List",
"<",
"Attribute",
">",
"attributes",
")",
"{",
"for",
"(",
"Attribute",
"attr",
":",
"attributes",
")",
"{",
"queue",
".",
"remove",
"(",
"attr",
".",
"conceptId",
"(",
")",
".",
"getValue",
"(",
")",
")",
";",
... | Remove attributes from the queue.
@param attributes the attributes which will be removed | [
"Remove",
"attributes",
"from",
"the",
"queue",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/deduplicator/queue/InMemoryQueue.java#L82-L86 |
22,976 | graknlabs/grakn | server/src/server/deduplicator/AttributeDeduplicator.java | AttributeDeduplicator.deduplicate | public static void deduplicate(SessionFactory sessionFactory, KeyspaceIndexPair keyspaceIndexPair) {
SessionImpl session = sessionFactory.session(keyspaceIndexPair.keyspace());
try (TransactionOLTP tx = session.transaction().write()) {
GraphTraversalSource tinker = tx.getTinkerTraversal();
... | java | public static void deduplicate(SessionFactory sessionFactory, KeyspaceIndexPair keyspaceIndexPair) {
SessionImpl session = sessionFactory.session(keyspaceIndexPair.keyspace());
try (TransactionOLTP tx = session.transaction().write()) {
GraphTraversalSource tinker = tx.getTinkerTraversal();
... | [
"public",
"static",
"void",
"deduplicate",
"(",
"SessionFactory",
"sessionFactory",
",",
"KeyspaceIndexPair",
"keyspaceIndexPair",
")",
"{",
"SessionImpl",
"session",
"=",
"sessionFactory",
".",
"session",
"(",
"keyspaceIndexPair",
".",
"keyspace",
"(",
")",
")",
";... | Deduplicate attributes that has the same value. A de-duplication process consists of picking a single attribute
in the duplicates as the "merge target", copying every edges from every "other duplicates" to the merge target, and
finally deleting that other duplicates.
@param sessionFactory the factory object for acc... | [
"Deduplicate",
"attributes",
"that",
"has",
"the",
"same",
"value",
".",
"A",
"de",
"-",
"duplication",
"process",
"consists",
"of",
"picking",
"a",
"single",
"attribute",
"in",
"the",
"duplicates",
"as",
"the",
"merge",
"target",
"copying",
"every",
"edges",
... | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/deduplicator/AttributeDeduplicator.java#L52-L105 |
22,977 | graknlabs/grakn | server/src/graql/reasoner/query/QueryAnswers.java | QueryAnswers.unify | public QueryAnswers unify(Unifier unifier){
if (unifier.isEmpty()) return new QueryAnswers(this);
QueryAnswers unifiedAnswers = new QueryAnswers();
this.stream()
.map(unifier::apply)
.filter(a -> !a.isEmpty())
.forEach(unifiedAnswers::add);
return unif... | java | public QueryAnswers unify(Unifier unifier){
if (unifier.isEmpty()) return new QueryAnswers(this);
QueryAnswers unifiedAnswers = new QueryAnswers();
this.stream()
.map(unifier::apply)
.filter(a -> !a.isEmpty())
.forEach(unifiedAnswers::add);
return unif... | [
"public",
"QueryAnswers",
"unify",
"(",
"Unifier",
"unifier",
")",
"{",
"if",
"(",
"unifier",
".",
"isEmpty",
"(",
")",
")",
"return",
"new",
"QueryAnswers",
"(",
"this",
")",
";",
"QueryAnswers",
"unifiedAnswers",
"=",
"new",
"QueryAnswers",
"(",
")",
";"... | unify the answers by applying unifier to variable set
@param unifier map of [key: from/value: to] unifiers
@return unified query answers | [
"unify",
"the",
"answers",
"by",
"applying",
"unifier",
"to",
"variable",
"set"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/reasoner/query/QueryAnswers.java#L77-L85 |
22,978 | graknlabs/grakn | server/src/graql/reasoner/query/QueryAnswers.java | QueryAnswers.unify | public QueryAnswers unify(MultiUnifier multiUnifier){
QueryAnswers unifiedAnswers = new QueryAnswers();
this.stream()
.flatMap(multiUnifier::apply)
.filter(ans -> !ans.isEmpty())
.forEach(unifiedAnswers::add);
return unifiedAnswers;
} | java | public QueryAnswers unify(MultiUnifier multiUnifier){
QueryAnswers unifiedAnswers = new QueryAnswers();
this.stream()
.flatMap(multiUnifier::apply)
.filter(ans -> !ans.isEmpty())
.forEach(unifiedAnswers::add);
return unifiedAnswers;
} | [
"public",
"QueryAnswers",
"unify",
"(",
"MultiUnifier",
"multiUnifier",
")",
"{",
"QueryAnswers",
"unifiedAnswers",
"=",
"new",
"QueryAnswers",
"(",
")",
";",
"this",
".",
"stream",
"(",
")",
".",
"flatMap",
"(",
"multiUnifier",
"::",
"apply",
")",
".",
"fil... | unify the answers by applying multiunifier to variable set
@param multiUnifier multiunifier to be applied to the query answers
@return unified query answers | [
"unify",
"the",
"answers",
"by",
"applying",
"multiunifier",
"to",
"variable",
"set"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/reasoner/query/QueryAnswers.java#L92-L99 |
22,979 | graknlabs/grakn | server/src/server/kb/concept/ElementFactory.java | ElementFactory.buildRelation | RelationImpl buildRelation(EdgeElement edge) {
return getOrBuildConcept(edge, (e) -> RelationImpl.create(RelationEdge.get(edge)));
} | java | RelationImpl buildRelation(EdgeElement edge) {
return getOrBuildConcept(edge, (e) -> RelationImpl.create(RelationEdge.get(edge)));
} | [
"RelationImpl",
"buildRelation",
"(",
"EdgeElement",
"edge",
")",
"{",
"return",
"getOrBuildConcept",
"(",
"edge",
",",
"(",
"e",
")",
"-",
">",
"RelationImpl",
".",
"create",
"(",
"RelationEdge",
".",
"get",
"(",
"edge",
")",
")",
")",
";",
"}"
] | Used by RelationEdge to build a RelationImpl object out of a provided Edge | [
"Used",
"by",
"RelationEdge",
"to",
"build",
"a",
"RelationImpl",
"object",
"out",
"of",
"a",
"provided",
"Edge"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/ElementFactory.java#L113-L115 |
22,980 | graknlabs/grakn | server/src/server/kb/concept/ElementFactory.java | ElementFactory.buildRelationReified | RelationReified buildRelationReified(VertexElement vertex, RelationType type) {
return RelationReified.create(vertex, type);
} | java | RelationReified buildRelationReified(VertexElement vertex, RelationType type) {
return RelationReified.create(vertex, type);
} | [
"RelationReified",
"buildRelationReified",
"(",
"VertexElement",
"vertex",
",",
"RelationType",
"type",
")",
"{",
"return",
"RelationReified",
".",
"create",
"(",
"vertex",
",",
"type",
")",
";",
"}"
] | Used by RelationEdge when it needs to reify a relation.
Used by this factory when need to build an explicit relation
@return ReifiedRelation | [
"Used",
"by",
"RelationEdge",
"when",
"it",
"needs",
"to",
"reify",
"a",
"relation",
".",
"Used",
"by",
"this",
"factory",
"when",
"need",
"to",
"build",
"an",
"explicit",
"relation"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/ElementFactory.java#L122-L124 |
22,981 | graknlabs/grakn | server/src/server/kb/concept/ElementFactory.java | ElementFactory.buildRelation | RelationImpl buildRelation(VertexElement vertex, RelationType type) {
return getOrBuildConcept(vertex, (v) -> RelationImpl.create(buildRelationReified(v, type)));
} | java | RelationImpl buildRelation(VertexElement vertex, RelationType type) {
return getOrBuildConcept(vertex, (v) -> RelationImpl.create(buildRelationReified(v, type)));
} | [
"RelationImpl",
"buildRelation",
"(",
"VertexElement",
"vertex",
",",
"RelationType",
"type",
")",
"{",
"return",
"getOrBuildConcept",
"(",
"vertex",
",",
"(",
"v",
")",
"-",
">",
"RelationImpl",
".",
"create",
"(",
"buildRelationReified",
"(",
"v",
",",
"type... | Used by RelationTypeImpl to create a new instance of RelationImpl
first build a ReifiedRelation and then inject it to RelationImpl
@return | [
"Used",
"by",
"RelationTypeImpl",
"to",
"create",
"a",
"new",
"instance",
"of",
"RelationImpl",
"first",
"build",
"a",
"ReifiedRelation",
"and",
"then",
"inject",
"it",
"to",
"RelationImpl"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/ElementFactory.java#L131-L133 |
22,982 | graknlabs/grakn | server/src/server/kb/concept/ElementFactory.java | ElementFactory.getBaseType | private Schema.BaseType getBaseType(VertexElement vertex) {
try {
return Schema.BaseType.valueOf(vertex.label());
} catch (IllegalArgumentException e) {
//Base type appears to be invalid. Let's try getting the type via the shard edge
Optional<VertexElement> type = ver... | java | private Schema.BaseType getBaseType(VertexElement vertex) {
try {
return Schema.BaseType.valueOf(vertex.label());
} catch (IllegalArgumentException e) {
//Base type appears to be invalid. Let's try getting the type via the shard edge
Optional<VertexElement> type = ver... | [
"private",
"Schema",
".",
"BaseType",
"getBaseType",
"(",
"VertexElement",
"vertex",
")",
"{",
"try",
"{",
"return",
"Schema",
".",
"BaseType",
".",
"valueOf",
"(",
"vertex",
".",
"label",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
... | This is a helper method to get the base type of a vertex.
It first tried to get the base type via the label.
If this is not possible it then tries to get the base type via the Shard Edge.
@param vertex The vertex to build a concept from
@return The base type of the vertex, if it is a valid concept. | [
"This",
"is",
"a",
"helper",
"method",
"to",
"get",
"the",
"base",
"type",
"of",
"a",
"vertex",
".",
"It",
"first",
"tried",
"to",
"get",
"the",
"base",
"type",
"via",
"the",
"label",
".",
"If",
"this",
"is",
"not",
"possible",
"it",
"then",
"tries",... | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/ElementFactory.java#L252-L268 |
22,983 | graknlabs/grakn | server/src/server/kb/concept/ElementFactory.java | ElementFactory.addVertexElement | public VertexElement addVertexElement(Schema.BaseType baseType) {
Vertex vertex = graph.addVertex(baseType.name());
return new VertexElement(tx, vertex);
} | java | public VertexElement addVertexElement(Schema.BaseType baseType) {
Vertex vertex = graph.addVertex(baseType.name());
return new VertexElement(tx, vertex);
} | [
"public",
"VertexElement",
"addVertexElement",
"(",
"Schema",
".",
"BaseType",
"baseType",
")",
"{",
"Vertex",
"vertex",
"=",
"graph",
".",
"addVertex",
"(",
"baseType",
".",
"name",
"(",
")",
")",
";",
"return",
"new",
"VertexElement",
"(",
"tx",
",",
"ve... | Creates a new Vertex in the graph and builds a VertexElement which wraps the newly created vertex
@param baseType The Schema.BaseType
@return a new VertexElement | [
"Creates",
"a",
"new",
"Vertex",
"in",
"the",
"graph",
"and",
"builds",
"a",
"VertexElement",
"which",
"wraps",
"the",
"newly",
"created",
"vertex"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/ElementFactory.java#L308-L311 |
22,984 | graknlabs/grakn | concept/printer/StringPrinter.java | StringPrinter.colorKeyword | private String colorKeyword(String keyword) {
if(colorize) {
return ANSI.color(keyword, ANSI.BLUE);
} else {
return keyword;
}
} | java | private String colorKeyword(String keyword) {
if(colorize) {
return ANSI.color(keyword, ANSI.BLUE);
} else {
return keyword;
}
} | [
"private",
"String",
"colorKeyword",
"(",
"String",
"keyword",
")",
"{",
"if",
"(",
"colorize",
")",
"{",
"return",
"ANSI",
".",
"color",
"(",
"keyword",
",",
"ANSI",
".",
"BLUE",
")",
";",
"}",
"else",
"{",
"return",
"keyword",
";",
"}",
"}"
] | Color-codes the keyword if colorization enabled
@param keyword a keyword to color-code using ANSI colors
@return the keyword, color-coded | [
"Color",
"-",
"codes",
"the",
"keyword",
"if",
"colorization",
"enabled"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/concept/printer/StringPrinter.java#L238-L244 |
22,985 | graknlabs/grakn | concept/printer/StringPrinter.java | StringPrinter.colorType | private String colorType(SchemaConcept schemaConcept) {
if(colorize) {
return ANSI.color(label(schemaConcept.label()), ANSI.PURPLE);
} else {
return label(schemaConcept.label());
}
} | java | private String colorType(SchemaConcept schemaConcept) {
if(colorize) {
return ANSI.color(label(schemaConcept.label()), ANSI.PURPLE);
} else {
return label(schemaConcept.label());
}
} | [
"private",
"String",
"colorType",
"(",
"SchemaConcept",
"schemaConcept",
")",
"{",
"if",
"(",
"colorize",
")",
"{",
"return",
"ANSI",
".",
"color",
"(",
"label",
"(",
"schemaConcept",
".",
"label",
"(",
")",
")",
",",
"ANSI",
".",
"PURPLE",
")",
";",
"... | Color-codes the given type if colorization enabled
@param schemaConcept a type to color-code using ANSI colors
@return the type, color-coded | [
"Color",
"-",
"codes",
"the",
"given",
"type",
"if",
"colorization",
"enabled"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/concept/printer/StringPrinter.java#L251-L257 |
22,986 | graknlabs/grakn | server/src/server/session/cache/KeyspaceCache.java | KeyspaceCache.populateSchemaTxCache | void populateSchemaTxCache(TransactionCache transactionCache) {
try {
lock.writeLock().lock();
Map<Label, LabelId> cachedLabelsSnapshot = getCachedLabels();
cachedLabelsSnapshot.forEach(transactionCache::cacheLabel);
} finally {
lock.writeLock().unlock();
... | java | void populateSchemaTxCache(TransactionCache transactionCache) {
try {
lock.writeLock().lock();
Map<Label, LabelId> cachedLabelsSnapshot = getCachedLabels();
cachedLabelsSnapshot.forEach(transactionCache::cacheLabel);
} finally {
lock.writeLock().unlock();
... | [
"void",
"populateSchemaTxCache",
"(",
"TransactionCache",
"transactionCache",
")",
"{",
"try",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"Map",
"<",
"Label",
",",
"LabelId",
">",
"cachedLabelsSnapshot",
"=",
"getCachedLabels",
"(",
... | Copy the contents of the Keyspace cache into a TransactionOLTP Cache
@param transactionCache | [
"Copy",
"the",
"contents",
"of",
"the",
"Keyspace",
"cache",
"into",
"a",
"TransactionOLTP",
"Cache"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/session/cache/KeyspaceCache.java#L49-L57 |
22,987 | graknlabs/grakn | server/src/server/session/cache/KeyspaceCache.java | KeyspaceCache.readTxCache | void readTxCache(TransactionCache transactionCache) {
//Check if the schema has been changed and should be flushed into this cache
if (!cachedLabels.equals(transactionCache.getLabelCache())) {
try {
lock.writeLock().lock();
cachedLabels.clear();
... | java | void readTxCache(TransactionCache transactionCache) {
//Check if the schema has been changed and should be flushed into this cache
if (!cachedLabels.equals(transactionCache.getLabelCache())) {
try {
lock.writeLock().lock();
cachedLabels.clear();
... | [
"void",
"readTxCache",
"(",
"TransactionCache",
"transactionCache",
")",
"{",
"//Check if the schema has been changed and should be flushed into this cache",
"if",
"(",
"!",
"cachedLabels",
".",
"equals",
"(",
"transactionCache",
".",
"getLabelCache",
"(",
")",
")",
")",
... | Reads the SchemaConcept labels currently in the transaction cache
into the keyspace cache. This happens when a commit occurs and allows us to track schema
mutations without having to read the graph.
@param transactionCache The transaction cache | [
"Reads",
"the",
"SchemaConcept",
"labels",
"currently",
"in",
"the",
"transaction",
"cache",
"into",
"the",
"keyspace",
"cache",
".",
"This",
"happens",
"when",
"a",
"commit",
"occurs",
"and",
"allows",
"us",
"to",
"track",
"schema",
"mutations",
"without",
"h... | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/session/cache/KeyspaceCache.java#L77-L88 |
22,988 | graknlabs/grakn | server/src/graql/gremlin/fragment/Fragment.java | Fragment.directedEdges | public Set<Weighted<DirectedEdge>> directedEdges(Map<NodeId, Node> nodes) {
return Collections.emptySet();
} | java | public Set<Weighted<DirectedEdge>> directedEdges(Map<NodeId, Node> nodes) {
return Collections.emptySet();
} | [
"public",
"Set",
"<",
"Weighted",
"<",
"DirectedEdge",
">",
">",
"directedEdges",
"(",
"Map",
"<",
"NodeId",
",",
"Node",
">",
"nodes",
")",
"{",
"return",
"Collections",
".",
"emptySet",
"(",
")",
";",
"}"
] | Convert the fragment to a set of weighted edges for query planning
@param nodes all nodes in the query
@return a set of edges | [
"Convert",
"the",
"fragment",
"to",
"a",
"set",
"of",
"weighted",
"edges",
"for",
"query",
"planning"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/fragment/Fragment.java#L176-L178 |
22,989 | graknlabs/grakn | server/src/server/kb/concept/AttributeTypeImpl.java | AttributeTypeImpl.putInstance | private Attribute<D> putInstance(Schema.BaseType instanceBaseType, Supplier<Attribute<D>> finder, BiFunction<VertexElement, AttributeType<D>, Attribute<D>> producer, boolean isInferred) {
Attribute<D> instance = finder.get();
if (instance == null) {
instance = addInstance(instanceBaseType, p... | java | private Attribute<D> putInstance(Schema.BaseType instanceBaseType, Supplier<Attribute<D>> finder, BiFunction<VertexElement, AttributeType<D>, Attribute<D>> producer, boolean isInferred) {
Attribute<D> instance = finder.get();
if (instance == null) {
instance = addInstance(instanceBaseType, p... | [
"private",
"Attribute",
"<",
"D",
">",
"putInstance",
"(",
"Schema",
".",
"BaseType",
"instanceBaseType",
",",
"Supplier",
"<",
"Attribute",
"<",
"D",
">",
">",
"finder",
",",
"BiFunction",
"<",
"VertexElement",
",",
"AttributeType",
"<",
"D",
">",
",",
"A... | Utility method used to create or find an instance of this type
@param instanceBaseType The base type of the instances of this type
@param finder The method to find the instrance if it already exists
@param producer The factory method to produce the instance if it doesn't exist
@return A new or alread... | [
"Utility",
"method",
"used",
"to",
"create",
"or",
"find",
"an",
"instance",
"of",
"this",
"type"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/AttributeTypeImpl.java#L139-L149 |
22,990 | graknlabs/grakn | server/src/server/kb/concept/AttributeTypeImpl.java | AttributeTypeImpl.checkConformsToRegexes | private void checkConformsToRegexes(String value) {
//Not checking the datatype because the regex will always be null for non strings.
this.sups().forEach(sup -> {
String regex = sup.regex();
if (regex != null && !Pattern.matches(regex, value)) {
throw Transaction... | java | private void checkConformsToRegexes(String value) {
//Not checking the datatype because the regex will always be null for non strings.
this.sups().forEach(sup -> {
String regex = sup.regex();
if (regex != null && !Pattern.matches(regex, value)) {
throw Transaction... | [
"private",
"void",
"checkConformsToRegexes",
"(",
"String",
"value",
")",
"{",
"//Not checking the datatype because the regex will always be null for non strings.",
"this",
".",
"sups",
"(",
")",
".",
"forEach",
"(",
"sup",
"->",
"{",
"String",
"regex",
"=",
"sup",
".... | Checks if all the regex's of the types of this resource conforms to the value provided.
@param value The value to check the regexes against.
@throws TransactionException when the value does not conform to the regex of its types | [
"Checks",
"if",
"all",
"the",
"regex",
"s",
"of",
"the",
"types",
"of",
"this",
"resource",
"conforms",
"to",
"the",
"value",
"provided",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/AttributeTypeImpl.java#L157-L165 |
22,991 | graknlabs/grakn | server/src/server/kb/concept/AttributeTypeImpl.java | AttributeTypeImpl.dataType | @SuppressWarnings({"unchecked"})
@Nullable
@Override
public DataType<D> dataType() {
String className = vertex().property(Schema.VertexProperty.DATA_TYPE);
if (className == null) return null;
try {
return (DataType<D>) DataType.of(Class.forName(className));
} cat... | java | @SuppressWarnings({"unchecked"})
@Nullable
@Override
public DataType<D> dataType() {
String className = vertex().property(Schema.VertexProperty.DATA_TYPE);
if (className == null) return null;
try {
return (DataType<D>) DataType.of(Class.forName(className));
} cat... | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
"}",
")",
"@",
"Nullable",
"@",
"Override",
"public",
"DataType",
"<",
"D",
">",
"dataType",
"(",
")",
"{",
"String",
"className",
"=",
"vertex",
"(",
")",
".",
"property",
"(",
"Schema",
".",
"VertexPr... | This unsafe cast is suppressed because at this stage we do not know what the type is when reading from the rootGraph. | [
"This",
"unsafe",
"cast",
"is",
"suppressed",
"because",
"at",
"this",
"stage",
"we",
"do",
"not",
"know",
"what",
"the",
"type",
"is",
"when",
"reading",
"from",
"the",
"rootGraph",
"."
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/AttributeTypeImpl.java#L177-L189 |
22,992 | graknlabs/grakn | server/src/graql/gremlin/fragment/Fragments.java | Fragments.outSubs | static <T> GraphTraversal<T, Vertex> outSubs(GraphTraversal<T, Vertex> traversal) {
return outSubs(traversal, TRAVERSE_ALL_SUB_EDGES);
} | java | static <T> GraphTraversal<T, Vertex> outSubs(GraphTraversal<T, Vertex> traversal) {
return outSubs(traversal, TRAVERSE_ALL_SUB_EDGES);
} | [
"static",
"<",
"T",
">",
"GraphTraversal",
"<",
"T",
",",
"Vertex",
">",
"outSubs",
"(",
"GraphTraversal",
"<",
"T",
",",
"Vertex",
">",
"traversal",
")",
"{",
"return",
"outSubs",
"(",
"traversal",
",",
"TRAVERSE_ALL_SUB_EDGES",
")",
";",
"}"
] | Default unlimiteid depth sub-edge traversal
@param traversal
@param <T>
@return | [
"Default",
"unlimiteid",
"depth",
"sub",
"-",
"edge",
"traversal"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/fragment/Fragments.java#L154-L156 |
22,993 | graknlabs/grakn | server/src/graql/gremlin/fragment/Fragments.java | Fragments.inSubs | static <T> GraphTraversal<T, Vertex> inSubs(GraphTraversal<T, Vertex> traversal) {
return inSubs(traversal, TRAVERSE_ALL_SUB_EDGES);
} | java | static <T> GraphTraversal<T, Vertex> inSubs(GraphTraversal<T, Vertex> traversal) {
return inSubs(traversal, TRAVERSE_ALL_SUB_EDGES);
} | [
"static",
"<",
"T",
">",
"GraphTraversal",
"<",
"T",
",",
"Vertex",
">",
"inSubs",
"(",
"GraphTraversal",
"<",
"T",
",",
"Vertex",
">",
"traversal",
")",
"{",
"return",
"inSubs",
"(",
"traversal",
",",
"TRAVERSE_ALL_SUB_EDGES",
")",
";",
"}"
] | Default unlimited-depth sub-edge traversal
@param traversal
@param <T>
@return | [
"Default",
"unlimited",
"-",
"depth",
"sub",
"-",
"edge",
"traversal"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/fragment/Fragments.java#L180-L182 |
22,994 | graknlabs/grakn | server/src/graql/gremlin/fragment/Fragments.java | Fragments.isVertex | static <T> GraphTraversal<T, Vertex> isVertex(GraphTraversal<T, ? extends Element> traversal) {
// This cast is safe because we filter only to vertices
//noinspection unchecked
return (GraphTraversal<T, Vertex>) traversal.filter(e -> e.get() instanceof Vertex);
} | java | static <T> GraphTraversal<T, Vertex> isVertex(GraphTraversal<T, ? extends Element> traversal) {
// This cast is safe because we filter only to vertices
//noinspection unchecked
return (GraphTraversal<T, Vertex>) traversal.filter(e -> e.get() instanceof Vertex);
} | [
"static",
"<",
"T",
">",
"GraphTraversal",
"<",
"T",
",",
"Vertex",
">",
"isVertex",
"(",
"GraphTraversal",
"<",
"T",
",",
"?",
"extends",
"Element",
">",
"traversal",
")",
"{",
"// This cast is safe because we filter only to vertices",
"//noinspection unchecked",
"... | Create a traversal that filters to only vertices | [
"Create",
"a",
"traversal",
"that",
"filters",
"to",
"only",
"vertices"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/fragment/Fragments.java#L222-L226 |
22,995 | graknlabs/grakn | server/src/graql/gremlin/fragment/Fragments.java | Fragments.isEdge | static <T> GraphTraversal<T, Edge> isEdge(GraphTraversal<T, ? extends Element> traversal) {
// This cast is safe because we filter only to edges
//noinspection unchecked
return (GraphTraversal<T, Edge>) traversal.filter(e -> e.get() instanceof Edge);
} | java | static <T> GraphTraversal<T, Edge> isEdge(GraphTraversal<T, ? extends Element> traversal) {
// This cast is safe because we filter only to edges
//noinspection unchecked
return (GraphTraversal<T, Edge>) traversal.filter(e -> e.get() instanceof Edge);
} | [
"static",
"<",
"T",
">",
"GraphTraversal",
"<",
"T",
",",
"Edge",
">",
"isEdge",
"(",
"GraphTraversal",
"<",
"T",
",",
"?",
"extends",
"Element",
">",
"traversal",
")",
"{",
"// This cast is safe because we filter only to edges",
"//noinspection unchecked",
"return"... | Create a traversal that filters to only edges | [
"Create",
"a",
"traversal",
"that",
"filters",
"to",
"only",
"edges"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/fragment/Fragments.java#L231-L235 |
22,996 | graknlabs/grakn | server/src/graql/gremlin/sets/RolePlayerFragmentSet.java | RolePlayerFragmentSet.removeRoleVar | private RolePlayerFragmentSet removeRoleVar() {
Preconditions.checkNotNull(role());
return new AutoValue_RolePlayerFragmentSet(
varProperty(), relation(), edge(), rolePlayer(), null, roleLabels(), relationTypeLabels()
);
} | java | private RolePlayerFragmentSet removeRoleVar() {
Preconditions.checkNotNull(role());
return new AutoValue_RolePlayerFragmentSet(
varProperty(), relation(), edge(), rolePlayer(), null, roleLabels(), relationTypeLabels()
);
} | [
"private",
"RolePlayerFragmentSet",
"removeRoleVar",
"(",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"role",
"(",
")",
")",
";",
"return",
"new",
"AutoValue_RolePlayerFragmentSet",
"(",
"varProperty",
"(",
")",
",",
"relation",
"(",
")",
",",
"edge",
... | Remove any specified role variable | [
"Remove",
"any",
"specified",
"role",
"variable"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/sets/RolePlayerFragmentSet.java#L280-L285 |
22,997 | kiegroup/jbpm | jbpm-flow/src/main/java/org/jbpm/workflow/core/impl/NodeImpl.java | NodeImpl.getFrom | public Connection getFrom() {
final List<Connection> list =
getIncomingConnections(org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE);
if (list.size() == 0) {
return null;
}
if (list.size() == 1) {
return list.get(0);
}
if ("true".equals... | java | public Connection getFrom() {
final List<Connection> list =
getIncomingConnections(org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE);
if (list.size() == 0) {
return null;
}
if (list.size() == 1) {
return list.get(0);
}
if ("true".equals... | [
"public",
"Connection",
"getFrom",
"(",
")",
"{",
"final",
"List",
"<",
"Connection",
">",
"list",
"=",
"getIncomingConnections",
"(",
"org",
".",
"jbpm",
".",
"workflow",
".",
"core",
".",
"Node",
".",
"CONNECTION_DEFAULT_TYPE",
")",
";",
"if",
"(",
"list... | Helper method for nodes that have at most one default incoming connection | [
"Helper",
"method",
"for",
"nodes",
"that",
"have",
"at",
"most",
"one",
"default",
"incoming",
"connection"
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-flow/src/main/java/org/jbpm/workflow/core/impl/NodeImpl.java#L203-L218 |
22,998 | kiegroup/jbpm | jbpm-flow/src/main/java/org/jbpm/workflow/core/impl/NodeImpl.java | NodeImpl.getDefaultIncomingConnections | public List<Connection> getDefaultIncomingConnections() {
return getIncomingConnections(org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE);
} | java | public List<Connection> getDefaultIncomingConnections() {
return getIncomingConnections(org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE);
} | [
"public",
"List",
"<",
"Connection",
">",
"getDefaultIncomingConnections",
"(",
")",
"{",
"return",
"getIncomingConnections",
"(",
"org",
".",
"jbpm",
".",
"workflow",
".",
"core",
".",
"Node",
".",
"CONNECTION_DEFAULT_TYPE",
")",
";",
"}"
] | Helper method for nodes that have multiple default incoming connections | [
"Helper",
"method",
"for",
"nodes",
"that",
"have",
"multiple",
"default",
"incoming",
"connections"
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-flow/src/main/java/org/jbpm/workflow/core/impl/NodeImpl.java#L239-L241 |
22,999 | kiegroup/jbpm | jbpm-flow/src/main/java/org/jbpm/workflow/core/impl/NodeImpl.java | NodeImpl.getDefaultOutgoingConnections | public List<Connection> getDefaultOutgoingConnections() {
return getOutgoingConnections(org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE);
} | java | public List<Connection> getDefaultOutgoingConnections() {
return getOutgoingConnections(org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE);
} | [
"public",
"List",
"<",
"Connection",
">",
"getDefaultOutgoingConnections",
"(",
")",
"{",
"return",
"getOutgoingConnections",
"(",
"org",
".",
"jbpm",
".",
"workflow",
".",
"core",
".",
"Node",
".",
"CONNECTION_DEFAULT_TYPE",
")",
";",
"}"
] | Helper method for nodes that have multiple default outgoing connections | [
"Helper",
"method",
"for",
"nodes",
"that",
"have",
"multiple",
"default",
"outgoing",
"connections"
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-flow/src/main/java/org/jbpm/workflow/core/impl/NodeImpl.java#L244-L246 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.