Skip to content

Commit

Permalink
ble
Browse files Browse the repository at this point in the history
  • Loading branch information
langens-jonathan committed Sep 3, 2016
0 parents commit 0483718
Show file tree
Hide file tree
Showing 25 changed files with 2,408 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea
*.iml
.idea_modules
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM tomcat

COPY target/SCOPES-ENDPOINT-1.0-SNAPSHOT.war /usr/local/tomcat/webapps/scopes.war

EXPOSE 8080
3 changes: 3 additions & 0 deletions Dockerfile~
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM tomcat

COPY target/SCOPES-ENDPOINT-1.0-SNAPSHOT.war /usr/local/tomcat/webapps/scopes.war
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Jonathan Langens

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Query Pre Processor

The query pre processor is a micro-service that calculates the real difference that a query will have on a database
25 changes: 25 additions & 0 deletions README.md~
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# JAVA TEMPLATE
A java template that has SPRING MVC and SESAME set up and working out of the box. It also has some support functionality for easier querying the RDF store.

## Renaming the microservice

Steps needed to rename your microservice:
1. in the pom.xml replace the artifactId with the name your service will have.
2. in src/main/webapp/WEB-INF/web.xml replace the display name.
3. in src/main/webapp/WEB-INF/web.xml replace the servlet-name (2 locations!)
4. rename the java_template package

## Example

For the example scenario to work read the README under example/

## TODO'S

### Logger

There should be a default logger inserted in the template.

### Query builder

A query builder would be a great help for this template, the main objectives would be:
<ol><li>Facilitate query construction</li><li>Protect against SPARQL injection</li></ol>
59 changes: 59 additions & 0 deletions insert-this-into-your-store-or-none-of-this-shit-will-work.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
prefix mu:<http://mu.semte.ch/vocabularies/core/>
prefix foaf:<http://xmlns.com/foaf/0.1/>

insert
{
<http://mu.semte.ch/graphs/personalGraph1> <mu:uuid> "PERSONALGRAPH1";
<foaf:name> "Personal Graph 1";
<mu:graphType> "personal";
a <mu:Graph>.
<http://mu.semte.ch/graphs/personalGraph2> <mu:uuid> "PERSONALGRAPH2";
<foaf:name> "Personal Graph 2";
<mu:graphType> "personal";
a <mu:Graph>.
<http://mu.semte.ch/graphs/personalGraph3> <mu:uuid> "PERSONALGRAPH3";
<foaf:name> "Personal Graph 3";
<mu:graphType> "personal";
a <mu:Graph>.

<http://mu.semte.ch/graphs/graph1> <mu:uuid> "GRAPH1";
<foaf:name> "Graph 1";
<mu:graphType> "hive";
a <mu:Graph>.
<http://mu.semte.ch/graphs/graph2> <mu:uuid> "GRAPH2";
<foaf:name> "Graph 2";
<mu:graphType> "hive";
a <mu:Graph>.

<user/jonathan> mu:hasAccessToGraph <http://mu.semte.ch/graphs/personalGraph1>,
<http://mu.semte.ch/graphs/graph1>,
<http://mu.semte.ch/graphs/graph2>;
mu:uuid "JONATHANUUID";
mu:hasNode <node1>, <node2>, <node3>.

<node1> mu:forGraph <http://mu.semte.ch/graphs/personalGraph1>.
<node2> mu:forGraph <http://mu.semte.ch/graphs/graph1>; mu:hasParent <node1>.
<node3> mu:forGraph <http://mu.semte.ch/graphs/graph2>.


<user/aad> mu:hasAccessToGraph <http://mu.semte.ch/graphs/personalGraph2>,
<http://mu.semte.ch/graphs/graph1>,
<http://mu.semte.ch/graphs/graph2>;
mu:uuid "AADUUID";
mu:hasNode <node4>, <node5>, <node6>.

<node4> mu:forGraph <http://mu.semte.ch/graphs/personalGraph2>.
<node5> mu:forGraph <http://mu.semte.ch/graphs/graph1>; mu:hasParent <node1>.
<node6> mu:forGraph <http://mu.semte.ch/graphs/graph2>.



<user/erika> mu:hasAccessToGraph <http://mu.semte.ch/graphs/personalGraph3>,
<http://mu.semte.ch/graphs/graph1>,
<http://mu.semte.ch/graphs/graph2>;
mu:uuid "ERIKAUUID";
mu:hasNode <node7>, <node8>.

<node7> mu:forGraph <http://mu.semte.ch/graphs/personalGraph1>.
<node8> mu:forGraph <http://mu.semte.ch/graphs/graph2>.
}
192 changes: 192 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>mu-semtech</groupId>
<artifactId>SCOPES-ENDPOINT</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<properties>
<fasterxml.jackson.version>2.6.3</fasterxml.jackson.version>
<guava.version>19.0</guava.version>
<inject.version>1</inject.version>
<openrdf.sesame.version>4.1.0</openrdf.sesame.version>
<springframework.version>4.2.4.RELEASE</springframework.version>
<virtuoso.jdbc-driver.version>4.1</virtuoso.jdbc-driver.version>
<virtuoso.sesame-provider.version>4.0</virtuoso.sesame-provider.version>
<slf4j.version>1.7.7</slf4j.version>
<logback.version>1.1.2</logback.version>
</properties>

