这是一个关于我不确定如何在Java中解决的问题.我想根据三种类型的数据(URI,String或Literal)制作三重语句,每种类型的编码方式不同.我编写了接受这些类型的编码方法.
public static String makeStatement(URI subject, URI predicate, String object) {
return " " + encode(subject) + " " + encode(predicate) + " " + encode(object) + ".\n";
}
public static String makeStatement(String subject, URI predicate, String object) {
return " " + encode(subject) + " " + encode(predicate) + " " + encode(object) + ".\n";
}
public static String makeStatement(URI subject, URI predicate, Literal object) {
return " " + encode(subject) + " " + encode(predicate) + " " …Run Code Online (Sandbox Code Playgroud)