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

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


    {
    this.input = m;
    this.repair = report;
    this.output = this.input;   
               
    ResIterator it = repair.listSubjectsWithProperty( EYE.repairType, EYE.defineClass );
    while ( it.hasNext() )
      {
      Resource curr = it.nextResource();
            if ( !curr.hasProperty( EYE.noConsistentTypeFor ) )
                {
                Resource bn = repair.createResource( repair.listObjectsOfProperty( curr, EYE.statementAdded ).nextNode().asNode().getBlankNodeId() );
                Resource subj = output.createResource( repair.listObjectsOfProperty( bn, RDF.subject ).nextNode().asNode().getURI() );
                Property pred = output.createProperty( repair.listObjectsOfProperty( bn, RDF.predicate ).nextNode().asNode().getURI() );
View Full Code Here


  public void analyse( Report r, Model m, Model config )
  {
  this.input = m;
  this.repair = r.model();
 
  ResIterator it1 = repair.listSubjectsWithProperty( EYE.badNamespaceURI );
  while( it1.hasNext() )
    {
    Resource curr = it1.nextResource();
    repair.add( curr, EYE.repairConfidence, EYE.low )
          .add( curr, EYE.repairType, EYE.replaceNamespace )
          .add( curr, EYE.checkFix, EYE.namespacePrefix );
    }
 
  ResIterator it2 = repair.listSubjectsWithProperty( EYE.multiplePrefixesForNamespace );
  while ( it2.hasNext() )
      {
    Resource curr = it2.nextResource();
    repair.add( curr, EYE.repairConfidence, EYE.good )
            .add( curr, EYE.repairType, EYE.removeDuplicatePrefixes )
            .add( curr, EYE.checkFix, EYE.namespacePrefix );
      }
  r.setMitems( repair );
View Full Code Here

    {
    this.input = m;
    this.repair = report;
    this.output = this.input;

      ResIterator it = report.listSubjectsWithProperty( EYE.noConsistentTypeFor );
      while( it.hasNext() )
        {
        Resource curr = it.nextResource();
        RDFNode fix = report.listObjectsOfProperty( curr, EYE.repairType ).nextNode();
        if ( fix.equals( EYE.removeType ) )
          {
          NodeIterator it2 = repair.listObjectsOfProperty( curr, EYE.statementRemoved );
          while ( it2.hasNext() )
View Full Code Here

    }
 
  private Resource getSubbiestClass( Resource parent, Model in )
    {
    Resource result = parent;
    ResIterator it = in.listSubjectsWithProperty( RDFS.subClassOf, parent );
    while ( it.hasNext() )
      {
      Resource curr = it.nextResource();
      if ( !hasBeenSeen( curr ) )
        {
        addSeen( curr );
        Resource midresult = getSubbiestClass( curr, in );
        if ( midresult != null )
View Full Code Here

    if ( !types.contains( currType ) )
      types.add( currType );
    typeCounts[ types.indexOf( currType ) ]++;
    }
 
  ResIterator it2 = repair.listSubjectsWithProperty( EYE.noConsistentTypeFor );
  while( it2.hasNext() )
    {
    Resource curr = it2.nextResource();
    // Try and compare the number of usages of clashing classes; instruct to delete if one outweighs the other
    Resource from = input.createResource( repair.listObjectsOfProperty( curr, EYE.noConsistentTypeFor ).nextNode().asNode().getURI() );
   
    NodeIterator it3 = ((OntModel)input).getBaseModel().listObjectsOfProperty( from, RDF.type );
    ArrayList<String> l = new ArrayList<String>();
View Full Code Here

    {
    this.input = m;
    this.repair = report;
    this.output = this.input;
   
    ResIterator it = repair.listSubjectsWithProperty( EYE.hasNoType );
    while ( it.hasNext() ) {
      NodeIterator it2 = repair.listObjectsOfProperty( it.nextResource(), EYE.statementAdded );
      while ( it2.hasNext() )
        {
        Resource bnode = repair.createResource( it2.nextNode().asNode().getBlankNodeId() );
       
        Resource subj =  (Resource)repair.listObjectsOfProperty( bnode, RDF.subject ).nextNode();
View Full Code Here

        // Fall back to spellcheck if we can't find it in a known NS.
        Model wordModel = ModelFactory.createDefaultModel();
        for ( int a = 0; a < namespaces.length; a++ )
          wordModel.read("file:" + nsBase + "/" + namespaces[a]);
   
        ResIterator wordIt = wordModel.listSubjectsWithProperty( RDF.type );
        String loosewords = "";
        String fullwords = "";
       
        int size = wordModel.listSubjectsWithProperty( RDF.type ).toList().size();
        looseMappingArr = new String[size];
        fullMappingArr = new String[size];
        int i = 0;
       
        while ( wordIt.hasNext() )
          {
          Resource currWord = wordIt.nextResource();
          if ( currWord.isURIResource() )
            {
            fullwords += currWord.asNode().getURI() + '\n';
           
            loosewords += currWord.getLocalName() + '\n';
View Full Code Here

 
  private Model config;

  private String getConfigsPrefixFromUri ( String uri )
    {
    ResIterator subjects = config.listSubjectsWithProperty( EYE.nsURI, config.createLiteral( uri ) );
    if ( subjects.hasNext() )
      {
      StmtIterator prefixes = config.listStatements( subjects.nextResource(), EYE.prefix, (RDFNode)null );
      if ( prefixes.hasNext() )
        return prefixes.nextStatement().getObject().asNode().getLiteralLexicalForm();
      }
    return null; // Return null otherwise
    }
View Full Code Here

    return null; // Return null otherwise
    }

  private String getConfigsUriFromPrefix ( String pre )
    {
    ResIterator subjects = config.listSubjectsWithProperty( EYE.prefix, config.createLiteral( pre ) );
    if ( subjects.hasNext() )
      {
      StmtIterator uris = config.listStatements( subjects.nextResource(), EYE.nsURI, (RDFNode)null );
      if ( uris.hasNext() )
        return uris.nextStatement().getObject().asNode().getLiteralLexicalForm();
      }
    return null; // Return null otherwise
    }
View Full Code Here

    this.input = m;
    this.repair = report;
    this.output = this.input;
    this.config = config;
   
    ResIterator it = repair.listSubjectsWithProperty( EYE.repairType, EYE.replaceNamespace );
    while ( it.hasNext() )
      {
      /*
       * We are able to make one or more of the following assumptions;
       * (1)  o The Prefix is probably desired                                       \\
       * (3)  o The URI is likely misspelt                                          ===>  Work these with the precedence specified
       * (2)  o The URI is right, but the user mistakenly used a 'reserved' prefix   //
       */
      Resource curr = it.nextResource();
      String prefix = repair.listObjectsOfProperty( curr, EYE.onPrefix ).nextNode().asNode().getLiteralLexicalForm();
      String currUri = output.getNsPrefixURI( prefix );
      String configsUri = getConfigsUriFromPrefix( prefix );
      String configsPre = null;
      if ( currUri != null )
        configsPre = getConfigsPrefixFromUri( currUri );
      if ( configsUri != null ) // Change the URI to a preferred one
        changeNsUri( currUri, configsUri );
      else if ( configsPre != null ) // Use that URI, but set the prefix according to config
        changeNsPrefix( prefix, configsPre );
      else // Use the 'expected' URI
        output.setNsPrefix( prefix, repair.listObjectsOfProperty( curr, EYE.expected ).nextNode().asNode().getLiteralLexicalForm() );
      }
   
    it = repair.listSubjectsWithProperty( EYE.repairType, EYE.removeDuplicatePrefixes );
    while ( it.hasNext() )
      {
      Resource curr = it.nextResource();
      NodeIterator it2 = repair.listObjectsOfProperty( curr, EYE.onPrefix );
        String uri = repair.listObjectsOfProperty( curr, EYE.multiplePrefixesForNamespace ).nextNode().asNode().getLiteralLexicalForm();
        if (it2.hasNext())
          {
          boolean oneKept = false;
View Full Code Here

TOP

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

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.