This commit is contained in:
GassiGiuseppe 2025-09-18 19:20:26 +02:00
commit 9a5a7d84fd
4 changed files with 11 additions and 7 deletions

1
.gitattributes vendored
View File

@ -1,2 +1,3 @@
Exam/Deep_Learning_2025_VIII.pdf filter=lfs diff=lfs merge=lfs -text Exam/Deep_Learning_2025_VIII.pdf filter=lfs diff=lfs merge=lfs -text
Assets/** filter=lfs diff=lfs merge=lfs -text Assets/** filter=lfs diff=lfs merge=lfs -text
Assets/Dataset/1-hop/dataset.csv filter=lfs diff=lfs merge=lfs -text

BIN
Assets/Dataset/1-hop/dataset.csv (Stored with Git LFS)

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
3 size 2443211793

BIN
Assets/Dataset/1-hop/movies.csv (Stored with Git LFS)

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
3 size 8808636

View File

@ -1,3 +1,4 @@
from math import floor
from time import sleep from time import sleep
import SPARQLWrapper import SPARQLWrapper
import requests import requests
@ -8,9 +9,11 @@ TYPE = SPARQLWrapper.CSV
TIMEOUT_SECONDS = 1.5 TIMEOUT_SECONDS = 1.5
LIMIT = int(1E4) LIMIT = int(1E4)
OFFSET = LIMIT OFFSET = LIMIT
INITIAL_OFFSET = 0 INITIAL_OFFSET = 15200000
MAX_PAGES = int(1E9) MAX_PAGES = int(1E9)
# Missing page 13220000
FILE_URI = "./Assets/Dataset/1-hop/dataset.csv" FILE_URI = "./Assets/Dataset/1-hop/dataset.csv"
QUERY = """ QUERY = """
@ -35,13 +38,13 @@ WHERE {
def main(): def main():
exit = False exit = False
page = INITIAL_OFFSET page = int(floor(INITIAL_OFFSET / LIMIT)) -1
while not exit: while not exit:
print(f"Starting to get page {page}") print(f"Starting to get page {page}")
CURRENT_OFFSET = OFFSET * page CURRENT_OFFSET = int(OFFSET + (page * LIMIT))
sparql = SPARQLWrapper.SPARQLWrapper(BASE_URL) sparql = SPARQLWrapper.SPARQLWrapper(BASE_URL)
sparql.setReturnFormat(TYPE) sparql.setReturnFormat(TYPE)