forked from kevin.shehu/GGD
parent
710726c5ef
commit
fd96876544
|
@ -1,5 +0,0 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<option name="RIGHT_MARGIN" value="80" />
|
||||
</code_scheme>
|
||||
</component>
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
|
@ -1,6 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="JavaScriptSettings">
|
||||
<option name="languageLevel" value="ES6" />
|
||||
</component>
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
|
@ -8,7 +11,7 @@
|
|||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_14_PREVIEW" default="false" project-jdk-name="14.0.1" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
|
@ -14,6 +14,7 @@ The list of inferred active goals is offered to other services of the system.
|
|||
**Rules (General structure, if premises then consequence)**
|
||||
1. Explicit given by expert (before and during runtime)
|
||||
2. Trained through AI
|
||||
|
||||
**Goals**
|
||||
1. Actions that should be taken by the user to be successful.
|
||||
2. Goals can be active and inactive.
|
||||
|
|
16
pom.xml
16
pom.xml
|
@ -13,8 +13,8 @@
|
|||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>7</source>
|
||||
<target>7</target>
|
||||
<source>11</source>
|
||||
<target>11</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
@ -47,6 +47,18 @@
|
|||
<artifactId>javax.json</artifactId>
|
||||
<version>1.1.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20201115</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
|
||||
|
||||
|
||||
import org.eclipse.jetty.http.HttpHeader;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.net.PasswordAuthentication;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpHeaders;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
|
||||
public class ApiCall {
|
||||
private static String token ="0";
|
||||
private static String oldId="1";
|
||||
|
||||
public static String FetchDataFromApi(String extension) throws InterruptedException, ExecutionException, TimeoutException {
|
||||
|
||||
final String username = "kevin.shehu@hochschule-rhein-waal.de";
|
||||
final String password = "DK7SxFkGJgnLhnU3";
|
||||
String baseURL = "https://api.dev.whysor.com/";
|
||||
String outputToken = null;
|
||||
|
||||
if (token.equals(oldId)){
|
||||
//do nothing
|
||||
}
|
||||
else {
|
||||
SecurityToken securityToken = new SecurityToken();
|
||||
try {
|
||||
outputToken = securityToken.OnCallMethod(username,password);
|
||||
JSONObject obj = new JSONObject(outputToken);
|
||||
token = obj.getString("id");
|
||||
oldId = token;
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
} catch (ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
} catch (TimeoutException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
System.out.println(token);
|
||||
var client = HttpClient.newBuilder()
|
||||
.version(HttpClient.Version.HTTP_1_1)
|
||||
.followRedirects(HttpClient.Redirect.ALWAYS)
|
||||
.build();
|
||||
HttpRequest request = null;
|
||||
|
||||
try {
|
||||
|
||||
request = HttpRequest.newBuilder(new URI(baseURL+extension))
|
||||
.POST(HttpRequest.BodyPublishers.ofString(extension))
|
||||
.setHeader("Authorization" , token)
|
||||
.setHeader("Content-Type", "application/json")
|
||||
.setHeader("Accept", "application/json")
|
||||
.build();
|
||||
|
||||
} catch (URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
CompletableFuture<HttpResponse<String>> response = client.sendAsync(request, HttpResponse.BodyHandlers.ofString());
|
||||
String result = response.thenApply(HttpResponse::body).get(5, TimeUnit.SECONDS);
|
||||
return result;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
{
|
||||
"desc" : "Distances between several cities, in kilometers.",
|
||||
"updated" : "2014-02-04T18:50:45",
|
||||
"uptodate": true,
|
||||
"author" : null,
|
||||
"cities" : {
|
||||
"Brussels": [
|
||||
{"to": "London", "distance": 322},
|
||||
{"to": "Paris", "distance": 265},
|
||||
{"to": "Amsterdam", "distance": 173}
|
||||
],
|
||||
"London": [
|
||||
{"to": "Brussels", "distance": 322},
|
||||
{"to": "Paris", "distance": 344},
|
||||
{"to": "Amsterdam", "distance": 358}
|
||||
],
|
||||
"Paris": [
|
||||
{"to": "Brussels", "distance": 265},
|
||||
{"to": "London", "distance": 344},
|
||||
{"to": "Amsterdam", "distance": 431}
|
||||
],
|
||||
"Amsterdam": [
|
||||
{"to": "Brussels", "distance": 173},
|
||||
{"to": "London", "distance": 358},
|
||||
{"to": "Paris", "distance": 431}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1,17 +1,16 @@
|
|||
package JSON2RDF;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Reader;
|
||||
import java.io.*;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
import org.apache.jena.riot.system.StreamRDF;
|
||||
import org.apache.jena.riot.system.StreamRDFLib;
|
||||
import picocli.CommandLine;
|
||||
|
@ -21,14 +20,24 @@ public class JSON2RDF {
|
|||
private final InputStream jsonIn;
|
||||
private final OutputStream rdfOut;
|
||||
|
||||
@CommandLine.Parameters(paramLabel = "base", index = "0", description = "Base URI of the RDF output data\nExample: https://localhost/")
|
||||
|
||||
@CommandLine.Parameters(paramLabel = "https://localhost/" , index = "0", description = "Base URI of the RDF output data")
|
||||
private URI baseURI;
|
||||
|
||||
{
|
||||
try {
|
||||
baseURI = new URI("https://localhost/");
|
||||
} catch (URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// @CommandLine.Parameters(paramLabel = "D:\\WORK\\GGD\\src\\main\\java\\Data", description = "json file")
|
||||
@CommandLine.Option(names = { "--input-charset" }, description = "Input charset (default: ${DEFAULT-VALUE})")
|
||||
private Charset inputCharset = StandardCharsets.UTF_8;
|
||||
private final Charset inputCharset = StandardCharsets.UTF_8;
|
||||
|
||||
@CommandLine.Option(names = { "--output-charset" }, description = "Output charset (default: ${DEFAULT-VALUE})")
|
||||
private Charset outputCharset = StandardCharsets.UTF_8;
|
||||
private final Charset outputCharset = StandardCharsets.UTF_8;
|
||||
|
||||
public static void main(String[] args) throws IOException
|
||||
{
|
||||
|
@ -46,14 +55,15 @@ public class JSON2RDF {
|
|||
}
|
||||
}
|
||||
|
||||
public JSON2RDF(InputStream csvIn, OutputStream rdfOut)
|
||||
{
|
||||
public JSON2RDF(InputStream csvIn, OutputStream rdfOut) {
|
||||
|
||||
|
||||
this.jsonIn = csvIn;
|
||||
this.rdfOut = rdfOut;
|
||||
}
|
||||
|
||||
public void convert() throws IOException
|
||||
{
|
||||
|
||||
public void convert() throws IOException {
|
||||
if (jsonIn.available() == 0) throw new IllegalStateException("JSON input not provided");
|
||||
|
||||
try (Reader reader = new BufferedReader(new InputStreamReader(jsonIn, inputCharset)))
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
import java.util.TimerTask;
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
// Create a class extends with TimerTask
|
||||
public class ScheduledTask extends TimerTask {
|
||||
|
||||
Date now; // to display current time
|
||||
|
||||
// Add your task here
|
||||
public void run() {
|
||||
// Display current time
|
||||
now = new Date(); // initialize date
|
||||
System.out.println("Time is :" + now);
|
||||
ApiCall apiCall = new ApiCall();
|
||||
String output = null;
|
||||
try {
|
||||
output = apiCall.FetchDataFromApi("devices");
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
} catch (ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
} catch (TimeoutException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("Output :" + output); // Display current output
|
||||
}
|
||||
}
|
|
@ -1,23 +1,18 @@
|
|||
package JSON2RDF;
|
||||
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.util.Base64;
|
||||
|
||||
public class ApiCallYookr {
|
||||
public static void main(String[] args) {
|
||||
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
public class SecurityToken {
|
||||
public static String OnCallMethod(String username, String password) throws InterruptedException, ExecutionException, TimeoutException {
|
||||
//CONFIG PARAMETERS:
|
||||
//BEGIN------------CONFIG PARAMETERS BELOW TO YOUR ENVIRONMENT---------------------------------------
|
||||
String baseURL = "https://api.dev.whysor.com/users/login";
|
||||
final String username = "kevin.shehu@hochschule-rhein-waal.de";
|
||||
final String password = "DK7SxFkGJgnLhnU3";
|
||||
final String body= String.format("{\"email\": \"%s\", \"password\": \"%s\", \"domain\": \"my.dev.yookr.org\"}", username, password);
|
||||
|
||||
var client = HttpClient.newBuilder()
|
||||
|
@ -37,12 +32,19 @@ public class ApiCallYookr {
|
|||
} catch (URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
|
||||
.thenApply(HttpResponse::body)
|
||||
.thenAccept(System.out::println)
|
||||
.join();
|
||||
// client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
|
||||
// .thenApply(HttpResponse::body)
|
||||
// .thenAccept(System.out::println)
|
||||
// .join();
|
||||
|
||||
CompletableFuture<HttpResponse<String>> response = client.sendAsync(request, HttpResponse.BodyHandlers.ofString());
|
||||
String result = response.thenApply(HttpResponse::body).get(5, TimeUnit.SECONDS);
|
||||
return result;
|
||||
// return HttpResponse.BodyHandlers.ofFile(Paths.get("D:\\WORK\\GGD\\src\\main\\java\\Data\\securityToken.json"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1,49 +1,18 @@
|
|||
|
||||
import JSON2RDF.JSON2RDF;
|
||||
import org.apache.jena.rdf.model.*;
|
||||
import org.apache.jena.vocabulary.*;
|
||||
import java.util.Timer;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
public class main {
|
||||
public static void main (String args[]) {
|
||||
public static void main(String[] args){
|
||||
|
||||
Timer time = new Timer(); // Instantiate Timer Object
|
||||
ScheduledTask scheduledTask = new ScheduledTask(); // Instantiate SheduledTask class
|
||||
time.schedule(scheduledTask, 0, 1000 ); // Create Repetitively task for every 1 secs
|
||||
|
||||
// some definitions
|
||||
String personURI = "http://localhost:3030/GGD/JohnSmith";
|
||||
String givenName = "John";
|
||||
String familyName = "Smith";
|
||||
String fullName = givenName + " " + familyName;
|
||||
// create an empty model
|
||||
Model model = ModelFactory.createDefaultModel();
|
||||
|
||||
// create the resource
|
||||
// and add the properties cascading style
|
||||
Resource johnSmith
|
||||
= model.createResource(personURI)
|
||||
.addProperty(VCARD.FN, fullName)
|
||||
.addProperty(VCARD.N,
|
||||
model.createResource()
|
||||
.addProperty(VCARD.Given, givenName)
|
||||
.addProperty(VCARD.Family, familyName));
|
||||
|
||||
// list the statements in the graph
|
||||
StmtIterator iter = model.listStatements();
|
||||
|
||||
// print out the predicate, subject and object of each statement
|
||||
while (iter.hasNext()) {
|
||||
Statement stmt = iter.nextStatement(); // get next statement
|
||||
Resource subject = stmt.getSubject(); // get the subject
|
||||
Property predicate = stmt.getPredicate(); // get the predicate
|
||||
RDFNode object = stmt.getObject(); // get the object
|
||||
|
||||
System.out.print(subject.toString());
|
||||
System.out.print(" " + predicate.toString() + " ");
|
||||
if (object instanceof Resource) {
|
||||
System.out.print(object.toString());
|
||||
} else {
|
||||
// object is a literal
|
||||
System.out.print(" \"" + object.toString() + "\"");
|
||||
}
|
||||
System.out.println(" .");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue