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

Examples of com.hp.hpl.jena.rdf.model.StmtIterator.nextStatement()


      StmtIterator it = input.listStatements((Resource)null, input.createProperty( curr.asNode().getURI() ), (RDFNode)null);
      Model toDel = ModelFactory.createDefaultModel();
      Model toAdd = ModelFactory.createDefaultModel();
      while( it.hasNext() )
        {
        Statement torem = it.nextStatement();
        toDel.add( torem );
        toAdd.add( torem.getSubject(), toAdd.createProperty( replacement ), torem.getObject() );
        }
     
      // Replace all instances of statement object curr in input with replacement
View Full Code Here


     
      // Replace all instances of statement object curr in input with replacement
      it = input.listStatements((Resource)null, (Property)null, input.createResource( curr.asNode().getURI() ));
      while( it.hasNext() )
        {
        Statement torem = it.nextStatement();
        toDel.add( torem );
        toAdd.add( torem.getSubject(), torem.getPredicate(), toAdd.createResource( replacement ) );
        }
     
      input.remove( toDel );
View Full Code Here

        namespaces = children.clone();
   
    StmtIterator it = repair.listStatements( (Resource)null, EYE.notFromSchema, (RDFNode)null );
    while ( it.hasNext() )
      {
      subject = it.nextStatement().getSubject();                
      curr = repair.listObjectsOfProperty( subject, EYE.onResource ).nextNode();
     
      boolean fixed = false;
     
      for ( int j = 0; j < namespaces.length; j++ )
View Full Code Here

        {
        Model currNS = ModelFactory.createDefaultModel().read( "file:" + nsBase + "/" + namespaces[j] );
        StmtIterator iter = currNS.listStatements( (Resource)null, RDF.type, (RDFNode)null );
        while( iter.hasNext() )
          {
          Resource thisSubj = iter.nextStatement().getSubject();
          if ( thisSubj.getLocalName() != null )
            if ( thisSubj.getLocalName().equals( curr.asNode().getLocalName() ) )
              {
                fixURI( thisSubj.getURI() );
                fixed = true;
View Full Code Here

        // Now remove statements where their object is not of this type from this cardinality failure
        StmtIterator it1e = input.listStatements( input.createResource( repair.listObjectsOfProperty( curr, EYE.cardinalityFailure ).nextNode().asNode().getURI() ), input.createProperty( repair.listObjectsOfProperty( curr, EYE.onProperty ).nextNode().asNode().getURI() ), (RDFNode)null );
        Model remStat = ModelFactory.createDefaultModel();
        while ( it1e.hasNext() && numVals > maxCard ) // No sense removing more statements than we absolutely have to
          {
          Statement testing = it1e.nextStatement();
          String datatype = testing.getObject().asNode().getLiteralDatatypeURI();
          if ( datatype == null )
            datatype = defaultURI;
          if ( datatype != decided )
            {
View Full Code Here

    Model out = ModelFactory.createDefaultModel();
    StmtIterator it = in.listStatements( null, RDFS.subClassOf, (RDFNode)null );
    int greatestDepth = 0;
    while ( it.hasNext() )
      {
      Statement curr = it.nextStatement();
      if ( in.listSubjectsWithProperty( RDFS.subClassOf, curr.getSubject() ).toList().size() <= 1 )
        {
        out.add( curr );
        out.add( input.listStatements( curr.getSubject(), null, (RDFNode)null ) );
        int temp = getDepthOf( curr.getSubject() );
View Full Code Here

      }
    it = out.listStatements();
    Model torem = ModelFactory.createDefaultModel();
    while ( it.hasNext() )
      {
      Statement curr = it.nextStatement();
      if ( getDepthOf( curr.getSubject() ) < greatestDepth )
        torem.add( curr );
      }
    out.remove( torem );
    return out;
View Full Code Here

   
    StmtIterator it = repair.listStatements(null, EYE.cardinalityFailure, (RDFNode)null);
   
    while ( it.hasNext() )
      {
      Statement currFailure = it.nextStatement();
      Resource subj = currFailure.getSubject();
      NodeIterator it2 = repair.listObjectsOfProperty( subj, EYE.repairType );
      while ( it2.hasNext() )
        {
        RDFNode curr = it2.nextNode();
View Full Code Here

  for ( int i = 0; i < typeCounts.length; i++ )
    typeCounts[i] = 0;
  ArrayList<String> types = new ArrayList<String>();
  while ( it.hasNext() )
    {
    String currType = it.nextStatement().getObject().asNode().getURI();
    if ( !types.contains( currType ) )
      types.add( currType );
    typeCounts[ types.indexOf( currType ) ]++;
    }
 
View Full Code Here

        {
        Model currNS = ModelFactory.createDefaultModel().read( "file:" + nsBase + "/" + namespaces[j] );
        StmtIterator iter = currNS.listStatements( (Resource)null, RDF.type, (RDFNode)null );
        while( iter.hasNext() )
          {
          Resource thisSubj = iter.nextStatement().getSubject();
          if ( thisSubj.getLocalName() != null )
            if ( thisSubj.getLocalName().equals( curr.asNode().getLocalName() ) )
              {
                fixURI( thisSubj.getURI() );
                fixed = true;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.