本文整理汇总了Java中org.apache.jena.vocabulary.VCARD类的典型用法代码示例。如果您正苦于以下问题:Java VCARD类的具体用法?Java VCARD怎么用?Java VCARD使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VCARD类属于org.apache.jena.vocabulary包,在下文中一共展示了VCARD类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: write
import org.apache.jena.vocabulary.VCARD; //导入依赖的package包/类
@Override
public void write(StringWriter writer, String format) {
Model rdfModel = ModelFactory.createDefaultModel();
Resource rdfRec = rdfModel.createResource(this.baseURL);
rdfRec.addProperty(DCTerms.title, this.repositoryName)
.addProperty(DCTerms.hasVersion, this.protocolVersion);
for (String email : this.adminEmails){
rdfRec.addProperty(VCARD.EMAIL, email);
}
rdfModel.createTypedLiteral(this.earliestDatestamp);
rdfModel.createTypedLiteral(this.deletedRecord);
rdfModel.createTypedLiteral(this.granularity);
if (!this.compressions.isEmpty()){
for (String compression : this.compressions){
rdfModel.createTypedLiteral(compression);
}
}
rdfModel.write(writer);
if (this.description != null) {
description.write(writer, format);
}
}
示例2: resourceChangedAddBaseFileWithBase
import org.apache.jena.vocabulary.VCARD; //导入依赖的package包/类
@Test
public void resourceChangedAddBaseFileWithBase() {
final TestBaseRegistryListener registeryListener = new TestBaseRegistryListener();
try {
SemanticUtils.getSemanticBaseRegistry().addListener(registeryListener);
final Model model = ModelFactory.createDefaultModel();
final Resource johnSmith = model.createResource("http://somewhere/JohnSmith");
johnSmith.addProperty(VCARD.FN, "John Smith");
final JenaBase base = new JenaBase(model, "test");
final IProject project = createProject();
final IFile file = createBaseFile(project, base);
assertTrue(file != null);
assertEquals(1, registeryListener.getBases().size());
assertEquals("/test/test.ttl", registeryListener.getBases().get(0).getName());
project.delete(true, new NullProgressMonitor());
} catch (CoreException e) {
e.printStackTrace();
fail(e.getMessage());
} finally {
SemanticUtils.getSemanticBaseRegistry().removeListener(registeryListener);
}
}
示例3: resourceChangedRemoveBaseFileWithBase
import org.apache.jena.vocabulary.VCARD; //导入依赖的package包/类
@Test
public void resourceChangedRemoveBaseFileWithBase() {
final TestBaseRegistryListener registeryListener = new TestBaseRegistryListener();
try {
SemanticUtils.getSemanticBaseRegistry().addListener(registeryListener);
final Model model = ModelFactory.createDefaultModel();
final Resource johnSmith = model.createResource("http://somewhere/JohnSmith");
johnSmith.addProperty(VCARD.FN, "John Smith");
final JenaBase base = new JenaBase(model, "test");
final IProject project = createProject();
final IFile file = createBaseFile(project, base);
assertTrue(file != null);
assertEquals(1, registeryListener.getBases().size());
assertEquals("/test/test.ttl", registeryListener.getBases().get(0).getName());
project.delete(true, new NullProgressMonitor());
assertEquals(0, registeryListener.getBases().size());
} catch (CoreException e) {
e.printStackTrace();
fail(e.getMessage());
} finally {
SemanticUtils.getSemanticBaseRegistry().removeListener(registeryListener);
}
}
示例4: resourceChangedMoveBaseFileWithBaseToNoBaseThenToBase
import org.apache.jena.vocabulary.VCARD; //导入依赖的package包/类
@Test
public void resourceChangedMoveBaseFileWithBaseToNoBaseThenToBase() {
final TestBaseRegistryListener registeryListener = new TestBaseRegistryListener();
try {
SemanticUtils.getSemanticBaseRegistry().addListener(registeryListener);
final Model model = ModelFactory.createDefaultModel();
final Resource johnSmith = model.createResource("http://somewhere/JohnSmith");
johnSmith.addProperty(VCARD.FN, "John Smith");
final JenaBase base = new JenaBase(model, "test");
final IProject project = createProject();
IFile file = createBaseFile(project, base);
assertTrue(file != null);
assertEquals(1, registeryListener.getBases().size());
assertEquals("/test/test.ttl", registeryListener.getBases().get(0).getName());
file.move(new Path("/test/file.txt"), true, new NullProgressMonitor());
file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path("/test/file.txt"));
assertEquals(0, registeryListener.getBases().size());
file.move(new Path("/test/file.ttl"), true, new NullProgressMonitor());
assertEquals(1, registeryListener.getBases().size());
assertEquals("/test/file.ttl", registeryListener.getBases().get(0).getName());
project.delete(true, new NullProgressMonitor());
} catch (CoreException e) {
e.printStackTrace();
fail(e.getMessage());
} finally {
SemanticUtils.getSemanticBaseRegistry().removeListener(registeryListener);
}
}
示例5: resourceChangedOpenBaseFileWithBase
import org.apache.jena.vocabulary.VCARD; //导入依赖的package包/类
@Test
public void resourceChangedOpenBaseFileWithBase() {
final TestBaseRegistryListener registeryListener = new TestBaseRegistryListener();
try {
SemanticUtils.getSemanticBaseRegistry().addListener(registeryListener);
final Model model = ModelFactory.createDefaultModel();
final Resource johnSmith = model.createResource("http://somewhere/JohnSmith");
johnSmith.addProperty(VCARD.FN, "John Smith");
final JenaBase base = new JenaBase(model, "test");
final IProject project = createProject();
final IFile file = createBaseFile(project, base);
assertTrue(file != null);
assertEquals(1, registeryListener.getBases().size());
project.close(new NullProgressMonitor());
assertEquals(0, registeryListener.getBases().size());
project.open(new NullProgressMonitor());
assertEquals(1, registeryListener.getBases().size());
} catch (CoreException e) {
e.printStackTrace();
fail(e.getMessage());
} finally {
SemanticUtils.getSemanticBaseRegistry().removeListener(registeryListener);
}
}
示例6: resourceChangedCloseBaseFileWithBase
import org.apache.jena.vocabulary.VCARD; //导入依赖的package包/类
@Test
public void resourceChangedCloseBaseFileWithBase() {
final TestBaseRegistryListener registeryListener = new TestBaseRegistryListener();
try {
SemanticUtils.getSemanticBaseRegistry().addListener(registeryListener);
final Model model = ModelFactory.createDefaultModel();
final Resource johnSmith = model.createResource("http://somewhere/JohnSmith");
johnSmith.addProperty(VCARD.FN, "John Smith");
final JenaBase base = new JenaBase(model, "test");
final IProject project = createProject();
final IFile file = createBaseFile(project, base);
assertTrue(file != null);
assertEquals(1, registeryListener.getBases().size());
project.close(new NullProgressMonitor());
assertEquals(0, registeryListener.getBases().size());
} catch (CoreException e) {
e.printStackTrace();
fail(e.getMessage());
} finally {
SemanticUtils.getSemanticBaseRegistry().removeListener(registeryListener);
}
}
示例7: getName
import org.apache.jena.vocabulary.VCARD; //导入依赖的package包/类
@Test
public void getName() {
final Model model = ModelFactory.createDefaultModel();
final Resource johnSmith = model.createResource("http://somewhere/JohnSmith");
johnSmith.addProperty(VCARD.FN, "John Smith");
final JenaBase base = new JenaBase(model, "test");
assertEquals("test", base.getName());
}
示例8: getConcepts
import org.apache.jena.vocabulary.VCARD; //导入依赖的package包/类
@Test
public void getConcepts() {
final Model model = ModelFactory.createDefaultModel();
final Resource johnSmith = model.createResource("http://somewhere/JohnSmith");
johnSmith.addProperty(VCARD.FN, "John Smith");
final JenaBase base = new JenaBase(model, "test");
assertEquals(1, base.getConcepts().size());
}
示例9: getModel
import org.apache.jena.vocabulary.VCARD; //导入依赖的package包/类
@Test
public void getModel() {
final Model model = ModelFactory.createDefaultModel();
final Resource johnSmith = model.createResource("http://somewhere/JohnSmith");
johnSmith.addProperty(VCARD.FN, "John Smith");
final JenaBase base = new JenaBase(model, "test");
assertEquals(model, base.getModel());
}
示例10: createIndividual
import org.apache.jena.vocabulary.VCARD; //导入依赖的package包/类
private Model createIndividual(VirtualEntity virtualEntity) {
// some definitions
String personURI = "http://somewhere/JohnSmith";
String givenName = "John";
String familyName = "Smith";
String fullName = givenName + " " + familyName;
// create an empty Model
Model model = ModelFactory.createDefaultModel();
// create the resource
// and add the properties cascading style
Resource johnSmith
= model.createResource(personURI)
.addProperty(VCARD.FN, fullName)
.addProperty(VCARD.N,
model.createResource()
.addProperty(VCARD.Given, givenName)
.addProperty(VCARD.Family, familyName));
// list the statements in the Model
StmtIterator iter = model.listStatements();
// print out the predicate, subject and object of each statement
while (iter.hasNext()) {
Statement stmt = iter.nextStatement(); // get next statement
Resource subject = stmt.getSubject(); // get the subject
Property predicate = stmt.getPredicate(); // get the predicate
RDFNode object = stmt.getObject(); // get the object
System.out.print(subject.toString());
System.out.print(" " + predicate.toString() + " ");
if (object instanceof Resource) {
System.out.print(object.toString());
} else {
// object is a literal
System.out.print(" \"" + object.toString() + "\"");
}
System.out.println(" .");
}
return model;
}