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

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


    // false: not included to avoid cluttering the test output
    if ( false ) {
      Resource ontologyResource = ResourceFactory.createResource(vocabularyUri);
      StmtIterator metadata = model.listStatements(ontologyResource, null, (RDFNode) null);
      while ( metadata.hasNext() ) {
        Statement stmt = metadata.nextStatement();
        System.out.println("\t" +stmt.getPredicate()+ " -> " +stmt.getObject());
      }
    }
  }
View Full Code Here


    // false: not included to avoid cluttering the test output
    if ( false ) {
      Resource ontologyResource = ResourceFactory.createResource(vocabularyUri);
      StmtIterator describeMetatada = describeModel.listStatements(ontologyResource, null, (RDFNode) null);
      while ( describeMetatada.hasNext() ) {
        Statement stmt = describeMetatada.nextStatement();
        System.out.println("\t" +stmt.getPredicate()+ " -> " +stmt.getObject());
      }
    }
  }
View Full Code Here

   
    // collect all found reified Vine statements in this map:
    Map<StmtKey,Set<Resource>> stmtRsrsMap = new HashMap<StmtKey,Set<Resource>>();
   
    while ( vineStmts.hasNext() ) {
      Statement stmt = vineStmts.nextStatement();
      Property prd = stmt.getPredicate();
     
      // Vine "subject" arbitrarily chosen to check whether we're seeing a Vine statement:
      if ( _isVineSubject(prd) ) {
        //
        // Yes, add the reified statement to our map:
        //
        Resource stmtRsr = stmt.getSubject();
        StmtKey stmtKey = _getStmtKey(stmtRsr);
        _getSetForStmtKey(stmtRsrsMap, stmtKey).add(stmtRsr);
      }
     
      // else: to capture cases not using reification, see if the predicate is
View Full Code Here

    String left = null;
    String rel = null;
    String right = null;
   
    for ( StmtIterator myProps = stmtRsr.listProperties(); myProps.hasNext(); ) {
      Statement myStmt = myProps.nextStatement();
      Property myProp = myStmt.getPredicate();
     
      if ( _isVineSubject(myProp) ) {
        left = _getValueAsString(myStmt.getObject());
      }
      else if ( _isVinePredicate(myProp) ) {
        rel = _getValueAsString(myStmt.getObject());
      }
      else if ( _isVineObject(myProp) ) {
        right = _getValueAsString(myStmt.getObject());
      }
     
      if ( left != null && rel != null && right != null ) {
        return new StmtKey(left, rel, right);
      }
View Full Code Here

  private static void _getMetadataForReified(Resource stmtRsr, Map<String,String> md) {
   
    // traverse all the properties associated with stmtRsr
   
    for ( StmtIterator myProps = stmtRsr.listProperties(); myProps.hasNext(); ) {
      Statement myStmt = myProps.nextStatement();
      Property myProp = myStmt.getPredicate();
     
      if ( RDFS.comment.equals(myProp)
      ||   Vine.confidence.equals(myProp||  Vine20071128.confidence.equals(myProp
      ) {
        // OK; these are the ONLY expected metadata properties per mapping (as of 2010-08-23)
        String propUri = myProp.getURI();
        String propValue = _getValueAsString(myStmt.getObject());
        md.put(propUri, propValue);
      }
     
      // Else: just IGNORE.
     
View Full Code Here

     */
    public void listarStatements(){
        // retorna um iterador para todos os statements da ontologia
        StmtIterator iter = ontologia.listStatements();
        while(iter.hasNext()){
            Statement stmt = iter.nextStatement();
            System.out.println(stmt);
        }
    }
View Full Code Here

         * dois termos referidos por ele.
         */
        for(Individual i :conjIndividuals){
          StmtIterator it = i.listProperties();
          while(it.hasNext()){
            Statement p = it.next();
            if((p.getObject().isResource()) && (p.getPredicate().getLocalName().equalsIgnoreCase("type") == false)){
              RelationshipExample ex = new RelationshipExample();
                ex.setPredicado(lowerFirstChar(
                    i.getOntClass().getLocalName()
                    +"_"
                    +p.getPredicate().getLocalName())
                  );
                ex.setPrimeiroTermo(lowerFirstChar(p.getSubject().getLocalName()));
                ex.setSegundoTermo(lowerFirstChar(p.getObject().asResource().getLocalName()));
              conjFacts.add(ex);
            }
          }
        }
       
View Full Code Here

            {
                Model resultsAsModel = results.getModel() ;
                StmtIterator sIter = results.getModel().listStatements(null, RDF.type, ResultSetGraphVocab.ResultSet) ;
                if ( !sIter.hasNext() )
                    throw new QueryTestException("Can't find the ASK result") ;
                Statement s = sIter.nextStatement() ;
                if ( sIter.hasNext() )
                    throw new QueryTestException("Too many result sets in ASK result") ;
                Resource r = s.getSubject() ;
                Property p = resultsAsModel.createProperty(ResultSetGraphVocab.getURI()+"boolean") ;

                boolean x = r.getRequiredProperty(p).getBoolean() ;
                if ( x != result )
                    assertEquals("ASK test results do not match", x,result);
View Full Code Here

        AssemblerUtils.setContext(server, Fuseki.getContext()) ;
       
        StmtIterator sIter = server.listProperties(JA.loadClass) ;
        for( ; sIter.hasNext(); )
        {
            Statement s = sIter.nextStatement() ;
            RDFNode rn = s.getObject() ;
            String className = null ;
            if ( rn instanceof Resource )
            {
                String uri = ((Resource)rn).getURI() ;
                if ( uri == null )
View Full Code Here

        Model model= ModelFactory.createModelForGraph(getGraph()) ;
        Resource per1 = model.createResource("urn:x:global#per1");
        Resource per2 = model.createResource("urn:x:global#per2");
        Property pred1 = model.createProperty("http://example/ns#prop1");
        Property pred2 = model.createProperty("http://example/ns#prop2") ;
        Statement s1 = model.createStatement(per1, pred1, per2);
        Statement s2 = model.createStatement(per2, pred2, per2);
       
        s1.createReifiedStatement();
        s2.createReifiedStatement();
       
        assertEquals(2, model.listReifiedStatements().toList().size());
       
        Reifier r = new Reifier2(model.getGraph()) ;
        //r = model.getGraph().getReifier() ;
        r.remove(s2.asTriple()) ;
        assertEquals(1, model.listReifiedStatements().toList().size());
    }
View Full Code Here

TOP

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

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.