<dependencies>

<dependency>
<groupId>com.tenforce.semtech</groupId>
<artifactId>SPARQL-parser</artifactId>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.openrdf.sesame</groupId>
<artifactId>sesame-runtime</artifactId>
</dependency>
<dependency>
<groupId>virtuoso</groupId>
<artifactId>jdbc-driver</artifactId>
</dependency>
<dependency>
<groupId>virtuoso</groupId>
<artifactId>sesame-provider</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>

</dependencies>

<dependencyManagement>
<dependencies>

<dependency>
<groupId>com.tenforce.semtech</groupId>
<artifactId>SPARQL-parser</artifactId>
<version>0.0.3-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>


<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${fasterxml.jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${fasterxml.jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${fasterxml.jackson.version}</version>
</dependency>

<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>${inject.version}</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${springframework.version}</version>
</dependency>


<dependency>
<groupId>org.openrdf.sesame</groupId>
<artifactId>sesame-runtime</artifactId>
<version>${openrdf.sesame.version}</version>
</dependency>
<dependency>
<groupId>virtuoso</groupId>
<artifactId>jdbc-driver</artifactId>
<version>${virtuoso.jdbc-driver.version}</version>
</dependency>
<dependency>
<groupId>virtuoso</groupId>
<artifactId>sesame-provider</artifactId>
<version>${virtuoso.sesame-provider.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
</dependencies>

</dependencyManagement>

</project>
30 changes: 30 additions & 0 deletions src/main/java/scopes_service/config/Configuration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package scopes_service.config;

/**
* Created by jonathan-langens on 3/7/16.
*
* This file contains configuration constants used in all microservices
*/
public class Configuration {
/**
* PREFIXES
*/
public final static String prefixUsers = "http://users.com/";
public final static String prefixObjects = "http://objects.com/";
public final static String prefixMu = "http://mu.semte.ch/vocabularies/";
public final static String prefixAuth = "http://mu.semte.ch/vocabularies/authorization/";
public final static String prefixUUID = "http://mu.semte.ch/vocabularies/core/uuid";

/**
* PREDICATES
*/
public final static String predicateAuthBelongsTo = "auth:belongsTo";
public final static String predicateCanUpdate = "auth:canUpdate";
public final static String predicateCanRead = "auth:canRead";

/**
* DEFINITIONS
*/
public final static String definitionUser = "users:class";
public final static String definitionUserGroup = "auth:Group";
}
Loading

0 comments on commit 0483718

Please sign in to comment.