Skip to content

Commit

Permalink
is_quadstore
Browse files Browse the repository at this point in the history
  • Loading branch information
arcangelo7 committed Jan 29, 2024
1 parent 0372a87 commit 6448ac5
Show file tree
Hide file tree
Showing 21 changed files with 465 additions and 319 deletions.
10 changes: 6 additions & 4 deletions bear/config.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"dataset": {
"triplestore_urls": ["http://127.0.0.1:9999/blazegraph/sparql"],
"file_paths": []
"triplestore_urls": ["http://127.0.0.1:29999/blazegraph/sparql"],
"file_paths": [],
"is_quadstore": true
},
"provenance": {
"triplestore_urls": ["http://127.0.0.1:19999/blazegraph/sparql"],
"file_paths": []
"triplestore_urls": ["http://127.0.0.1:39999/blazegraph/sparql"],
"file_paths": [],
"is_quadstore": true
},
"blazegraph_full_text_search": "yes",
"fuseki_full_text_search": "no",
Expand Down
Binary file removed bear/counter.db
Binary file not shown.
41 changes: 0 additions & 41 deletions bear/current/bear_a_current/bear.properties

This file was deleted.

30 changes: 30 additions & 0 deletions bear/explore_cb_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import argparse
import gzip
import os

def search_string_in_nt_files(folder_path, search_string):
for root, _, files in os.walk(folder_path):
for filename in files:
if filename.endswith('.gz'):
file_path = os.path.join(root, filename)
try:
with gzip.open(file_path, 'rt', encoding='utf-8') as gz_file:
for line in gz_file:
if search_string in line:
print(line.strip(), filename)
except Exception as e:
print(f"Errore durante la lettura del file {file_path}: {e}")

def main():
parser = argparse.ArgumentParser(description="Cerca una stringa nei file .gz contenenti file .nt")
parser.add_argument("folder_path", help="Percorso della cartella contenente i file .gz")
parser.add_argument("search_string", help="Stringa da cercare nei file .nt")

args = parser.parse_args()
folder_path = args.folder_path
search_string = args.search_string

search_string_in_nt_files(folder_path, search_string)

if __name__ == "__main__":
main()
34 changes: 34 additions & 0 deletions bear/find_highest_numbered_file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import os
import argparse

def find_highest_numbered_file(directory):
highest_numbered_file = None
highest_number = -1

for filename in os.listdir(directory):
if filename.endswith(".nt.gz"):
try:
file_number = int(filename.split('.')[0])
if file_number > highest_number:
highest_numbered_file = filename
highest_number = file_number
except ValueError:
pass

return highest_numbered_file

if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Trova il file con il numero più alto nel nome nella directory.")
parser.add_argument("directory", help="La directory in cui cercare il file con il numero più alto nel nome.")

args = parser.parse_args()
directory = args.directory

if not os.path.exists(directory):
print(f"La directory '{directory}' non esiste.")
else:
highest_numbered_file = find_highest_numbered_file(directory)
if highest_numbered_file:
print(f"Il file con il numero più alto nel nome nella directory '{directory}' è: {highest_numbered_file}")
else:
print(f"Nessun file trovato nella directory '{directory}' con numeri nel nome.")
12 changes: 8 additions & 4 deletions bear/find_snapshots.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import argparse
import json
import os
import re
Expand All @@ -20,7 +21,7 @@ def find_generated_at_time(filename):

return results

def main(directory):
def main(directory, output_file):
"""
Esplora tutti i file .nq nella directory specificata e cerca gli oggetti dei predicati prov:generatedAtTime.
"""
Expand All @@ -40,10 +41,13 @@ def main(directory):

timestamps_sorted = sorted(list(timestamps))

with open("timestamps.json", "w", encoding='utf-8') as json_file:
with open(output_file, "w", encoding='utf-8') as json_file:
json.dump({str(i+1): ts for i, ts in enumerate(timestamps_sorted)}, json_file, ensure_ascii=False, indent=4)


if __name__ == "__main__":
directory = input("Inserisci il percorso della cartella da esplorare: ")
main(directory)
parser = argparse.ArgumentParser(description="Find prov:generatedAtTime objects in .nq files.")
parser.add_argument("directory", type=str, help="The directory to explore for .nq files")
parser.add_argument("--output", type=str, default="timestamps.json", help="Output file path (default: timestamps.json)")
args = parser.parse_args()
main(args.directory, args.output)
Loading

0 comments on commit 6448ac5

Please sign in to comment.