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

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


  Resource classType = ((OntModel)input).getProfile().CLASS();
 
  NodeIterator it = repair.listObjectsOfProperty( EYE.unknownClass );
  while( it.hasNext() )
    {
    RDFNode curr = it.nextNode();
    Resource subject = repair.listSubjectsWithProperty( EYE.unknownClass, curr ).nextResource();
      Resource stmtBnode = repair.createResource();
    repair.add( subject, EYE.repairConfidence, EYE.moderate )
          .add( subject, EYE.repairType, EYE.defineClass )
          .add( subject, EYE.checkFix, RDF.Statement )
          .add( subject, EYE.statementAdded, stmtBnode )
        .add( stmtBnode, RDF.type, RDF.Statement )
        .add( stmtBnode, RDF.object, classType )
        .add( stmtBnode, RDF.predicate, RDF.type )
        .add( stmtBnode, RDF.subject, m.createResource( curr.asNode().getURI() ) );
    }
  r.setMitems( repair );
  }
View Full Code Here


   
    ResIterator it1 = repair.listSubjectsWithProperty( EYE.cardinalityFailure );
    while( it1.hasNext() )
      {
      Resource curr = it1.nextResource();
      RDFNode type = repair.listObjectsOfProperty( curr, EYE.onType ).nextNode();
      RDFNode prop = repair.listObjectsOfProperty( curr, EYE.onProperty ).nextNode();
      RDFNode b = repair.listObjectsOfProperty( curr, EYE.cardinality ).nextNode();
      RDFNode maxCardR = null;
      RDFNode minCardR = null;
      try
        {
        maxCardR = repair.listObjectsOfProperty( repair.createResource( b.asNode().getBlankNodeId() ), EYE.max ).nextNode();
        }
      catch (NoSuchElementException e) {}
      finally
        {
        try
          {
          minCardR = repair.listObjectsOfProperty( repair.createResource( b.asNode().getBlankNodeId() ), EYE.min ).nextNode();
          }
        catch (NoSuchElementException e) {}
       
        if ( maxCardR == null )    // Set these equal if the Eyeball report didn't specify
          maxCardR = minCardR;  //  (see below - this *shouldn't* cause an issue - send me
        else if ( minCardR == null )//    a test case if it does ;o) )
          minCardR = maxCardR;
        }
      RDFNode numValsR = repair.listObjectsOfProperty( curr, EYE.numValues ).nextNode();
     
      int maxCard = strToInt( maxCardR.asNode().getLiteralLexicalForm() );
      int numVals = strToInt( numValsR.asNode().getLiteralLexicalForm() );
     
      NodeIterator it1b = m.listObjectsOfProperty( m.createResource( type.asNode().getURI() ), RDFS.subClassOf );
      while (it1b.hasNext() )
        {
        b = it1b.nextNode();
          try
            {
            if ( b.isAnon() )
              {
              if ( m.listObjectsOfProperty( m.createResource( b.asNode().getBlankNodeId() ), OWL.onProperty ).nextNode().equals( prop ) )
                break;
              }
            else
              if ( m.listObjectsOfProperty( m.createResource( b.asNode().getURI() ), OWL.onProperty ).nextNode().equals( prop ) )
                break;
            }
          catch (java.util.NoSuchElementException e)
            { // Not all statements returned are going to match the search above;
            } //  don't complain / warn about it!
        }
     
      // This looks misleading, but it will not be called if numVals > maxCard and owl:maxCardinality is not specified in the model!
      if ( numVals > maxCard )
        { // Increase owl:maxCardinality as needed, unless we can remove some invalid type declarations...
        // Get the rdfs:members of this failure's eye:values eye:Set
        List<String> types = new ArrayList<String>();
        List<Integer> typeCount = new ArrayList<Integer>();
        NodeIterator it1c = repair.listObjectsOfProperty( repair.createResource( repair.listObjectsOfProperty( curr, EYE.values ).nextNode().asNode().getBlankNodeId() ), RDFS.member);
        String defaultURI = "http://www.w3.org/2001/XMLSchema#String"; // This will be used later too (config file it??)
       
        while ( it1c.hasNext() )
          {
          RDFNode member = it1c.nextNode();
          String uri = member.asNode().getLiteralDatatypeURI();
          if ( uri == null )
            uri = defaultURI; // Default datatype URI
          if ( types.contains( uri ) )
            {
            int idx = types.lastIndexOf( uri );
View Full Code Here

      {
      Resource curr = it1.nextResource();
        String datatype = findDatatype( repair.listObjectsOfProperty( curr, EYE.onLiteral ).nextNode().asNode().getLiteralLexicalForm() );
        if ( datatype == null )
          { // Find the default action defined in config
          RDFNode defaultFix = config.listObjectsOfProperty( EYE.repairConfig, EYE.defaultLiteralFix ).nextNode();
          if ( defaultFix.equals( EYE.defaultLanguage ) )
            {
            String language = config.listObjectsOfProperty( EYE.repairConfig, EYE.defaultLanguage ).nextNode().asNode().getLiteralLexicalForm();
            repair.add( curr, EYE.repairConfidence, EYE.low )
                  .add( curr, EYE.repairType, EYE.setLanguage )
                  .add( curr, EYE.checkFix, RDF.object )
View Full Code Here

            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() );
                RDFNode obj = repair.listObjectsOfProperty( bn, RDF.object ).nextNode();
                output.add( subj, pred, obj);
                }
      }
    }
View Full Code Here

      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() )
            {
            Resource bn = repair.createResource( it2.nextNode().asNode().getBlankNodeId() );
            Resource subj = (Resource)repair.listObjectsOfProperty( bn, RDF.subject ).nextNode();
            Property pred = input.createProperty( repair.listObjectsOfProperty( bn, RDF.predicate ).nextNode().asNode().getURI() );
            RDFNode obj = repair.listObjectsOfProperty( bn, RDF.object ).nextNode();
            output.remove( subj, pred, obj );
            }
          }
        else
          {
          RDFNode res = report.listObjectsOfProperty( curr, EYE.noConsistentTypeFor ).nextNode();
          Resource newClass = output.createResource();
          NodeIterator itb = ((OntModel)output).getBaseModel().listObjectsOfProperty( output.createResource( res.asNode().getURI() ), RDF.type );
          output.add( newClass, RDF.type, RDFS.Class );
          output.add( output.createResource( res.asNode().getURI() ), RDF.type, newClass );
          while ( itb.hasNext() )
            {
            RDFNode thisType = itb.nextNode();
            output.add( newClass, RDFS.subClassOf, thisType );
            output.remove( output.createStatement( output.createResource( res.asNode().getURI() ), RDF.type, thisType ) );
            }
          }
        }
