本文整理了Java中org.apache.jena.vocabulary.RDF
类的一些代码示例,展示了RDF
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RDF
类的具体详情如下:
包路径:org.apache.jena.vocabulary.RDF
类名称:RDF
[英]The standard RDF vocabulary.
[中]标准RDF词汇表。
代码示例来源:origin: apache/jena
private void addPrefixes(Model model)
{
if ( model.getNsPrefixURI("rs") == null )
model.setNsPrefix("rs", ResultSetGraphVocab.getURI() ) ;
if ( model.getNsPrefixURI("rdf") == null )
model.setNsPrefix("rdf", RDF.getURI() ) ;
if ( model.getNsPrefixURI("xsd") == null )
model.setNsPrefix("xsd", XSDDatatype.XSD+"#") ;
}
代码示例来源:origin: apache/jena
@Override
public Seq set(int index, Object o) {
checkIndex(index);
Statement s = getRequiredProperty(RDF.li(index)) ;
Model m = s.getModel() ;
Statement s2 = m.createLiteralStatement(s.getSubject(), s.getPredicate(), o) ;
s.getModel().remove(s) ;
s.getModel().add(s2) ;
//getRequiredProperty(RDF.li(index)).changeObject(o);
return this;
}
代码示例来源:origin: apache/jena
public static Property subject() { return property( "subject" ); }
public static Property predicate() { return property( "predicate" ); }
代码示例来源:origin: apache/jena
protected void checkAdd(final int pos, final Node node)
throws AddDeniedException, UpdateDeniedException,
AuthenticationRequiredException {
checkCreate(new Triple(holder.getBaseItem().asNode(), RDF.li(pos)
.asNode(), node));
}
代码示例来源:origin: apache/jena
public void testCreatePropertyStrangeURITwoArgs()
{
final String local = "_345";
final Property p = model.createProperty(RDF.getURI(), local);
Assert.assertEquals(RDF.getURI(), p.getNameSpace());
Assert.assertEquals(local, p.getLocalName());
Assert.assertEquals(RDF.getURI() + local, p.getURI());
}
代码示例来源:origin: org.apache.jena/jena-core
protected void shiftUp(int start, int finish) {
Statement stmt = null;
for (int i = finish; i >= start; i--) {
stmt = getRequiredProperty(RDF.li(i));
getModel().remove(stmt);
addProperty(RDF.li(i+1), stmt.getObject());
}
}
protected void shiftDown(int start, int finish) {
代码示例来源:origin: apache/jena
private static int classification(Node p) {
if ( p.equals(RDF_type) )
return 0 ;
if ( p.getURI().startsWith(RDF.getURI()) || p.getURI().startsWith(RDFS.getURI()) )
return 1 ;
return 2 ;
}
代码示例来源:origin: apache/jena
@Override
public Alt setDefault(RDFNode o) {
Statement stmt = getDefaultStatement();
if (stmt != null) getModel().remove( stmt );
getModel().add( this, RDF.li(1), o );
return this;
}
代码示例来源:origin: org.apache.jena/jena-core
protected Statement getDefaultStatement()
{
StmtIterator iter = getModel().listStatements( this, RDF.li(1), (RDFNode) null );
try { return iter.hasNext() ? iter.nextStatement() : null; }
finally { iter.close(); }
}
代码示例来源:origin: apache/jena
@Override
public void modify(Model m) {
m.removeNsPrefix("rdf");
m.setNsPrefix("r", RDF.getURI());
}
});
代码示例来源:origin: apache/jena
protected static int getIndex(final Property p) {
if (p.getNameSpace().equals(RDF.getURI())
&& p.getLocalName().startsWith("_")) {
try {
return Integer.parseInt(p.getLocalName().substring(1));
} catch (final NumberFormatException e) {
// acceptable;
}
}
return -1;
}
代码示例来源:origin: apache/jena
private void testCatchesBadEntity( String bad )
{
Model m = modelWithStatements( "ampsersand spelt '&'; x R goo:spoo/noo" );
m.setNsPrefix( "rdf", RDF.getURI() );
m.setNsPrefix( bad, "goo:spoo" );
m.setNsPrefix( "eh", "eh:/" );
String s = checkedModelToString( m );
//assertTrue( s.toString().contains( "<!DOCTYPE rdf:RDF [" ) ); // java5-ism
assertTrue( s.toString().contains( "<!DOCTYPE rdf:RDF [" ) );
assertMismatches( "<!ENTITY " + bad + " ", s );
assertMismatches( "rdf:resource=\"&" + bad + ";noo\"", s );
}
代码示例来源:origin: apache/jena
@Override
public Container remove(int index, RDFNode o) {
// System.err.println( "]] SeqImpl::remove( " + index + ", " + o + ")" );
return remove(getModel().createStatement(this, RDF.li(index), o).remove());
}
代码示例来源:origin: apache/jena
@Override
public Container remove(int index, RDFNode object) {
remove(getModel().createStatement(this, RDF.li(index), object));
return this;
}
代码示例来源:origin: apache/jena
@Override
public void startPrefixMapping(String prefix, String uri) throws SAXException {
if ( uri.equals(RDF.getURI()) )
rdfPrefix = prefix ;
}
代码示例来源:origin: apache/jena
@Override
public boolean getBoolean(int index) {
checkIndex(index);
return getRequiredProperty(RDF.li(index)).getBoolean();
}
代码示例来源:origin: apache/jena
@Override
public Seq set(int index, long o) {
checkIndex(index);
getRequiredProperty(RDF.li(index)).changeLiteralObject(o);
return this;
}
代码示例来源:origin: apache/jena
@Override
public int getInt(int index) {
checkIndex(index);
return getRequiredProperty(RDF.li(index)).getInt();
}
代码示例来源:origin: apache/jena
@Override
public Seq set(int index, String o, String l) {
checkIndex(index);
getRequiredProperty(RDF.li(index)).changeObject(o, l);
return this;
}
代码示例来源:origin: apache/jena
@Override
public byte getByte(int index) {
checkIndex(index);
return getRequiredProperty(RDF.li(index)).getByte();
}
内容来源于网络,如有侵权,请联系作者删除!