RessourceLoader NullPointer gefixed
All checks were successful
Productdefinitions Build & Deploy / deploy (push) Successful in 39s
All checks were successful
Productdefinitions Build & Deploy / deploy (push) Successful in 39s
This commit is contained in:
@@ -33,18 +33,15 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
import static org.eclipse.rdf4j.model.util.Values.iri;
|
import static org.eclipse.rdf4j.model.util.Values.iri;
|
||||||
|
|
||||||
@Service
|
|
||||||
public class AprioriService {
|
public class AprioriService {
|
||||||
|
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
||||||
@Autowired
|
|
||||||
private ResourceLoader resourceLoader;
|
|
||||||
|
|
||||||
public String getProductsResponse(ProductsRequest productsRequest) {
|
public String getProductsResponse(ProductsRequest productsRequest) {
|
||||||
Repository repo = new SailRepository(new MemoryStore());
|
Repository repo = new SailRepository(new MemoryStore());
|
||||||
repo.init();
|
repo.init();
|
||||||
|
|
||||||
try (RepositoryConnection conn = repo.getConnection()) {
|
try (RepositoryConnection conn = repo.getConnection()) {
|
||||||
Resource resource = resourceLoader.getResource("classpath:data/prodelements.ttl");
|
Resource resource = resolver.getResource("classpath:data/prodelements.ttl");
|
||||||
conn.add(resource.getInputStream(), "", RDFFormat.TURTLE);
|
conn.add(resource.getInputStream(), "", RDFFormat.TURTLE);
|
||||||
|
|
||||||
String queryString = """
|
String queryString = """
|
||||||
@@ -115,7 +112,7 @@ public class AprioriService {
|
|||||||
repo.init();
|
repo.init();
|
||||||
|
|
||||||
try (RepositoryConnection conn = repo.getConnection()) {
|
try (RepositoryConnection conn = repo.getConnection()) {
|
||||||
Resource resource = resourceLoader.getResource("classpath:data/Attribute.ttl");
|
Resource resource = resolver.getResource("classpath:data/Attribute.ttl");
|
||||||
conn.add(resource.getInputStream(), "", RDFFormat.TURTLE);
|
conn.add(resource.getInputStream(), "", RDFFormat.TURTLE);
|
||||||
|
|
||||||
String queryString = """
|
String queryString = """
|
||||||
@@ -158,7 +155,7 @@ public class AprioriService {
|
|||||||
repo.init();
|
repo.init();
|
||||||
|
|
||||||
try (RepositoryConnection conn = repo.getConnection()) {
|
try (RepositoryConnection conn = repo.getConnection()) {
|
||||||
Resource resource = resourceLoader.getResource("classpath:data/Attribute.ttl");
|
Resource resource = resolver.getResource("classpath:data/Attribute.ttl");
|
||||||
conn.add(resource.getInputStream(), "", RDFFormat.TURTLE);
|
conn.add(resource.getInputStream(), "", RDFFormat.TURTLE);
|
||||||
|
|
||||||
String queryString = """
|
String queryString = """
|
||||||
@@ -201,7 +198,7 @@ public class AprioriService {
|
|||||||
repo.init();
|
repo.init();
|
||||||
|
|
||||||
try (RepositoryConnection conn = repo.getConnection()) {
|
try (RepositoryConnection conn = repo.getConnection()) {
|
||||||
Resource resource = resourceLoader.getResource("classpath:data/Attribute.ttl");
|
Resource resource = resolver.getResource("classpath:data/Attribute.ttl");
|
||||||
conn.add(resource.getInputStream(), "", RDFFormat.TURTLE);
|
conn.add(resource.getInputStream(), "", RDFFormat.TURTLE);
|
||||||
|
|
||||||
String queryString = """
|
String queryString = """
|
||||||
@@ -240,7 +237,7 @@ public class AprioriService {
|
|||||||
repo.init();
|
repo.init();
|
||||||
|
|
||||||
try (RepositoryConnection conn = repo.getConnection()) {
|
try (RepositoryConnection conn = repo.getConnection()) {
|
||||||
Resource resource = resourceLoader.getResource("classpath:data/Attribute.ttl");
|
Resource resource = resolver.getResource("classpath:data/Attribute.ttl");
|
||||||
conn.add(resource.getInputStream(), "", RDFFormat.TURTLE);
|
conn.add(resource.getInputStream(), "", RDFFormat.TURTLE);
|
||||||
|
|
||||||
String queryString = """
|
String queryString = """
|
||||||
|
|||||||
Reference in New Issue
Block a user