View Full Code Here

    if ( x.equals( y ) )
      return true;
    else
      while ( it.hasNext() )
        {
        RDFNode curr = it.nextNode();
        if ( !curr.equals( x ) )
          if ( curr.isURIResource() )
            {
            if ( xSubClassOfY( input.createResource( curr.asNode().getURI() ), y ) )
              return true;
            }
          else
            {
            if ( xSubClassOfY( input.createResource( curr.asNode().getBlankNodeId() ), y ) )
              return true;
            }
        }
    return false;
    }
View Full Code Here

    {
    int greatestDepth = 1;
    NodeIterator it = input.listObjectsOfProperty( node, RDFS.subClassOf );
    while ( it.hasNext() )
      {
      RDFNode thisnode = it.nextNode();
      Resource curr = null;
      if ( thisnode.isURIResource() )
        curr = input.createResource( thisnode.asNode().getURI() );
      else
        curr = input.createResource( thisnode.asNode().getBlankNodeId() );
      if ( !curr.equals( node ) )
        {
        int temp = getDepthOf( curr );
        if ( temp > greatestDepth )
          greatestDepth = temp;
View Full Code Here

      subbiest = RDFS.Resource;
   
    NodeIterator it1 = repair.listObjectsOfProperty( EYE.hasNoType );
    while( it1.hasNext() )
      {
      RDFNode curr = it1.nextNode();
     
      Resource thisres = null;
     
      if ( curr.isURIResource() )
        thisres = repair.createResource( curr.asNode().getURI() );
      else
        thisres = repair.createResource( curr.asNode().getBlankNodeId() );
     
      thisres = (Resource)curr;
     
      Resource stmtBnode = repair.createResource();
      Resource subject = repair.listSubjectsWithProperty(EYE.hasNoType, curr).nextResource();
View Full Code Here

      Statement currFailure = it.nextStatement();
      Resource subj = currFailure.getSubject();
      NodeIterator it2 = repair.listObjectsOfProperty( subj, EYE.repairType );
      while ( it2.hasNext() )
        {
        RDFNode curr = it2.nextNode();
        if ( curr.equals( EYE.decreaseNumProperties ) )
          {
          NodeIterator it3 = repair.listObjectsOfProperty( subj, EYE.statementRemoved );
          while ( it3.hasNext() )
            {
            Resource remStat = (Resource)it3.nextNode();
            Resource remS = (Resource)repair.listObjectsOfProperty( remStat, RDF.subject ).nextNode();
            Property remP = output.createProperty( repair.listObjectsOfProperty( remStat, RDF.predicate ).nextNode().asNode().getURI() );
            RDFNode remO = repair.listObjectsOfProperty( remStat, RDF.object ).nextNode();
            output.remove( remS, remP, remO );
            }
          }
        else if ( curr.equals( EYE.increaseNumProperties ) )
          {
View Full Code Here

        {
        Resource bnode = repair.createResource( it2.nextNode().asNode().getBlankNodeId() );
       
        Resource subj =  (Resource)repair.listObjectsOfProperty( bnode, RDF.subject ).nextNode();
        Property pred = output.createProperty( repair.listObjectsOfProperty( bnode, RDF.predicate ).nextNode().asNode().getURI() );
        RDFNode obj = repair.listObjectsOfProperty( bnode, RDF.object ).nextNode();
       
        output.add( subj, pred, obj );
        }
      }
    }
View Full Code Here

TOP

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

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.