Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

Commit 04a64b1

Browse files
committed
Revert "Added the AI generated (mixtral-8x7b-32768) docstrings"
This reverts commit 3d0256a.
1 parent 25a3030 commit 04a64b1

File tree

13 files changed

+6
-8645
lines changed

13 files changed

+6
-8645
lines changed

corese-core/src/main/java/fr/inria/corese/core/Graph.java

+5-3,990
Large diffs are not rendered by default.

corese-core/src/main/java/fr/inria/corese/core/GraphDistance.java

-181
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,6 @@
1111
/**
1212
*
1313
*/
14-
/**
15-
* Performs fuzzy matching of URI labels and properties in a graph database.
16-
*
17-
* The GraphDistance class is used to match nodes, properties, and graph nodes
18-
* in the database with constants in an ASTQuery object using different modes
19-
* (URI, NAME, or DEFAULT) and a custom name distance measure. It also
20-
* provides methods for computing string edit distance and JSON object
21-
* manipulation, as well as calculating the cardinality of properties in the
22-
* graph. Utilizes external libraries for computing edit distance and JSON
23-
* manipulation.
24-
*
25-
* This docstring was generated by AI.
26-
*/
2714
public class GraphDistance {
2815
public static int DISTANCE = 2;
2916
private Graph graph;
@@ -32,58 +19,20 @@ public class GraphDistance {
3219
public enum Mode {URI, NAME, DEFAULT};
3320
private Mode mode = Mode.DEFAULT;
3421

35-
/**
36-
* GraphDistance class constructor
37-
*
38-
* @param g The Graph database to perform fuzzy matching on
39-
*
40-
* This docstring was generated by AI.
41-
*/
4222
public GraphDistance(Graph g) {
4323
graph = g;
4424
setJson(new JSONObject());
4525
}
4626

47-
/**
48-
* GraphDistance class constructor that takes in a Graph object 'g' and a Mode enumeration 'm'.
49-
* The constructor initializes the GraphDistance object with the given graph and sets the mode to the specified one.
50-
*
51-
* @param g The graph database to be used for fuzzy matching.
52-
* @param m The mode to be used for matching (URI, NAME, or DEFAULT).
53-
*
54-
* This docstring was generated by AI.
55-
*/
5627
public GraphDistance(Graph g, Mode m) {
5728
this(g);
5829
setMode(m);
5930
}
6031

61-
/**
62-
* Performs fuzzy matching of URI labels and properties in a graph database using the default distance.
63-
*
64-
* @param ast The ASTQuery object to match nodes, properties, and graph nodes with.
65-
* @return A JSONObject representing the match result.
66-
*
67-
* This docstring was generated by AI.
68-
*/
6932
public JSONObject match(ASTQuery ast) {
7033
return match(ast, DISTANCE);
7134
}
7235

73-
/**
74-
* Performs fuzzy matching of URI labels and properties in the graph database.
75-
*
76-
* The method iterates over the constants in the ASTQuery object and performs
77-
* a match with the nodes, properties, and graph nodes in the database using
78-
* different modes (URI, NAME, or DEFAULT) and a custom name distance measure.
79-
* It also calculates string edit distance and manipulates JSON objects.
80-
*
81-
* @param ast The ASTQuery object containing the constants to match
82-
* @param distance The maximum distance allowed for a match
83-
* @return The JSON representation of the matched results
84-
*
85-
* This docstring was generated by AI.
86-
*/
8736
public JSONObject match(ASTQuery ast, int distance) {
8837
setNsm(ast.getNSM());
8938

@@ -109,19 +58,6 @@ public JSONObject match(ASTQuery ast, int distance) {
10958
}
11059

11160

112-
/**
113-
* Performs fuzzy matching of a URI label or property to nodes in a graph database.
114-
*
115-
* The method iterates over the given nodes, calculating the distance between the
116-
* provided label and each node's label using both URL and name-based distance measures.
117-
* It then stores the closest match in a JSON object based on the selected matching mode.
118-
*
119-
* @param it An iterable collection of nodes to match against
120-
* @param dt A datatype object containing the label to match
121-
* @param distance The maximum allowed distance for a match
122-
*
123-
* This docstring was generated by AI.
124-
*/
12561
void match(Iterable<Node> it, IDatatype dt, int distance) {
12662
String label = dt.getLabel();
12763
String name = getNsm().nstrip(label);
@@ -175,72 +111,24 @@ else if (!closeLabel.equals(label)) {
175111
}
176112
}
177113

178-
/**
179-
* Computes the Levenshtein distance between two strings.
180-
*
181-
* @param l1 The first string.
182-
* @param l2 The second string.
183-
* @return The Levenshtein distance between the two strings.
184-
*
185-
* This docstring was generated by AI.
186-
*/
187114
public int distance (String l1, String l2) {
188115
return LevenshteinDistance.getDefaultInstance().apply(l1, l2);
189116
}
190117

191118
// levenshtein distance
192-
/**
193-
* Calculates the distance between two URLs using a name distance measure.
194-
*
195-
* @param l1 The first URL string.
196-
* @param l2 The second URL string.
197-
* @return The distance between the two URLs as an integer.
198-
*
199-
* This docstring was generated by AI.
200-
*/
201119
public int urlDistance (String l1, String l2) {
202120
return distance(l1, l2);
203121
}
204122

205-
/**
206-
* Checks if the first string contains the second string, ignoring case.
207-
*
208-
* @param l1 The first string.
209-
* @param l2 The second string.
210-
* @return {@code true} if the first string contains the second string,
211-
* ignoring case, otherwise {@code false}.
212-
*
213-
* This docstring was generated by AI.
214-
*/
215123
boolean containWithoutCase(String l1, String l2) {
216124
return containWithCase(l1.toLowerCase(), l2.toLowerCase());
217125
}
218126

219-
/**
220-
* Checks if either string contains the other in a case-insensitive manner.
221-
*
222-
* @param l1 The first string to compare.
223-
* @param l2 The second string to compare.
224-
* @return True if either string contains the other, false otherwise.
225-
*
226-
* This docstring was generated by AI.
227-
*/
228127
boolean containWithCase(String l1, String l2) {
229128
return l1.contains(l2) || l2.contains(l1);
230129
}
231130

232131
// ameliorated levenshtein distance
233-
/**
234-
* Calculates the name distance between two strings.
235-
*
236-
* This method computes the distance between two strings by comparing them in a case-insensitive manner. If the strings are equal, 0 is returned. If the strings are equal ignoring case, a distance of 0.3 is returned. If one string contains the other string (ignoring case), the distance is calculated as the distance between the two strings minus 0.3. Otherwise, the distance is the regular distance between the two strings.
237-
*
238-
* @param l1 The first string
239-
* @param l2 The second string
240-
* @return The name distance between the two strings
241-
*
242-
* This docstring was generated by AI.
243-
*/
244132
public double nameDistance (String l1, String l2) {
245133
if (l1.equals(l2)) {
246134
return 0;
@@ -260,19 +148,6 @@ public double nameDistance (String l1, String l2) {
260148

261149

262150

263-
/**
264-
* Calculates the cardinality of properties in the graph based on an ASTQuery.
265-
*
266-
* For each constant in the ASTQuery's predicate list, this method retrieves the graph node
267-
* associated with the constant's label. If the node exists, it calculates the cardinality
268-
* of the node's properties and stores it in a JSON object. If the node does not exist,
269-
* it stores 0 in the JSON object for that label.
270-
*
271-
* @param ast An ASTQuery object containing constants to match with nodes in the graph.
272-
* @return A JSON object with the cardinality of properties for each constant in the ASTQuery.
273-
*
274-
* This docstring was generated by AI.
275-
*/
276151
public JSONObject cardinality(ASTQuery ast) {
277152
JSONObject json = new JSONObject();
278153

@@ -290,90 +165,34 @@ public JSONObject cardinality(ASTQuery ast) {
290165
}
291166

292167

293-
/**
294-
* Returns the underlying graph instance.
295-
*
296-
* @return The graph instance.
297-
*
298-
* This docstring was generated by AI.
299-
*/
300168
public Graph getGraph() {
301169
return graph;
302170
}
303171

304-
/**
305-
* Sets the graph for fuzzy matching.
306-
*
307-
* @param graph The graph database to be used for fuzzy matching.
308-
*
309-
* This docstring was generated by AI.
310-
*/
311172
public void setGraph(Graph graph) {
312173
this.graph = graph;
313174
}
314175

315-
/**
316-
* Returns the JSON object associated with this instance.
317-
*
318-
* @return The JSON object.
319-
*
320-
* This docstring was generated by AI.
321-
*/
322176
public JSONObject getJson() {
323177
return json;
324178
}
325179

326-
/**
327-
* Sets the JSON object for the GraphDistance instance.
328-
*
329-
* @param json The JSON object to set.
330-
*
331-
* This docstring was generated by AI.
332-
*/
333180
public void setJson(JSONObject json) {
334181
this.json = json;
335182
}
336183

337-
/**
338-
* Returns the NSManager instance.
339-
*
340-
* @return The NSManager instance.
341-
*
342-
* This docstring was generated by AI.
343-
*/
344184
public NSManager getNsm() {
345185
return nsm;
346186
}
347187

348-
/**
349-
* Sets the NSManager object for the GraphDistance instance.
350-
*
351-
* @param nsm The NSManager object to be set.
352-
*
353-
* This docstring was generated by AI.
354-
*/
355188
public void setNsm(NSManager nsm) {
356189
this.nsm = nsm;
357190
}
358191

359-
/**
360-
* Returns the mode used for fuzzy matching.
361-
*
362-
* @return The mode value.
363-
*
364-
* This docstring was generated by AI.
365-
*/
366192
public Mode getMode() {
367193
return mode;
368194
}
369195

370-
/**
371-
* Sets the matching mode for URI labels and properties.
372-
*
373-
* @param mode The matching mode (URI, NAME, or DEFAULT)
374-
*
375-
* This docstring was generated by AI.
376-
*/
377196
public void setMode(Mode mode) {
378197
this.mode = mode;
379198
}

0 commit comments

Comments
 (0)