本文整理汇总了Java中com.hp.hpl.jena.rdf.model.AnonId类的典型用法代码示例。如果您正苦于以下问题:Java AnonId类的具体用法?Java AnonId怎么用?Java AnonId使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AnonId类属于com.hp.hpl.jena.rdf.model包,在下文中一共展示了AnonId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testNodePrettyPrinting
import com.hp.hpl.jena.rdf.model.AnonId; //导入依赖的package包/类
@Test
public void testNodePrettyPrinting() {
assertEquals("\"foo\"",
PrettyPrinter.toString(Node.createLiteral("foo")));
assertEquals("\"foo\"@en",
PrettyPrinter.toString(Node.createLiteral("foo", "en", null)));
assertEquals("\"1\"^^xsd:int",
PrettyPrinter.toString(Node.createLiteral("1", null, XSDDatatype.XSDint)));
assertEquals("\"1\"^^xsd:int",
PrettyPrinter.toString(Node.createLiteral("1", null, XSDDatatype.XSDint), PrefixMapping.Standard));
assertEquals("_:foo",
PrettyPrinter.toString(Node.createAnon(new AnonId("foo"))));
assertEquals("<http://example.org/>",
PrettyPrinter.toString(Node.createURI("http://example.org/")));
assertEquals("<" + RDF.type.getURI() + ">",
PrettyPrinter.toString(RDF.type.asNode(), new PrefixMappingImpl()));
assertEquals("rdf:type",
PrettyPrinter.toString(RDF.type.asNode(), PrefixMapping.Standard));
assertEquals("?x",
PrettyPrinter.toString(Node.createVariable("x")));
assertEquals("?ANY",
PrettyPrinter.toString(Node.ANY));
}
示例2: testNodePrettyPrinting
import com.hp.hpl.jena.rdf.model.AnonId; //导入依赖的package包/类
public void testNodePrettyPrinting() {
assertEquals("\"foo\"",
PrettyPrinter.toString(Node.createLiteral("foo")));
assertEquals("\"foo\"@en",
PrettyPrinter.toString(Node.createLiteral("foo", "en", null)));
assertEquals("\"1\"^^<" + XSDDatatype.XSDint.getURI() + ">",
PrettyPrinter.toString(Node.createLiteral("1", null, XSDDatatype.XSDint)));
assertEquals("\"1\"^^xsd:int",
PrettyPrinter.toString(Node.createLiteral("1", null, XSDDatatype.XSDint), PrefixMapping.Standard));
assertEquals("_:foo",
PrettyPrinter.toString(Node.createAnon(new AnonId("foo"))));
assertEquals("<http://example.org/>",
PrettyPrinter.toString(Node.createURI("http://example.org/")));
assertEquals("<" + RDF.type.getURI() + ">",
PrettyPrinter.toString(RDF.type.asNode(), new PrefixMappingImpl()));
assertEquals("rdf:type",
PrettyPrinter.toString(RDF.type.asNode(), PrefixMapping.Standard));
assertEquals("?x",
PrettyPrinter.toString(Node.createVariable("x")));
assertEquals("?ANY",
PrettyPrinter.toString(Node.ANY));
}
示例3: getTriple
import com.hp.hpl.jena.rdf.model.AnonId; //导入依赖的package包/类
public Triple getTriple(){
Resource _sbj, _prd;
RDFNode _obj;
if (isSubjectBlank) _sbj = ModelFactory.createDefaultModel().createResource(new AnonId(this.subject));
else _sbj = ModelFactory.createDefaultModel().createResource(subject);
_prd = ModelFactory.createDefaultModel().createProperty(predicate);
if (isObjectBlank) _obj = ModelFactory.createDefaultModel().createResource(new AnonId(this.object));
else if (isObjectLiteral){
_obj = ModelFactory.createDefaultModel().createTypedLiteral(this.object, this.objectDataType);
}
else _obj = ModelFactory.createDefaultModel().createResource(object);
return new Triple(_sbj.asNode(), _prd.asNode(), _obj.asNode());
}
示例4: testFindAnonymousNode
import com.hp.hpl.jena.rdf.model.AnonId; //导入依赖的package包/类
@Test
public void testFindAnonymousNode() {
find(null, VCARD.Pcode, createPlainLiteral("BS34 8QZ"));
// dump();
assertStatement(
createAnonResource(new AnonId("map:[email protected]@7")),
VCARD.Pcode, createPlainLiteral("BS34 8QZ"));
assertStatementCount(1);
}
示例5: testMatchAnonymousSubject
import com.hp.hpl.jena.rdf.model.AnonId; //导入依赖的package包/类
@Test
public void testMatchAnonymousSubject() {
find(
createAnonResource(new AnonId("map:[email protected]@7")),
VCARD.Pcode, null);
// dump();
assertStatement(
createAnonResource(new AnonId("map:[email protected]@7")),
VCARD.Pcode, createPlainLiteral("BS34 8QZ"));
assertStatementCount(1);
}
示例6: testMatchAnonymousObject
import com.hp.hpl.jena.rdf.model.AnonId; //导入依赖的package包/类
@Test
public void testMatchAnonymousObject() {
find(
null, VCARD.ADR,
createAnonResource(new AnonId("map:[email protected]@7")));
// dump();
assertStatement(
resource("organizations/7"), VCARD.ADR,
createAnonResource(new AnonId("map:[email protected]@7")));
assertStatementCount(1);
}
示例7: testFixedNodeMakerToString
import com.hp.hpl.jena.rdf.model.AnonId; //导入依赖的package包/类
@Test
public void testFixedNodeMakerToString() {
assertEquals("Fixed(\"foo\")",
new FixedNodeMaker(Node.createLiteral("foo")).toString());
assertEquals("Fixed(\"foo\"@en)",
new FixedNodeMaker(Node.createLiteral("foo", "en", null)).toString());
assertEquals("Fixed(\"1\"^^xsd:int)",
new FixedNodeMaker(Node.createLiteral("1", null, XSDDatatype.XSDint)).toString());
assertEquals("Fixed(_:foo)",
new FixedNodeMaker(Node.createAnon(new AnonId("foo"))).toString());
assertEquals("Fixed(<http://example.org/>)",
new FixedNodeMaker(Node.createURI("http://example.org/")).toString());
}
示例8: testFindAnonymousNode
import com.hp.hpl.jena.rdf.model.AnonId; //导入依赖的package包/类
public void testFindAnonymousNode() {
find(null, VCARD.Pcode, m.createLiteral("BS34 8QZ"));
// dump();
assertStatement(
m.createResource(new AnonId("map:[email protected]@7")),
VCARD.Pcode, m.createLiteral("BS34 8QZ"));
assertStatementCount(1);
}
示例9: testMatchAnonymousSubject
import com.hp.hpl.jena.rdf.model.AnonId; //导入依赖的package包/类
public void testMatchAnonymousSubject() {
find(
m.createResource(new AnonId("map:[email protected]@7")),
VCARD.Pcode, null);
// dump();
assertStatement(
m.createResource(new AnonId("map:[email protected]@7")),
VCARD.Pcode, m.createLiteral("BS34 8QZ"));
assertStatementCount(1);
}
示例10: testMatchAnonymousObject
import com.hp.hpl.jena.rdf.model.AnonId; //导入依赖的package包/类
public void testMatchAnonymousObject() {
find(
null, VCARD.ADR,
m.createResource(new AnonId("map:[email protected]@7")));
// dump();
assertStatement(
resource("organizations/7"), VCARD.ADR,
m.createResource(new AnonId("map:[email protected]@7")));
assertStatementCount(1);
}
示例11: testFixedNodeMakerToString
import com.hp.hpl.jena.rdf.model.AnonId; //导入依赖的package包/类
public void testFixedNodeMakerToString() {
assertEquals("Fixed(\"foo\")",
new FixedNodeMaker(Node.createLiteral("foo"), true).toString());
assertEquals("Fixed(\"foo\"@en)",
new FixedNodeMaker(Node.createLiteral("foo", "en", null), true).toString());
assertEquals("Fixed(\"1\"^^<" + XSDDatatype.XSDint.getURI() + ">)",
new FixedNodeMaker(Node.createLiteral("1", null, XSDDatatype.XSDint), true).toString());
assertEquals("Fixed(_:foo)",
new FixedNodeMaker(Node.createAnon(new AnonId("foo")), true).toString());
assertEquals("Fixed(<http://example.org/>)",
new FixedNodeMaker(Node.createURI("http://example.org/"), true).toString());
}
示例12: createBlankNode
import com.hp.hpl.jena.rdf.model.AnonId; //导入依赖的package包/类
@Override
public BlankNode createBlankNode(String id) {
// this.modificationCount++;
// should be unique across models
AnonId anonid = AnonId.create(id);
return new JenaBlankNode(com.hp.hpl.jena.graph.NodeFactory.createAnon(anonid));
}
示例13: externalize
import com.hp.hpl.jena.rdf.model.AnonId; //导入依赖的package包/类
public static Resource externalize(final Identifiable identifiable, final Model model) {
final Identifier id = identifiable.getIdentifier();
if (id.isUri()) {
return model.createResource(id.toString());
} else {
return model.createResource(AnonId.create(id.toString()));
}
}
示例14: getBlankNodeId
import com.hp.hpl.jena.rdf.model.AnonId; //导入依赖的package包/类
/**
* Get the id of blank node.
*/
@Override
public AnonId getBlankNodeId() {
Transaction tx = graphDb.beginTx();
//AnonId id = AnonId.create(String.valueOf(node.getId()));
AnonId id = AnonId.create(delegate.getProperty(NeoGraph.PROPERTY_URI).toString());
tx.success();
return id;
}
示例15: addDerivedRelation
import com.hp.hpl.jena.rdf.model.AnonId; //导入依赖的package包/类
public void addDerivedRelation(Resource sourceProcess, Resource coeff, Resource destinationProcess, int exponent, Resource sourceRelation)
{
sourceProcess.addProperty(Datatype.hasDerivedRelation,
model.createResource(Datatype.getURI() + AnonId.create().toString())
.addProperty(RDF.type, Datatype.DerivedRelation)
.addProperty(Datatype.isDerivedFrom, sourceRelation)
.addProperty(Datatype.hasOriginProcess, sourceProcess)
.addProperty(Datatype.hasWeightCoefficient, coeff)
.addProperty(Datatype.hasDestinationProcess, destinationProcess)
.addProperty(Datatype.exponent, model.createTypedLiteral(exponent)));
}