org.apache.jena.rdf.model.Model.setNsPrefix()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(110)

本文整理了Java中org.apache.jena.rdf.model.Model.setNsPrefix()方法的一些代码示例,展示了Model.setNsPrefix()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Model.setNsPrefix()方法的具体详情如下:
包路径:org.apache.jena.rdf.model.Model
类名称:Model
方法名:setNsPrefix

Model.setNsPrefix介绍

暂无

代码示例

代码示例来源:origin: apache/jena

@Override
  public void modify(Model m) {
    m.setNsPrefix("eg1", "http://example.org/#");
    m.setNsPrefix("eg2", "http://example.org/#");
  }
});

代码示例来源:origin: apache/jena

@Override
  public void modify(Model m) {
    m.setNsPrefix("eg", "http://example.org/file1#");
    m.setNsPrefix("eg", "http://example.org/file2#");
  }
});

代码示例来源:origin: org.apache.jena/jena-core

@Override
  public void modify(Model m) {
    m.setNsPrefix("eg", "http://example.org/file1#");
    m.setNsPrefix("eg", "http://example.org/file2#");
  }
});

代码示例来源: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

public Model toModel()
{
  Model m = ModelFactory.createDefaultModel() ;
  m.setNsPrefix("lmap", "http://jena.hpl.hp.com/2004/08/location-mapping#") ;
  toModel(m) ;
  return m ;
}

代码示例来源:origin: apache/jena

public Model toModel() {
  Model m = ModelFactory.createDefaultModel() ;
  m.setNsPrefix("lmap", "http://jena.hpl.hp.com/2004/08/location-mapping#") ;
  toModel(m) ;
  return m ;
}

代码示例来源:origin: apache/jena

/**
  Subclasses may extend to get their choice of defined prefixes.
*/
protected Model setRequiredPrefixes( Model m )
  {
  m.setNsPrefix( "ja", JA.getURI() );
  m.setNsPrefix( "lm", LocationMappingVocab.getURI() );
  return m;
  }

代码示例来源:origin: apache/jena

@Override
public SecuredModel setNsPrefix(final String prefix, final String uri)
    throws UpdateDeniedException, AuthenticationRequiredException {
  checkUpdate();
  holder.getBaseItem().setNsPrefix(prefix, uri);
  return holder.getSecuredItem();
}

代码示例来源:origin: apache/jena

@Override
  public void modify(Model m) {
    m.setNsPrefix("eg", "http://example.org/file1#");
    setNsPrefixSysProp("eg", "http://example.org/file2#");
  }
});

代码示例来源:origin: apache/jena

@Override
protected Model setRequiredPrefixes( Model x )
  {
  x.setNsPrefix( "jr", ReasonerVocabulary.JenaReasonerNS );
  return super.setRequiredPrefixes( x );
  }

代码示例来源: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 void modify(Model m) {
    m.removeNsPrefix("rdf");
    m.setNsPrefix("r", RDF.getURI());
  }
});

代码示例来源:origin: org.apache.jena/jena-core

@Override
  public void modify(Model m) {
    m.removeNsPrefix("rdf");
    m.setNsPrefix("r", RDF.getURI());
  }
});

代码示例来源:origin: apache/jena

public void testUsesEntityForPrefix()
  {
  Model m = modelWithStatements( "x R fake:uri#bogus" );
  m.setNsPrefix( "spoo", "fake:uri#" );
  m.setNsPrefix( "eh", "eh:/" );
  String s = checkedModelToString( m );
  assertMatches( "<!DOCTYPE rdf:RDF \\[", s );
  assertMatches( "<!ENTITY spoo 'fake:uri#'>", s );
  assertMatches( "rdf:resource=\"&spoo;bogus\"", s );
  }

代码示例来源:origin: apache/jena

public void testRDFNamespaceMissing()
  {
  Model m = createMemModel();
  modelAdd( m, "x R fake:uri#bogus" );
  m.setNsPrefix( "spoo", "fake:uri#" );
  m.setNsPrefix( "eh", "eh:/" );
  String s = checkedModelToString( m );
  assertMatches( "<!DOCTYPE rdf:RDF \\[", s );
  assertMatches( "<!ENTITY spoo 'fake:uri#'>", s );
  assertMatches( "rdf:resource=\"&spoo;bogus\"", s );
  }
public void testUsesEntityForPrefix()

代码示例来源:origin: apache/jena

static void oneManifestEarl(String testManifest)
{
  EarlReport report = new EarlReport(systemURI, name, version, homepage) ;
  FactoryTestRiot.report = report ;
  TestSuite suite = FactoryTestRiot.make(testManifest, null, null) ;
  SimpleTestRunner.runSilent(suite) ;
  Model model = report.getModel() ;
  model.setNsPrefix("rdft", VocabLangRDF.getURI()) ;
  model.setNsPrefix("turtletest", "http://www.w3.org/2013/TurtleTests/manifest.ttl#") ;
  insertMetaOld(report) ;
  RDFDataMgr.write(System.out, model, Lang.TURTLE) ;
}

代码示例来源:origin: apache/jena

private Dataset assemble(final Resource example) {
    Model model = example.getModel() ;
    model.setNsPrefix("ja", JA.getURI()) ;
//        System.out.println("-------------");
//        RDFDataMgr.write(System.out, model, Lang.TTL) ;
    final InMemDatasetAssembler testAssembler = new InMemDatasetAssembler();
    return testAssembler.open(testAssembler, example, DEFAULT);
  }

代码示例来源:origin: apache/jena

private static void load1(Model model)
{
  model.setNsPrefix("", base1) ;
  Resource r1 = model.createResource(base1+"r1") ;
  Property p1 = model.createProperty(baseNS+"p1") ;
  model.add(r1, p1, "x1") ;
  model.add(r1, p1, "x2") ;
}

代码示例来源:origin: apache/jena

private static void load1(Model model)
{
  model.setNsPrefix("", base1) ;
  Resource r1 = model.createResource(base1+"r1") ;
  Property p1 = model.createProperty(baseNS+"p1") ;
  model.add(r1, p1, "x1") ;
  model.add(r1, p1, "x2") ;
}

代码示例来源:origin: apache/jena

/**
 * Test that we do not use an "" prefix in @Context.
 */
@Test public final void noEmptyPrefixInContext() {
  String ns = "http://www.a.com/foo/";
  Model m = simpleModel(ns);
  m.setNsPrefix("", ns);
  String jsonld = toString(m, RDFFormat.JSONLD_COMPACT_PRETTY, null);
  assertFalse(jsonld.contains("\"\""));
  Model m2 = parse(jsonld);
  assertTrue(m2.isIsomorphicWith(m));
}

相关文章

Model类方法