当前位置: 首页>>代码示例>>Java>>正文


Java AnonId类代码示例

本文整理汇总了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));
}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:24,代码来源:PrettyPrinterTest.java

示例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));
}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:23,代码来源:PrettyPrinterTest.java

示例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());
}
 
开发者ID:diachron,项目名称:quality,代码行数:19,代码来源:SerialisableTriple.java

示例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);
	}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:10,代码来源:FindTest.java

示例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);
	}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:12,代码来源:FindTest.java

示例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);
	}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:12,代码来源:FindTest.java

示例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());
}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:14,代码来源:NodeMakerTest.java

示例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);
	}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:9,代码来源:FindTest.java

示例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);
	}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:11,代码来源:FindTest.java

示例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);
	}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:11,代码来源:FindTest.java

示例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());
}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:13,代码来源:NodeMakerTest.java

示例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));
}
 
开发者ID:semweb4j,项目名称:semweb4j,代码行数:8,代码来源:ModelImplJena.java

示例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()));
  }
}
 
开发者ID:ewie,项目名称:cobalt,代码行数:9,代码来源:IdentifiableExternalizer.java

示例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;
}
 
开发者ID:semr,项目名称:neo4jena,代码行数:12,代码来源:JenaNeoNode.java

示例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)));
}
 
开发者ID:myclabs,项目名称:CarbonDB-reasoner,代码行数:12,代码来源:RelationRepo.java


注:本文中的com.hp.hpl.jena.rdf.model.AnonId类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。