Package com.hp.hpl.jena.rdf.model

Examples of com.hp.hpl.jena.rdf.model.Resource


    private static Model makeModel()
    {
        String BASE = "http://example/" ;
        Model model = ModelFactory.createDefaultModel() ;
        model.setNsPrefix("", BASE) ;
        Resource r1 = model.createResource(BASE+"r1") ;
        Resource r2 = model.createResource(BASE+"r2") ;
        Property p1 = model.createProperty(BASE+"p") ;
        Property p2 = model.createProperty(BASE+"p2") ;
        RDFNode v1 = model.createTypedLiteral("1", XSDDatatype.XSDinteger) ;
        RDFNode v2 = model.createTypedLiteral("2", XSDDatatype.XSDinteger) ;
       
        r1.addProperty(p1, v1).addProperty(p1, v2) ;
        r1.addProperty(p2, v1).addProperty(p2, v2) ;
        r2.addProperty(p1, v1).addProperty(p1, v2) ;
       
        return model  ;
    }
View Full Code Here


   
    public static Model createModel()
    {
        Model m = ModelFactory.createDefaultModel() ;
       
        Resource r1 = m.createResource("http://example.org/book#1") ;
        Resource r2 = m.createResource("http://example.org/book#2") ;
       
        r1.addProperty(DC.title, "SPARQL - the book")
          .addProperty(DC.description, "A book about SPARQL") ;
       
        r2.addProperty(DC.title, "Advanced techniques for SPARQL") ;
       
        return m ;
    }
View Full Code Here

   
    public static Model createModel()
    {
        Model model = ModelFactory.createDefaultModel() ;
       
        Resource r1 = model.createResource("http://example.org/book#1") ;
        Resource r2 = model.createResource("http://example.org/book#2") ;
        Resource r3 = model.createResource("http://example.org/book#3") ;
       
        r1.addProperty(DC.title, "SPARQL - the book")
          .addProperty(DC.description, "A book about SPARQL") ;
       
        r2.addProperty(DC.title, "Advanced techniques for SPARQL") ;

        r3.addProperty(DC.title, "Jena - an RDF framework for Java")
          .addProperty(DC.description, "A book about Jena") ;

        return model ;
    }
View Full Code Here

   
    public static Model createModel()
    {
        Model m = ModelFactory.createDefaultModel() ;
       
        Resource r1 = m.createResource("http://example.org/book#1") ;
        Resource r2 = m.createResource("http://example.org/book#2") ;
       
        r1.addProperty(DC.title, "SPARQL - the book")
          .addProperty(DC.description, "A book about SPARQL") ;
       
        r2.addProperty(DC.title, "Advanced techniques for SPARQL") ;
       
        return m ;
    }
View Full Code Here

   
    public static Model createModel()
    {
        Model model = ModelFactory.createDefaultModel() ;
       
        Resource r1 = model.createResource("http://example.org/book#1") ;
        Resource r2 = model.createResource("http://example.org/book#2") ;
        Resource r3 = model.createResource("http://example.org/book#3") ;
       
        r1.addProperty(DC.title, "SPARQL - the book")
          .addProperty(DC.description, "A book about SPARQL") ;
       
        r2.addProperty(DC.title, "Advanced techniques for SPARQL") ;

        r3.addProperty(DC.title, "Jena - an RDF framework for Java")
          .addProperty(DC.description, "A book about Jena") ;

        return model ;
    }
View Full Code Here

    static IndexLARQ buildIndexExternalContent(Model model)
    {
        // ---- Create index builder
        IndexBuilderNode larqBuilder = new IndexBuilderNode() ;
       
        Resource r1 = ResourceFactory.createResource("http://example/r1") ;
        Resource r2 = ResourceFactory.createResource("http://example/r2") ;
        Resource r3 = ResourceFactory.createResource("http://example/r3") ;
        Resource r4 = ResourceFactory.createResource("http://example/r4") ;
        Literal  lit1 = ResourceFactory.createPlainLiteral("doc") ;
       
        // ---- Index based on some external content.  Teh content can be any string of words.
       
        larqBuilder.index(r1, new StringReader("document")) ;   // Just to show a Stringreader is possible
View Full Code Here

    private static Model make()
    {
        String BASE = "http://example/" ;
        Model model = ModelFactory.createDefaultModel() ;
        model.setNsPrefix("", BASE) ;
        Resource r1 = model.createResource(BASE+"r1") ;
        Resource r2 = model.createResource(BASE+"r2") ;

        r1.addProperty(RDFS.label, "abc") ;
        r2.addProperty(RDFS.label, "def") ;

        return model  ;
    }
View Full Code Here

  /**
   * @return
   */
  private Model createAuthenticationModel() {
    Model userModel = ModelFactory.createDefaultModel();
    Resource userBeta = userModel.createResource(FOAF.Person);
    userBeta.addProperty(ACCOUNTMANAGER.userName, username);
    userBeta.addProperty(ACCOUNTMANAGER.passwordSha1, Util.sha1(password));
    return userModel;
  }
View Full Code Here

    return userModel;
  }
 
  private Model createAuthorizationModel() {
    Model userModel = ModelFactory.createDefaultModel();
    Resource userBeta = userModel.createResource(FOAF.Person);
    Resource userSource = userModel.createResource(userSourceURL);
    userBeta.addProperty(AUTHORIZATION.mayImpersonate, userSource);
    userBeta.addProperty(ACCOUNTMANAGER.userName, username);
    return userModel;
  }
View Full Code Here

  public void loadFromModel(Model metaModel) {
//    ResIterator  resIterator = metaModel.listSubjectsWithProperty(RDF.type,
//        METAMODEL.Assertion);
    ResIterator  resIterator = metaModel.listSubjectsWithProperty(METAMODEL.asserter);
    while (resIterator.hasNext()) {
      Resource assertion = resIterator.nextResource();
     
      Resource assertedComponent = assertion.getProperty(
          METAMODEL.assertedComponent).getResource();
      Resource type = null;
      StmtIterator typeIter = assertedComponent.listProperties(RDF.type);
      while (typeIter.hasNext()) {
        Resource currentType = typeIter.nextStatement().getResource();
        if (currentType.getNameSpace().equals(METAMODEL.getURI())) {
          type = currentType;
          break;
        }
      }
      Resource assertionSource = assertion.getProperty(
          METAMODEL.asserter).getResource();
      Source source = new SourceImpl(assertionSource.getURI());
      NamedNode component = new NamedNodeImpl(assertedComponent.getURI());
      componentTypeMap.put(component, type);
      SourceComponent sourceComponent = new SourceComponent(source, component);
      {
        //adding assertion
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.rdf.model.Resource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.