Examples of RDFNode


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

  // verbatim copy from JenaUtil
  public static String getValue(Resource sub, Property pro) {
    Statement sta = sub.getProperty(pro);
    if (sta != null) {
      RDFNode node = sta.getObject();
      return getValueAsString(node);
    } else {
      return null;
    }
  }
View Full Code Here

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

        Triple triple = it.next();
        String objLab = triple.getObjectLabel();
       
        Resource sbj = ResourceFactory.createResource(triple.getSubjectLabel());
        Property prd = ResourceFactory.createProperty(triple.getPredicateLabel());
        RDFNode obj;
     
      if ( triple.getObject() instanceof ResourceNode ) {
        obj = ResourceFactory.createResource(objLab);
      }
      else {
View Full Code Here

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

          }
          else {
            out.printf("<td>%s</td>", prd.toString());
          }
         
          RDFNode obj = sta.getObject();
          String objUri = null;
          if ( obj instanceof Resource ) {
            Resource objRes = (Resource) obj;
            objUri = objRes.getURI();
          }
          if ( objUri != null ) {
            out.printf("<td><a href=\"%s\">%s</a></td>", objUri, objUri);
          }
          else {
            out.printf("<td>%s</td>", obj.toString());
          }
         
          out.printf("</tr>%n");
        }
       
View Full Code Here

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

  private List<String> _getDataRangeElementList(DataRange dataRange) {
    List<String> list = new ArrayList<String>();
    if ( dataRange != null ) {
      RDFList rdfList = dataRange.getOneOf();
      while ( rdfList != null && ! rdfList.isEmpty() ) {
        RDFNode elem = rdfList.getHead();
        Literal obj = (Literal) elem;
        String name = obj.getLexicalForm();
        list.add(name);
        rdfList = rdfList.getTail();
      }
View Full Code Here

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

      }
     
      Resource sbj = stmt.getSubject();
      String sbjName = sbj.getURI();
      Property prd = stmt.getPredicate();
      RDFNode obj = stmt.getObject();
      String objName = obj.isResource() ?
          ((Resource) obj).getURI() : ((Literal) obj).getString();
         
      if ( obj.isAnon() ) {
        String id = ((Resource) obj).getId().getLabelString();
        objName = id;
        Map<String, Restriction> restrictions = _info.getRestrictions();
        Restriction restr = restrictions.get(id);
        if ( restr != null ) {
View Full Code Here

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

    while ( iter.hasNext() ) {
      final Statement stmt = iter.nextStatement();
     
      final Resource sbj = stmt.getSubject();
      final Property prd = stmt.getPredicate();
      final RDFNode obj = stmt.getObject();
     
      if ( sbj.isAnon() ) {
        continue;
      }
     
      if ( prd.getNameSpace().equals(RDFS.getURI()) ) {
//        System.out.println(" ///////**** " +prd);

        if ( RDFS.label.equals(prd) ) {
          Literal objLit = (Literal) obj;
          _rdfsLabels.put(sbj, objLit.getLexicalForm());
          continue;
        }

        if ( RDFS.subPropertyOf.equals(prd)
        ||   RDFS.seeAlso.equals(prd)
        ||   RDFS.comment.equals(prd)
        ) {
          continue;
        }
      }

      if ( OWL.inverseOf.equals(prd) ) {
        continue;
      }
     
     
      if ( RDFS.subClassOf.equals(prd)  ) {
        Resource objRsr = (Resource) obj;
        _info._putSubAndSuperClazz(sbj, objRsr);
      }
     
      else if ( RDF.type.equals(prd) ) {
        Resource objRsr = (Resource) obj;
       
        if ( OWL.Ontology.equals(objRsr) ) {
          _info._addOntology(sbj);
        }
       
        // TODO remove this temporary hard-coded filter
        if ( OWL.Ontology.equals(objRsr)
        ||   OWL.ObjectProperty.equals(objRsr)
        ||   OWL.DatatypeProperty.equals(objRsr)
        ||   OWL.SymmetricProperty.equals(objRsr)
        ||   OWL.TransitiveProperty.equals(objRsr)
        ||   OWL.FunctionalProperty.equals(objRsr)
        ||   OWL.inverseOf.equals(objRsr)
        ||   OWL.Class.equals(objRsr)
        ||   OWL.AnnotationProperty.equals(objRsr)
        ||   OWL_NAMED_INDIVIDUAL.equals(objRsr)
        ) {
          continue;
        }
       
        _info._putInstance(sbj, objRsr);
      }
     
      else {
       
        if ( RDFS.domain.equals(prd) ) {
          Resource objRsr = (Resource) obj;
          _putDomain(sbj, objRsr);
        }
        else if ( RDFS.range.equals(prd) ) {
          Resource objRsr = (Resource) obj;
          _putRange(sbj, objRsr);
        }
         
       
        // other kind of relationship.
       
        if ( obj.isLiteral() ) {
          _putDataTypePropertyInstantiation(sbj, stmt);
        }
        else {
          // uncategorized statement
          _info._addStatement(stmt);
View Full Code Here

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

    for ( Ontology ontology : list ) {
      String ontUri = ontology.getURI();
      System.err.println("_prepareInfoAboutOntology: ontUri: " +ontUri);
      String versionFrom = null;
      String versionValue = null;
      RDFNode node = ontology.getPropertyValue(OMV_VERSION);
      if ( node != null ) {
        versionFrom = " (from omv:version)";
        if ( node.isLiteral() ) {
          versionValue = ((Literal) node).getLexicalForm();
        }
        else {
          versionValue = node.toString();
        }
      }
      else {
        versionValue = ontology.getVersionInfo();
        if ( versionValue != null ) {
View Full Code Here

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

      QuerySolution sol = results.nextSolution();
      Iterator<?> varNames = sol.varNames();
      while ( varNames.hasNext() ) {
        String varName = String.valueOf(varNames.next());

        RDFNode rdfNode = sol.get(varName);
       
        if ( rdfNode.isAnon() ) {
          continue;
        }
       
        String varValue = String.valueOf(rdfNode);
       
View Full Code Here

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

      QuerySolution sol = results.nextSolution();
      Iterator<?> varNames = sol.varNames();
      while ( varNames.hasNext() ) {
        String varName = String.valueOf(varNames.next());

        RDFNode rdfNode = sol.get(varName);
       
        if ( rdfNode.isAnon() ) {
          continue;
        }
       
        String varValue = String.valueOf(rdfNode);
       
View Full Code Here

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

      QuerySolution sol = results.nextSolution();
      Iterator<?> varNames = sol.varNames();
      while ( varNames.hasNext() ) {
        String varName = String.valueOf(varNames.next());
       
        RDFNode rdfNode = sol.get(varName);
       
        if ( rdfNode.isAnon() ) {
          continue;
        }
       
        String entityUri = String.valueOf(rdfNode);
        if ( entityUri == null ) {
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.