@@ -3,7 +3,6 @@ package bulk
33import (
44 "bytes"
55 "errors"
6- "fmt"
76 "io"
87 "net/http"
98 "strings"
@@ -37,7 +36,7 @@ func BulkLoad(v1 *viper.Viper, mc *minio.Client, bucketName string, item string)
3736
3837 // check for the required bulk endpoint, no need to move on from here
3938 if spql .URL == "" {
40- return "" , errors .New ("The configuration file lacks an endpointBulk entry" )
39+ return "" , errors .New ("configuration file lacks an endpointBulk entry" )
4140 }
4241
4342 log .Printf ("Object %s:%s for %s with method %s type %s" , bucketName , item , ep , md , ct )
@@ -53,12 +52,13 @@ func BulkLoad(v1 *viper.Viper, mc *minio.Client, bucketName string, item string)
5352 // Review if this graph g should b here since we are loading quads
5453 // I don't think it should b. validate with all the tested triple stores
5554 //bn := strings.Replace(bucketName, ".", ":", -1) // convert to urn : values, buckets with . are not valid IRIs
56- g , err := graph .MakeURN (v1 , item )
55+ // g, err := graph.MakeURN(v1, item)
5756 if err != nil {
5857 log .Error ("gets3Bytes %v\n " , err )
5958 return "" , err // Assume return. since on this error things are not good?
6059 }
61- url := fmt .Sprintf ("%s?graph=%s" , ep , g )
60+ //url := fmt.Sprintf("%s?graph=%s", ep, g) // NOTE 11-13-2023 ?graph with nquads fails with Oxigraph
61+ url := ep // testing
6262
6363 // check if JSON-LD and convert to RDF
6464 if strings .Contains (item , ".jsonld" ) {
@@ -73,8 +73,16 @@ func BulkLoad(v1 *viper.Viper, mc *minio.Client, bucketName string, item string)
7373 if err != nil {
7474 return "" , err
7575 }
76- req .Header .Set ("Content-Type" , ct ) // needs to be x-nquads for blaze, n-quads for jena and graphdb
77- req .Header .Set ("User-Agent" , "EarthCube_DataBot/1.0" )
76+
77+ headers := map [string ]string {
78+ "Content-Type" : ct , // replace value with actual content
79+ "User-Agent" : "EarthCube_DataBot/1.0" ,
80+ // add other headers here
81+ }
82+
83+ for k , v := range headers {
84+ req .Header .Add (k , v )
85+ }
7886
7987 client := & http.Client {}
8088 resp , err := client .Do (req )
@@ -87,16 +95,15 @@ func BulkLoad(v1 *viper.Viper, mc *minio.Client, bucketName string, item string)
8795 }
8896 }(resp .Body )
8997
90- log .Println (resp )
91- body , err := io .ReadAll (resp .Body ) // return body if you want to debugg test with it
98+ body , err := io .ReadAll (resp .Body ) // return body if you want to debug test with it
9299 if err != nil {
93100 log .Println (string (body ))
94101 return string (body ), err
95102 }
96103
97104 // report
98105 log .Println (string (body ))
99- log .Printf ("success : %s : %d : %s\n " , item , len (b ), ep )
106+ log .Printf ("status : %s : %d : %s\n " , item , len (b ), ep )
100107
101108 return string (body ), err
102109}
0 commit comments