Skip to content

Commit

Permalink
fix sparql insert annotatedAt
Browse files Browse the repository at this point in the history
  • Loading branch information
heinpa committed Aug 13, 2020
1 parent 5c9094a commit 2c20d85
Show file tree
Hide file tree
Showing 68 changed files with 88 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
+ " ] ; " //
+ " oa:hasBody <" + urls + "> ;" //
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ; " //
+ " oa:AnnotatedAt ?time " //
+ " oa:annotatedAt ?time " //
+ "}} " //
+ "WHERE { " //
+ "BIND (IRI(str(RAND())) AS ?a) ." //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) {
+ " ] . " //
+ " ?a oa:hasBody <" + urls + "> ;" //
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ; " //
+ " oa:AnnotatedAt ?time " //
+ " oa:annotatedAt ?time " //
+ "}} " + "WHERE { "//
+ "BIND (IRI(str(RAND())) AS ?a) ." //
+ "BIND (now() as ?time) " //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
+ " ] ; " //
+ " oa:hasBody <" + urls + "> ;" //
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ; " //
+ " oa:AnnotatedAt ?time " //
+ " oa:annotatedAt ?time " //
+ "}} " //
+ "WHERE { " //
+ "BIND (IRI(str(RAND())) AS ?a) ." //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
+ " ] . "
+ " ?a oa:hasBody <" + l.link + "> ;"
+ " oa:annotatedBy <http://agdistis.aksw.org> ; "
+ " oa:AnnotatedAt ?time "
+ " oa:annotatedAt ?time "
+ "}} "
+ "WHERE { "
+ "BIND (IRI(str(RAND())) AS ?a) ."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import eu.wdaqua.qanary.commons.QanaryMessage;
Expand All @@ -36,6 +37,7 @@ public class AmbiverseNed extends QanaryComponent {
private String urlAccessToken = "https://api.ambiverse.com/oauth/token"; // TODO: move to application.properties
private String urlEntityLinkServicePlain = "api.ambiverse.com/v2/entitylinking/analyze"; // TODO: move to
// application.properties
private String applicationName;

private String urlEntityLinkService;
private String[] accessTokenCmd;
Expand All @@ -44,9 +46,11 @@ public class AmbiverseNed extends QanaryComponent {
* constructor calling super constructor and showing printing the used command
* into the info console
*/
public AmbiverseNed() {
public AmbiverseNed(@Value("${spring.application.name}") final String applicationName) {
super();

this.applicationName = applicationName;

urlEntityLinkService = "https://" + urlEntityLinkServicePlain;
String[] accessTokenCmd = { "curl", "-X", "POST", "--header", "Content-Type: application/x-www-form-urlencoded",
"-d", "grant_type=client_credentials", "-d", "client_id=" + CLIENT_ID, "-d",
Expand Down Expand Up @@ -172,7 +176,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
+ " ] " //
+ " ] . " //
+ " ?a oa:hasBody <" + s.link + "> ;" //
+ " oa:annotatedBy <urn:qanary.NED#" + urlEntityLinkService + "> ; " //
+ " oa:annotatedBy <urn:qanary.NED#" + this.applicationName + "> ; " //
+ " oa:annotatedAt ?time " + "}} " //
+ "WHERE { " //
+ " BIND (IRI(str(RAND())) AS ?a) ."//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
+ " ] . " //
+ " ?a oa:hasBody <" + l.link + "> ;" //
+ " oa:annotatedBy <https://api.aylien.com/api/v1/concepts> ; " //
+ " oa:AnnotatedAt ?time " + "}} " //
+ " oa:annotatedAt ?time " + "}} " //
+ "WHERE { " //
+ " BIND (IRI(str(RAND())) AS ?a) ."//
+ " BIND (now() as ?time) " //
Expand Down
2 changes: 1 addition & 1 deletion qanary_component-NED-Babelfy/TagmeNED.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
+ " ] . " //
+ " ?a oa:hasBody <" + l.link + "> ;" //
+ " oa:annotatedBy <https:tagmeNED.com> ; " //
+ " oa:AnnotatedAt ?time " + "}} " //
+ " oa:annotatedAt ?time " + "}} " //
+ "WHERE { " //
+ " BIND (IRI(str(RAND())) AS ?a) ."//
+ " BIND (now() as ?time) " //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
+ " ] . " //
+ " ?a oa:hasBody <" + l.link + "> ;" //
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ; " //
+ " oa:AnnotatedAt ?time " + "}} " //
+ " oa:annotatedAt ?time " + "}} " //
+ "WHERE { " //
+ " BIND (IRI(str(RAND())) AS ?a) ."//
+ " BIND (now() as ?time) " //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
+ " ] . " //
+ " ?a oa:hasBody <" + l.link + "> ;" //
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ; " //
+ " oa:AnnotatedAt ?time " + "}} " //
+ " oa:annotatedAt ?time " + "}} " //
+ "WHERE { " //
+ " BIND (IRI(str(RAND())) AS ?a) ."//
+ " BIND (now() as ?time) " //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
+ " ] . " //
+ " ?a oa:hasBody <" + s.link + "> ;" //
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ; " //
+ " oa:AnnotatedAt ?time " + "}} " //
+ " oa:annotatedAt ?time " + "}} " //
+ "WHERE { " //
+ " BIND (IRI(str(RAND())) AS ?a) ."//
+ " BIND (now() as ?time) " //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
+ " ] . " //
+ " ?a oa:hasBody <" + l.link + "> ;" //
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ; " //
+ " oa:AnnotatedAt ?time " + "}} " //
+ " oa:annotatedAt ?time " + "}} " //
+ "WHERE { " //
+ " BIND (IRI(str(RAND())) AS ?a) ."//
+ " BIND (now() as ?time) " //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
+ " ] . " //
+ " ?a oa:hasBody <" + l.link + "> ;" //
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ; " //
+ " oa:AnnotatedAt ?time " + "}} " //
+ " oa:annotatedAt ?time " + "}} " //
+ "WHERE { " //
+ " BIND (IRI(str(RAND())) AS ?a) ."//
+ " BIND (now() as ?time) " //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
+ " ] " //
+ " ] ; " //
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ; " //
+ " oa:AnnotatedAt ?time " //
+ " oa:annotatedAt ?time " //
+ "}} " //
+ "WHERE { " //
+ "BIND (IRI(str(RAND())) AS ?a) ." //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
+ " ] " //
+ " ] ; " //
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ; " //
+ " oa:AnnotatedAt ?time " //
+ " oa:annotatedAt ?time " //
+ "}} " //
+ "WHERE { " //
+ "BIND (IRI(str(RAND())) AS ?a) ." //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) {
+ " ] \n" //
+ " ] ; \n" //
+ " oa:annotatedBy <urn:qanary:component:"+this.applicationName+"> ; \n" //
+ " oa:AnnotatedAt ?time \n" //
+ " oa:annotatedAt ?time \n" //
+ "}} \n" //
+ "WHERE { \n" //
+ " BIND (IRI(str(RAND())) AS ?a) .\n" //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) {
+ " oa:end \"" + s.end + "\"^^xsd:nonNegativeInteger " //
+ " ] " //
+ " ] ; " //
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ; " // <http://spotlight.sztaki.hu:2222/rest/spot>
+ " oa:AnnotatedAt ?time " //
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ; " //
+ " oa:annotatedAt ?time " //
+ "}} " //
+ "WHERE { " //
+ "BIND (IRI(str(RAND())) AS ?a) ." //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
</head>
<body>
<p th:text="'Hello World, this is my first Qanary service!'" />
<a th:text="'Read more about Sztaki Spotlight'" th:href="'http://spotlight.sztaki.hu:2222/rest/spot'" />
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
+ " ] " //
+ " ] ; " //
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ; " //
+ " oa:AnnotatedAt ?time " //
+ " oa:annotatedAt ?time " //
+ "}} " //
+ "WHERE { " //
+ "BIND (IRI(str(RAND())) AS ?a) ." //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
+ " ] " //
+ " ] ; " //
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ; " //
+ " oa:AnnotatedAt ?time " //
+ " oa:annotatedAt ?time " //
+ "}} " //
+ "WHERE { " //
+ "BIND (IRI(str(RAND())) AS ?a) ." //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
+ " oa:end ?end " //
+ " ] " //
+ " ] ; " //
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ;" // <http://fox-demo.aksw.org>
+ " oa:AnnotatedAt ?time " //
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ;" //
+ " oa:annotatedAt ?time " //
+ "}} " //
+ "WHERE { " //
+ " SELECT ?a ?s ?begin ?end ?time " //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
</head>
<body>
<p th:text="'Hello World, this is my first Qanary service!'" />
<a th:text="'Read more about FOX'" th:href="'http://fox-demo.aksw.org'" />
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package eu.wdaqua.qanary.meaningcloud;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
Expand All @@ -25,8 +26,8 @@ public class Application {
* @return
*/
@Bean
public QanaryComponent qanaryComponent() {
return new MeaningCloud();
public QanaryComponent qanaryComponent(@Value("${spring.application.name}") final String applicationName) {
return new MeaningCloud(applicationName);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import eu.wdaqua.qanary.commons.QanaryMessage;
Expand All @@ -38,6 +39,12 @@
public class MeaningCloud extends QanaryComponent {
private static final Logger logger = LoggerFactory.getLogger(MeaningCloud.class);

private final String applicationName;

public MeaningCloud(@Value("${spring.application.name}") final String applicationName) {
this.applicationName = applicationName;
}

/**
* implement this method encapsulating the functionality of your Qanary
* component
Expand Down Expand Up @@ -122,8 +129,8 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
+ " oa:hasSelector [ " + " a oa:TextPositionSelector ; "
+ " oa:start \"" + s.begin + "\"^^xsd:nonNegativeInteger ; "
+ " oa:end \"" + s.end + "\"^^xsd:nonNegativeInteger " + " ] "
+ " ] ; " + " oa:annotatedBy <http://meaningCloud.com> ; "
+ " oa:AnnotatedAt ?time " + "}} " + "WHERE { " + "BIND (IRI(str(RAND())) AS ?a) ."
+ " ] ; " + " oa:annotatedBy "+this.applicationName+" ; "
+ " oa:annotatedAt ?time " + "}} " + "WHERE { " + "BIND (IRI(str(RAND())) AS ?a) ."
+ "BIND (now() as ?time) " + "}";
myQanaryUtils.updateTripleStore(sparql, myQanaryMessage.getEndpoint().toString());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<body>
<h1>MeaningCloud</h1>
<p th:text="'Hello World, this is my first Qanary service!'" />
<a th:text="'Read more about MeaningCloud'" th:href="'http://meaningCloud.com'" />
<!--
make a statement about the purpose of your component here
//-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
+ " ] " //
+ " ] ; " //
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ; " //
+ " oa:AnnotatedAt ?time " //
+ " oa:annotatedAt ?time " //
+ "}} " //
+ "WHERE { " //
+ "BIND (IRI(str(RAND())) AS ?a) ." //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
+ " ] " //
+ " ] ; " //
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ; " //
+ " oa:AnnotatedAt ?time " //
+ " oa:annotatedAt ?time " //
+ "}} " //
+ "WHERE { " //
+ "BIND (IRI(str(RAND())) AS ?a) ." //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
+ " ] " //
+ " ] ; " //
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ; " //
+ " oa:AnnotatedAt ?time " //
+ " oa:annotatedAt ?time " //
+ "}} " //
+ "WHERE { " //
+ "BIND (IRI(str(RAND())) AS ?a) ." //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ protected void insertSelectionsIntoQanaryTriplestore(Selection s, QanaryQuestion
+ " oa:end \"" + s.end + "\"^^xsd:nonNegativeInteger " //
+ " ] " //
+ " ] ; " //
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ;" // <http://nlp.stanford.edu/software/CRF-NER.shtml>
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ;" //
+ " oa:annotatedAt ?time " //
+ "}} " //
+ "WHERE { " //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
</head>
<body>
<p th:text="'This is a Qanary service dedicated to recognize Named Entities (NER) using Stanford Core NLP in English questions.'" />
<a th:text="'Read more about Stanford NER'" th:href="'http://nlp.stanford.edu/software/CRF-NER.shtml'" />
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
+ " ] " //
+ " ] ; " //
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ; " //
+ " oa:AnnotatedAt ?time " //
+ " oa:annotatedAt ?time " //
+ "}} " //
+ "WHERE { " //
+ "BIND (IRI(str(RAND())) AS ?a) ." //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) {
+ " ] " //
+ " ] . " //
+ " ?a oa:hasBody <" + a.uri + "> ;" //
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ;" // <http://nlp.stanford.edu/software/CRF-NER.shtml>
+ " oa:AnnotatedAt ?time " //
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ;" //
+ " oa:annotatedAt ?time " //
+ "}} " //
+ "WHERE { " //
+ "BIND (IRI(str(RAND())) AS ?a) ." //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
</head>
<body>
<p th:text="'Hello World, this is my first Qanary service!'" />
<a th:text="'Learn more about Stanford NER'" th:href="'http://nlp.stanford.edu/software/CRF-NER.shtml'" />
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
+ " ]" //
+ " ] ." //
+ " ?a oa:annotatedBy <urn:qanary:"+this.applicationName+"> . " //
+ " ?a oa:AnnotatedAt ?time ." //
+ " ?a oa:annotatedAt ?time ." //
+ "}";


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
+ " ] ; "
+ " oa:hasBody <" + urls + "> ;"
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ; "
+ " oa:AnnotatedAt ?time "
+ " oa:annotatedAt ?time "
+ "}} "
+ "WHERE { "
+ "BIND (IRI(str(RAND())) AS ?a) ."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
// + " ] ; "
// + " oa:hasBody <" + l.link + "> ;"
// + " oa:annotatedBy <http://rematch.com> ; "
// + " oa:AnnotatedAt ?time "
// + " oa:annotatedAt ?time "
// + "}} "
// + "WHERE { "
// + "BIND (IRI(str(RAND())) AS ?a) ."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
+ " ] ; "
+ " oa:hasBody <" + l.link + "> ;"
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ; "
+ " oa:AnnotatedAt ?time "
+ " oa:annotatedAt ?time "
+ "}} "
+ "WHERE { "
+ "BIND (IRI(str(RAND())) AS ?a) ."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
+ " ] ; "
+ " oa:hasBody <" + l.link + "> ;"
+ " oa:annotatedBy <urn:qanary:"+this.applicationName+"> ; "
+ " oa:AnnotatedAt ?time "
+ " oa:annotatedAt ?time "
+ "}} "
+ "WHERE { "
+ "BIND (IRI(str(RAND())) AS ?a) ."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception {
+ " ] ; "
+ " oa:hasBody <" + urls + "> ;"
+ " oa:annotatedBy <http://AnnotationofSpotProperty.com> ; "
+ " oa:AnnotatedAt ?time "
+ " oa:annotatedAt ?time "
+ "}} "
+ "WHERE { "
+ "BIND (IRI(str(RAND())) AS ?a) ."
Expand Down
Loading

0 comments on commit 2c20d85

Please sign in to comment.