本文整理汇总了Java中com.hp.hpl.jena.rdf.model.impl.ModelCom类的典型用法代码示例。如果您正苦于以下问题:Java ModelCom类的具体用法?Java ModelCom怎么用?Java ModelCom使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModelCom类属于com.hp.hpl.jena.rdf.model.impl包,在下文中一共展示了ModelCom类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FileGraph
import com.hp.hpl.jena.rdf.model.impl.ModelCom; //导入依赖的package包/类
/**
Construct a new FileGraph who's name is given by the specified File,
If create is true, this is a new file, and any existing file will be destroyed;
if create is false, this is an existing file, and its current contents will
be loaded. The language code for the file is supplied.
@param f the File naming the associated file-system file
@param lang the language string for the file
@param create true to create a new one, false to read an existing one
@param strict true to throw exceptions for create: existing, open: not found
@param style the reification style for the graph
*/
public FileGraph( NotifyOnClose notify, File f, String lang, boolean create, boolean strict, ReificationStyle style )
{
super( style );
this.name = f;
this.notify = notify;
this.model = new ModelCom( this );
this.lang = lang;
if (create)
{ if (f.exists() && strict) throw new AlreadyExistsException( f.toString() ); }
else
readModel( this.model, strict );
}
示例2: PartialStatement
import com.hp.hpl.jena.rdf.model.impl.ModelCom; //导入依赖的package包/类
/** Creates a partial statement from a partial triplet (subject, predicate, object).
*
* At least one of the parameter is assumed to be null.
*
* @param subject The subject of the statement
* @param predicate The predicate of the statement
* @param object The object of the statement
* @param model The ontology this partial statement refers to.
*/
public PartialStatement(Resource subject, Property predicate, RDFNode object, ModelCom model) {
stmtTokens = new ArrayList<String>();
if (subject == null) {
stmtTokens.add("?subject");
subject = model.createResource("nullSubject");
}
else
stmtTokens.add(Namespaces.toLightString(subject));
if (predicate == null) {
stmtTokens.add("?predicate");
predicate = model.createProperty("nullPredicate");
}
else
stmtTokens.add(Namespaces.toLightString(predicate));
if (object == null) {
stmtTokens.add("?object");
object = model.createResource("nullObject");
}
else
stmtTokens.add(Namespaces.toLightString(object));
baseStmt = new StatementImpl(subject, predicate, object, model);
}
示例3: asResIterator
import com.hp.hpl.jena.rdf.model.impl.ModelCom; //导入依赖的package包/类
/**
* <p>Method that creates an iterator of resources</p>
* @param i - an iterator of resources as input
* @param m - the underlying model to use in the mapping
* @return a ResIterator
*/
public static ResIterator asResIterator( Iterator<Resource> i, final ModelCom m )
{
Map1<Resource, Resource> asResource = new Map1<Resource, Resource>()
{
public Resource map1( Resource o )
{ return (Resource) m.asRDFNode( o.asNode() ); }
};
return new ResIteratorImpl( WrappedIterator.create( i ).mapWith( asResource ), null );
}
示例4: asRDFNodeIterator
import com.hp.hpl.jena.rdf.model.impl.ModelCom; //导入依赖的package包/类
/**
* <p>Method that creates an iterator of rdf nodes</p>
* @param i - an iterator of rdf nodes as input
* @param m - the underlying model to use in the mapping
* @return a NodeIterator
*/
static public NodeIterator asRDFNodeIterator( Iterator<RDFNode> i, final ModelCom m )
{
Map1<RDFNode, RDFNode> asRDFNode = new Map1<RDFNode, RDFNode>()
{
public RDFNode map1( RDFNode o )
{ return m.asRDFNode( o.asNode() ); }
};
return new NodeIteratorImpl( WrappedIterator.create( i ).mapWith( asRDFNode ), null );
}
示例5: StatementPattern
import com.hp.hpl.jena.rdf.model.impl.ModelCom; //导入依赖的package包/类
public StatementPattern(Resource subject, Property predicate, RDFNode object, ModelCom model){
this(subject, predicate, object, model, false, false, false);
}
示例6: createStatement
import com.hp.hpl.jena.rdf.model.impl.ModelCom; //导入依赖的package包/类
public Statement createStatement(String statement) throws IllegalStatementException {
Resource subject;
Property predicate;
RDFNode object;
List<String> tokens_statement = Helpers.tokenize(statement.trim(), ' ');
if (tokens_statement.size() != 3)
throw new IllegalStatementException(
"Three tokens are expected in a statement, " +
tokens_statement.size() + " found in " + statement + ".");
//expand the namespaces for subject and predicate.
for (int i = 0; i<2; i++){
tokens_statement.set(i, Namespaces.format(tokens_statement.get(i)));
}
subject = onto.getResource(tokens_statement.get(0));
predicate = onto.getProperty(tokens_statement.get(1));
//Handle objects
object = Helpers.parseLiteral(tokens_statement.get(2), (ModelCom)onto);
assert(object!=null);
Statement s =new StatementImpl(subject, predicate, object);
return s;
}
示例7: createPartialStatement
import com.hp.hpl.jena.rdf.model.impl.ModelCom; //导入依赖的package包/类
public PartialStatement createPartialStatement(String statement) throws IllegalStatementException {
PartialStatement p = new PartialStatement(statement, (ModelCom)getModel());
return p;
}