我正在使用Apache Jena和RDF来存储电子邮件。我正在尝试创建一个消息ID为URI的RDF模型,我正在使用addProperty()
函数。
Resource addProperty(Property p,String o)
example:model.createResource(personURI).addProperty(VCARD.FN, fullName)
我想知道我们使用VCARD类作为属性可以使用的其他类型是什么? 这可能听起来很蹩脚,但我对此很新,任何事情都会有所帮助。
答案 0 :(得分:4)
VCARD是com.hp.hpl.jena.vocabulary
命名空间的一部分,它实现了Property接口。以下是其他词汇表的列表:(source)
答案 1 :(得分:1)
是的,最好的方法是创建自己的属性。这是我创建的电子邮件的示例代码:`
//To define all the properties needed to make the rdf of the email
package email;
import com.hp.hpl.jena.rdf.model.*;
public class EMAILRDF {
//Create a default model
private static Model m = ModelFactory.createDefaultModel();
//Subject of the mail
public static final Property SUBJECT = m.createProperty("SUB:" );
//Sender of the mail
public static final Property FROM = m.createProperty("FROM:" );
//Receiver of the mail
public static final Property TO = m.createProperty("TO:" );
//Return path
public static final Property RETURN_PATH = m.createProperty("RETURNPATH:" );
//main contents of the mail
public static final Property CONTENT = m.createProperty("CONTENT:" );
//format of the mail
public static final Property FORMAT = m.createProperty("FORMAT:" );
//content type like html etc
public static final Property CONTENT_TYPE = m.createProperty("CONTENTTYPE:" );
//encoding in bits
public static final Property ENCODING = m.createProperty("ENCODING:" );
//date of the email
public static final Property DATE = m.createProperty("DATE:" );
}`