Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
added oa:annotatedBy and oa:annotatedAt properties
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborremenyi committed Oct 30, 2014
1 parent 5ea42f1 commit 3368453
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
10 changes: 10 additions & 0 deletions src/main/java/eu/fusepool/p3/dictionarymatcher/Annotation.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package eu.fusepool.p3.dictionarymatcher;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
Expand All @@ -24,12 +26,14 @@ public class Annotation {
private int tokenizedBegin;
private int tokenizedEnd;
boolean overlap;
Date timestamp;
List<Token> tokens;

/**
* Simple constructor.
*/
public Annotation() {
timestamp = new Date();
tokens = new ArrayList<>();
}

Expand All @@ -42,6 +46,7 @@ public Annotation() {
public Annotation(String label, String uri) {
this.label = label;
this.uri = uri;
timestamp = new Date();
tokens = new ArrayList<>();
}

Expand All @@ -56,6 +61,7 @@ public Annotation(String label, String uri, String type) {
this.label = label;
this.uri = uri;
this.type = type;
timestamp = new Date();
tokens = new ArrayList<>();
}

Expand Down Expand Up @@ -163,6 +169,10 @@ public void setTokenizedEnd(int tokenizedEnd) {
this.tokenizedEnd = tokenizedEnd;
}

public String getTimestamp() {
return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(timestamp);
}

/**
* It is a lookup function to find the entity in the original text.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package eu.fusepool.p3.transformer.dictionarymatcher;

import eu.fusepool.p3.transformer.HttpRequestEntity;
import eu.fusepool.p3.transformer.RdfGeneratingTransformer;
import eu.fusepool.p3.vocab.FAM;
import eu.fusepool.p3.dictionarymatcher.Annotation;
import eu.fusepool.p3.dictionarymatcher.DictionaryAnnotator;
import eu.fusepool.p3.dictionarymatcher.DictionaryStore;
import eu.fusepool.p3.dictionarymatcher.Skos;
import eu.fusepool.p3.transformer.HttpRequestEntity;
import eu.fusepool.p3.transformer.RdfGeneratingTransformer;
import eu.fusepool.p3.vocab.FAM;
import java.io.IOException;
import java.util.Enumeration;
import java.util.HashMap;
Expand Down Expand Up @@ -158,6 +158,8 @@ protected TripleCollection generateRdf(HttpRequestEntity entity) throws IOExcept
node.addProperty(RDF.type, new UriRef("http://www.w3.org/ns/oa#Annotation"));
node.addProperty(new UriRef("http://www.w3.org/ns/oa#hasBody"), new UriRef(annotationBody));
node.addProperty(new UriRef("http://www.w3.org/ns/oa#hasTarget"), new UriRef(spResource));
node.addProperty(new UriRef("http://www.w3.org/ns/oa#annotatedBy"), new UriRef("p3-dictionary-matcher-transformer"));
node.addPropertyValue(new UriRef("http://www.w3.org/ns/oa#annotatedAt"), e.getTimestamp());

// oa:SpecificResource
node = new GraphNode(new UriRef(spResource), result);
Expand Down Expand Up @@ -217,7 +219,8 @@ private Map<String, String> getQueryParams(String queryString) {
}

/**
* Get docuemt URI either from content location header, or generate one if it's null.
* Get docuemt URI either from content location header, or generate one if
* it's null.
*
* @param entity
* @return
Expand Down

0 comments on commit 3368453

Please sign in to comment.