Skip to content

Commit d8b6895

Browse files
committed
Clean pom and 1st Sample
1 parent 8bef1ff commit d8b6895

3 files changed

Lines changed: 46 additions & 41 deletions

File tree

  • data/semantickernel-data-oracle
  • samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/data/vectorstores/oracle

data/semantickernel-data-oracle/pom.xml

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,10 @@
2929
</dependencyManagement>
3030

3131
<dependencies>
32-
<dependency>
33-
<groupId>com.microsoft.semantic-kernel</groupId>
34-
<artifactId>semantickernel-api-data</artifactId>
35-
</dependency>
3632
<dependency>
3733
<groupId>com.microsoft.semantic-kernel</groupId>
3834
<artifactId>semantickernel-data-jdbc</artifactId>
3935
</dependency>
40-
<dependency>
41-
<groupId>org.slf4j</groupId>
42-
<artifactId>slf4j-api</artifactId>
43-
</dependency>
4436
<dependency>
4537
<groupId>com.fasterxml.jackson.core</groupId>
4638
<artifactId>jackson-databind</artifactId>
@@ -51,38 +43,6 @@
5143
<artifactId>jackson-core</artifactId>
5244
<scope>compile</scope>
5345
</dependency>
54-
<dependency>
55-
<groupId>com.github.jknack</groupId>
56-
<artifactId>handlebars</artifactId>
57-
</dependency>
58-
<dependency>
59-
<groupId>com.google.code.findbugs</groupId>
60-
<artifactId>jsr305</artifactId>
61-
<scope>provided</scope>
62-
</dependency>
63-
<dependency>
64-
<groupId>com.fasterxml.jackson.dataformat</groupId>
65-
<artifactId>jackson-dataformat-yaml</artifactId>
66-
<scope>compile</scope>
67-
</dependency>
68-
<dependency>
69-
<groupId>com.github.spotbugs</groupId>
70-
<artifactId>spotbugs-annotations</artifactId>
71-
</dependency>
72-
<dependency>
73-
<groupId>org.apache.commons</groupId>
74-
<artifactId>commons-text</artifactId>
75-
</dependency>
76-
<dependency>
77-
<groupId>org.postgresql</groupId>
78-
<artifactId>postgresql</artifactId>
79-
<version>42.7.4</version>
80-
</dependency>
81-
<dependency>
82-
<groupId>org.xerial</groupId>
83-
<artifactId>sqlite-jdbc</artifactId>
84-
<version>3.47.0.0</version>
85-
</dependency>
8646
<dependency>
8747
<groupId>com.oracle.database.jdbc</groupId>
8848
<artifactId>ojdbc11</artifactId>

data/semantickernel-data-oracle/src/test/resources/initialize.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ WHENEVER SQLERROR EXIT SQL.SQLCODEAdd commentMore actions
44
-- Configure the size of the Vector Pool to 1 GiB.
55
ALTER SYSTEM SET vector_memory_size=1G SCOPE=SPFILE;
66

7+
sqlplus / as sysdba
8+
79
SHUTDOWN ABORT;
810
STARTUP;
911

10-
exit;
12+
exit
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright (c) Microsoft. All rights reserved.
2+
package com.microsoft.semantickernel.samples.documentationexamples.data.vectorstores.oracle;
3+
4+
import com.microsoft.semantickernel.data.jdbc.JDBCVectorStore;
5+
import com.microsoft.semantickernel.data.jdbc.JDBCVectorStoreOptions;
6+
import com.microsoft.semantickernel.data.jdbc.JDBCVectorStoreRecordCollection;
7+
import com.microsoft.semantickernel.data.jdbc.JDBCVectorStoreRecordCollectionOptions;
8+
import com.microsoft.semantickernel.data.jdbc.postgres.PostgreSQLVectorStoreQueryProvider;
9+
import com.microsoft.semantickernel.samples.documentationexamples.data.index.Hotel;
10+
11+
public class Main {
12+
public static void main(String[] args) {
13+
// Configure the data source
14+
OracleDataSource dataSource = new OracleDataSource();
15+
dataSource.setURL("jdbc:oracle:thin:@localhost:1521/FREEPDB1");
16+
dataSource.setUser("scott");
17+
dataSource.setPassword("tiger");
18+
19+
// Build a query provider
20+
OracleVectorStoreQueryProvider queryProvider = OracleVectorStoreQueryProvider.builder()
21+
.withDataSource(dataSource)
22+
.build();
23+
24+
// Build a vector store
25+
JDBCVectorStore vectorStore = JDBCVectorStore.builder()
26+
.withDataSource(dataSource)
27+
.withOptions(JDBCVectorStoreOptions.builder()
28+
.withQueryProvider(queryProvider)
29+
.build())
30+
.build();
31+
32+
VectorStoreRecordCollection<String, Hotel> collection = vectorStore.getCollection(
33+
"skhotels",
34+
JDBCVectorStoreRecordCollectionOptions.<Hotel>builder()
35+
.withRecordClass(Hotel.class)
36+
.build());
37+
38+
// Create the collection if it doesn't exist yet.
39+
collection.createCollectionIfNotExistsAsync().block();
40+
41+
collection.upsertBatchAsync(getHotels(), null).block();
42+
}
43+
}

0 commit comments

Comments
 (0)