From f52a724fc8e7279689a4d386de374041c0a1bdac Mon Sep 17 00:00:00 2001 From: mroeder Date: Wed, 17 Feb 2016 17:49:02 +0100 Subject: [PATCH] All Spans that are translated into nodes inside the RDF graph additionally get the type nif:Phrase. --- pom.xml | 2 +- .../aksw/gerbil/io/nif/AnnotationWriter.java | 1 + .../gerbil/io/nif/impl/TurtleNIFWriter.java | 60 +++++++++---------- .../gerbil/transfer/nif/vocabulary/NIF.java | 1 + 4 files changed, 33 insertions(+), 31 deletions(-) diff --git a/pom.xml b/pom.xml index 0f03c5e09..01cf4f646 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.aksw gerbil.nif.transfer - 1.2.1-SNAPSHOT + 1.2.1 NIF transfer library for the General Entity Annotator Benchmark This project contains classes for transferring documents using NIF. diff --git a/src/main/java/org/aksw/gerbil/io/nif/AnnotationWriter.java b/src/main/java/org/aksw/gerbil/io/nif/AnnotationWriter.java index acc86334a..fc324c3d9 100644 --- a/src/main/java/org/aksw/gerbil/io/nif/AnnotationWriter.java +++ b/src/main/java/org/aksw/gerbil/io/nif/AnnotationWriter.java @@ -74,6 +74,7 @@ public void addSpan(Model nifModel, Resource documentAsResource, String text, St String spanUri = NIFUriHelper.getNifUri(documentURI, start, end); Resource spanAsResource = nifModel.createResource(spanUri); + nifModel.add(spanAsResource, RDF.type, NIF.Phrase); nifModel.add(spanAsResource, RDF.type, NIF.String); nifModel.add(spanAsResource, RDF.type, NIF.RFC5147String); // TODO add language to String diff --git a/src/main/java/org/aksw/gerbil/io/nif/impl/TurtleNIFWriter.java b/src/main/java/org/aksw/gerbil/io/nif/impl/TurtleNIFWriter.java index e59e8e451..5f0dfe9cc 100644 --- a/src/main/java/org/aksw/gerbil/io/nif/impl/TurtleNIFWriter.java +++ b/src/main/java/org/aksw/gerbil/io/nif/impl/TurtleNIFWriter.java @@ -1,30 +1,30 @@ -/** - * This file is part of NIF transfer library for the General Entity Annotator Benchmark. - * - * NIF transfer library for the General Entity Annotator Benchmark is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * NIF transfer library for the General Entity Annotator Benchmark is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with NIF transfer library for the General Entity Annotator Benchmark. If not, see . - */ -package org.aksw.gerbil.io.nif.impl; - -import org.aksw.gerbil.io.nif.AbstractNIFWriter; - -public class TurtleNIFWriter extends AbstractNIFWriter { - - private static final String HTTP_CONTENT_TYPE = "application/x-turtle"; - private static final String LANGUAGE = "TTL"; - - public TurtleNIFWriter() { - super(HTTP_CONTENT_TYPE, LANGUAGE); - } - -} +/** + * This file is part of NIF transfer library for the General Entity Annotator Benchmark. + * + * NIF transfer library for the General Entity Annotator Benchmark is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * NIF transfer library for the General Entity Annotator Benchmark is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with NIF transfer library for the General Entity Annotator Benchmark. If not, see . + */ +package org.aksw.gerbil.io.nif.impl; + +import org.aksw.gerbil.io.nif.AbstractNIFWriter; + +public class TurtleNIFWriter extends AbstractNIFWriter { + + private static final String HTTP_CONTENT_TYPE = "application/x-turtle"; + private static final String LANGUAGE = "TTL"; + + public TurtleNIFWriter() { + super(HTTP_CONTENT_TYPE, LANGUAGE); + } + +} diff --git a/src/main/java/org/aksw/gerbil/transfer/nif/vocabulary/NIF.java b/src/main/java/org/aksw/gerbil/transfer/nif/vocabulary/NIF.java index d3142b927..cfe8e2c9a 100644 --- a/src/main/java/org/aksw/gerbil/transfer/nif/vocabulary/NIF.java +++ b/src/main/java/org/aksw/gerbil/transfer/nif/vocabulary/NIF.java @@ -43,6 +43,7 @@ protected static final Property property(String local) { public static final Resource Annotation = resource("Annotation"); public static final Resource Context = resource("Context"); + public static final Resource Phrase = resource("Phrase"); public static final Resource String = resource("String"); public static final Resource RFC5147String = resource("RFC5147String");