本文整理汇总了Java中org.openrdf.model.Graph.add方法的典型用法代码示例。如果您正苦于以下问题:Java Graph.add方法的具体用法?Java Graph.add怎么用?Java Graph.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openrdf.model.Graph
的用法示例。
在下文中一共展示了Graph.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serialize
import org.openrdf.model.Graph; //导入方法依赖的package包/类
public Iterable<Statement> serialize( final EntityDescriptor entityDescriptor )
{
Graph graph = new GraphImpl();
ValueFactory values = graph.getValueFactory();
URI entityTypeUri = values.createURI( Classes.toURI( entityDescriptor.types().findFirst().orElse( null ) ) );
graph.add( entityTypeUri, Rdfs.TYPE, Rdfs.CLASS );
graph.add( entityTypeUri, Rdfs.TYPE, OWL.CLASS );
graph.add( entityTypeUri,
PolygeneEntityType.TYPE,
values.createLiteral( entityDescriptor.types().findFirst().get().toString() )
);
graph.add( entityTypeUri, PolygeneEntityType.QUERYABLE, values.createLiteral( entityDescriptor.queryable() ) );
serializeMixinTypes( entityDescriptor, graph, entityTypeUri );
serializePropertyTypes( entityDescriptor, graph, entityTypeUri );
serializeAssociationTypes( entityDescriptor, graph, entityTypeUri );
serializeManyAssociationTypes( entityDescriptor, graph, entityTypeUri );
return graph;
}
示例2: export
import org.openrdf.model.Graph; //导入方法依赖的package包/类
@Override
public Resource export(final Graph graph) {
final Resource implNode = super.export(graph);
@SuppressWarnings("deprecation")
final
ValueFactory v = graph.getValueFactory();
graph.add(implNode, USER, v.createLiteral(user));
graph.add(implNode, PASSWORD, v.createLiteral(password));
graph.add(implNode, INSTANCE, v.createLiteral(instance));
graph.add(implNode, ZOOKEEPERS, v.createLiteral(zookeepers));
graph.add(implNode, IS_MOCK, v.createLiteral(isMock));
return implNode;
}
示例3: export
import org.openrdf.model.Graph; //导入方法依赖的package包/类
@Override
/**
* export graph representation of config
*
* @Note - Graph is deprecating soon (in Sesame) to be replaced by Model
*/
public Resource export(Graph graph) {
Resource implNode = super.export(graph);
ValueFactory vf = graph.getValueFactory();
if (getQueryEndpointUrl() != null) {
graph.add(implNode, QUERY_ENDPOINT, vf.createURI(getQueryEndpointUrl()));
}
if (getUpdateEndpointUrl() != null) {
graph.add(implNode, UPDATE_ENDPOINT, vf.createURI(getUpdateEndpointUrl()));
}
return implNode;
}
示例4: export
import org.openrdf.model.Graph; //导入方法依赖的package包/类
@Override
public Resource export(Graph graph) {
Resource implNode = super.export(graph);
ValueFactory vf = graph.getValueFactory();
if (jdbcDriver != null) {
graph.add(implNode, JDBC_DRIVER, vf.createLiteral(jdbcDriver));
}
if (url != null) {
graph.add(implNode, URL, vf.createLiteral(url));
}
if (user != null) {
graph.add(implNode, USER, vf.createLiteral(user));
}
if (password != null) {
graph.add(implNode, PASSWORD, vf.createLiteral(password));
}
graph.add(implNode, MAX_TRIPLE_TABLES, vf.createLiteral(maxTripleTables));
return implNode;
}
示例5: addEPCsToGraph
import org.openrdf.model.Graph; //导入方法依赖的package包/类
/**
* @param ns
* @param mySubject
* @param myGraph
* @param epcArray
*/
public Graph addEPCsToGraph(Namespaces ns, Graph myGraph, URI mySubject,
ArrayList<String> epcArray) {
if (epcArray.size() > 0) {
ValueFactory myFactory = ValueFactoryImpl.getInstance();
BNode bnodeEPC = myFactory.createBNode();
// link the EPCS to the event
myGraph.add(mySubject, myFactory.createURI(
ns.getIRIForPrefix("eem"), "associatedWithEPCList"),
bnodeEPC);
myGraph.add(bnodeEPC, RDF.TYPE,
myFactory.createURI(ns.getIRIForPrefix("eem"), "SetOfEPCs"));
for (String e : epcArray) {
myGraph.add(bnodeEPC,
myFactory.createURI("http://purl.org/co#element"),
myFactory.createURI(e.trim()));
// System.out.println(e);
}
}
return myGraph;
}
示例6: setReaderForEvent
import org.openrdf.model.Graph; //导入方法依赖的package包/类
/**
* @param myGraph
* @param mySubject2
* @param reader
* @return
*/
public Graph setReaderForEvent(Namespaces ns, String prefix, Graph myGraph,
URI mySubject, Reader reader) {
URI readerURI = ValueFactoryImpl.getInstance().createURI(
ns.getIRIForPrefix(prefix), reader.getPhysicalReaderID());
myGraph.add(readerURI, RDF.TYPE, ValueFactoryImpl.getInstance()
.createURI(ns.getIRIForPrefix("eem"), "Reader"));
myGraph.add(
readerURI,
ValueFactoryImpl.getInstance().createURI(
ns.getIRIForPrefix("eem"), "logicalID"),
ValueFactoryImpl.getInstance().createLiteral(
reader.getPhysicalReaderID()));
myGraph.add(
mySubject,
ValueFactoryImpl.getInstance().createURI(
ns.getIRIForPrefix("eem"), "recordedByReader"),
readerURI);
return myGraph;
}
示例7: shouldProperlyConvertGraphToGraphVizModel
import org.openrdf.model.Graph; //导入方法依赖的package包/类
@Test
public void shouldProperlyConvertGraphToGraphVizModel() throws Exception {
ValueFactory v = new ValueFactoryImpl();
Graph graph = new TreeModel();
graph.add(v.createStatement(
v.createURI("http://test.urn"),
v.createURI("http://predicate"),
v.createLiteral("Test label")
));
graph.add(v.createStatement(
v.createURI("http://test.urn1"),
v.createURI("http://predicate1"),
v.createLiteral("Test label1")
));
String stringForm = new GraphConverter().getStringForm(graph);
Approvals.verify(stringForm, Paths.get("src/test/resources/approvals/shouldProperlyConvertGraphToGraphVizModel.dot"));
}
示例8: shouldProperlyConvertTheDotFormatAndThenReportItInConfigredApplication
import org.openrdf.model.Graph; //导入方法依赖的package包/类
@Test
public void shouldProperlyConvertTheDotFormatAndThenReportItInConfigredApplication() throws Exception {
ValueFactory v = new ValueFactoryImpl();
Graph graph = new TreeModel();
graph.add(v.createStatement(
v.createURI("http://test.urn"),
v.createURI("http://predicate"),
v.createLiteral("Test label")
));
graph.add(v.createStatement(
v.createURI("http://test.urn1"),
v.createURI("http://predicate1"),
v.createLiteral("Test label1")
));
Approval<Graph> approval = Approval.of(Graph.class)
.withConveter(new GraphConverter())
.withReporter(GraphReporter.getInstance())
.build();
approval.verify(graph, Paths.get("src/test/resources/approvals/shouldProperlyConvertTheDotFormatAndThenReportItInConfigredApplication.dot"));
}
示例9: serialize
import org.openrdf.model.Graph; //导入方法依赖的package包/类
public void serialize( final EntityState entityState,
final boolean includeNonQueryable,
final Graph graph
)
{
ValueFactory values = graph.getValueFactory();
EntityReference reference = entityState.entityReference();
URI entityUri = createEntityURI( values, reference );
graph.add( entityUri,
Rdfs.TYPE,
values.createURI(
Classes.toURI( entityState.entityDescriptor().types().findFirst().orElse( null ) ) ) );
serializeProperties( entityState,
graph,
entityUri,
entityState.entityDescriptor(),
includeNonQueryable );
serializeAssociations( entityState,
graph,
entityUri,
entityState.entityDescriptor().state().associations(),
includeNonQueryable );
serializeManyAssociations( entityState,
graph,
entityUri,
entityState.entityDescriptor().state().manyAssociations(),
includeNonQueryable );
}
示例10: serializeProperty
import org.openrdf.model.Graph; //导入方法依赖的package包/类
private void serializeProperty( PropertyDescriptor persistentProperty, Object property,
Resource subject, Graph graph,
boolean includeNonQueryable )
{
if( !( includeNonQueryable || persistentProperty.queryable() ) )
{
return; // Skip non-queryable
}
ValueType valueType = persistentProperty.valueType();
final ValueFactory valueFactory = graph.getValueFactory();
String propertyURI = persistentProperty.qualifiedName().toURI();
URI predicate = valueFactory.createURI( propertyURI );
String baseURI = propertyURI.substring( 0, propertyURI.indexOf( '#' ) ) + "/";
if( valueType instanceof ValueCompositeType )
{
serializeValueComposite( subject, predicate, (ValueComposite) property, valueType,
graph, baseURI, includeNonQueryable );
}
else
{
String stringProperty = serializer.serialize( Serializer.Options.NO_TYPE_INFO, property );
final Literal object = valueFactory.createLiteral( stringProperty );
graph.add( subject, predicate, object );
}
}
示例11: exportAssocation
import org.openrdf.model.Graph; //导入方法依赖的package包/类
private void exportAssocation(Resource subj, Map<Class<?>, List<URI>> assocation,
URI relation, Graph model) {
ValueFactory vf = ValueFactoryImpl.getInstance();
for (Map.Entry<Class<?>, List<URI>> e : assocation.entrySet()) {
URI name = vf.createURI(JAVA_NS, e.getKey().getName());
model.add(subj, relation, name);
if (e.getValue() != null) {
for (URI value : e.getValue()) {
model.add(name, KNOWN_AS, value);
}
}
}
}
示例12: export
import org.openrdf.model.Graph; //导入方法依赖的package包/类
/**
* Adds all Repository configuration settings to a configuration model.
*
* @param model the configuration model to be filled.
* @return the resource representing this repository configuration.
*/
@Override
// public Resource export(Model model) { // Sesame 3
public Resource export(Graph model) { // Sesame 2
Resource implNode = super.export(model);
model.add(implNode, VOID_URI, this.voidUri);
if (this.endpoint != null)
model.add(implNode, ENDPOINT, this.endpoint);
return implNode;
}
示例13: export
import org.openrdf.model.Graph; //导入方法依赖的package包/类
@Override
public Resource export(Graph model) {
ValueFactoryImpl vf = ValueFactoryImpl.getInstance();
BNode implNode = vf.createBNode();
if (type != null) {
model.add(implNode, this.typePredicate, vf.createLiteral(type));
}
return implNode;
}
示例14: export
import org.openrdf.model.Graph; //导入方法依赖的package包/类
/**
* Adds all Sail configuration settings to a configuration model.
*
* @param model the configuration model to be filled.
* @return the resource representing this Sail configuration.
*/
@Override
public Resource export(Graph model) {
Resource self = super.export(model);
for (RepositoryImplConfig member : this.memberConfig) {
model.add(self, MEMBER, member.export(model));
}
model.add(self, SRC_SELECTION, this.selectorConfig.export(model));
model.add(self, QUERY_OPT, this.optimizerConfig.export(model));
return self;
}
示例15: export
import org.openrdf.model.Graph; //导入方法依赖的package包/类
@Override
public Resource export(Graph model) {
ValueFactory vf = ValueFactoryImpl.getInstance();
Resource self = super.export(model);
model.add(self, USE_TYPE_STATS, vf.createLiteral(this.useTypeStats));
return self;
}