Skip to content

Commit

Permalink
[Ref] Use correct prefixes in output.
Browse files Browse the repository at this point in the history
  • Loading branch information
ledsoft committed Dec 10, 2024
1 parent f2a7796 commit d359b91
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class Constants {
/**
* Prefix used to shorten {@link #NS_TERMIT}.
*/
public static final String NS_TERMIT_PREFIX = "ddo";
public static final String NS_TERMIT_PREFIX = "termit";

/**
* IRI of the annotation type, written in full.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ private void annotateNode(final Element node, final String content, final Phrase
int i) {
node.attr("about", Constants.BNODE_PREFIX + uniqueId + i);
String iri = phrase.getTermIri();
node.attr("property", "ddo:je-výskytem-termu");
node.attr("property", Constants.NS_TERMIT + ":je-přiřazením-termu");
if ((iri != null) && (!iri.isEmpty())) {
node.attr("resource", phrase.getTermIri());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package cz.cvut.kbss.service.textanalysis.html2rdfa;

import cz.cvut.kbss.textanalysis.Constants;
import cz.cvut.kbss.textanalysis.model.Phrase;
import cz.cvut.kbss.textanalysis.model.Word;
import cz.cvut.kbss.textanalysis.service.html2rdfa.Annotator;
Expand Down Expand Up @@ -51,9 +52,9 @@ public void testSingleTermOccurrence() {

final Element element = (Element) aNodes[0];
Assertions.assertNotNull(element.attr("about"));
Assertions.assertEquals("ddo:je-výskytem-termu",element.attr("property"));
Assertions.assertEquals(Constants.NS_TERMIT + ":je-přiřazením-termu", element.attr("property"));
Assertions.assertEquals("http://test.org/pojem/Test",element.attr("resource"));
Assertions.assertEquals("ddo:výskyt-termu",element.attr("typeof"));
Assertions.assertEquals(Constants.NS_TERMIT_PREFIX + ":výskyt-termu",element.attr("typeof"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static org.mockito.Mockito.lenient;


import cz.cvut.kbss.textanalysis.Constants;
import cz.cvut.kbss.textanalysis.keywordextractor.KeywordExtractorAPI;
import cz.cvut.kbss.textanalysis.lemmatizer.LemmatizerApi;
import cz.cvut.kbss.textanalysis.service.ChunkAnnotationService;
Expand Down Expand Up @@ -65,7 +66,7 @@ public void init() {
"<html><body><p>" + chunks[1] + "</p><p>" + chunks[2] + "</p></body></html>";
final Document doc = Jsoup.parse(html);
final Document doc2 = sut.annotate(chunkAnnotationService,doc,"cs");
Assertions.assertEquals(3, doc2.select("span[typeof='ddo:výskyt-termu']").size());
Assertions.assertEquals(3, doc2.select("span[typeof='" + Constants.NS_TERMIT_PREFIX + ":výskyt-termu']").size());
}

@Test public void testParseInvalidHtmlSuccessfully() {
Expand Down

0 comments on commit d359b91

Please sign in to comment.