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

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


  public void test30() throws Exception {
    System.out.println("** test30");
   
    Model termModel = Utils.readTermModel(retrievedTermContents);
    Resource termResource = ResourceFactory.createResource(termUri);
    Property name = ResourceFactory.createProperty(nameUri);
    Property description = ResourceFactory.createProperty(descriptionUri);

    assertTrue( termModel.contains(termResource, RDFS.label, "termThree") );
    assertTrue( termModel.contains(termResource, name, "termThree") );
    assertTrue( termModel.contains(termResource, description, "description of termThree") );
   
View Full Code Here


   
      RDFNode rdfNode = stmt.getObject();
      if ( rdfNode.isAnon() ) {
        continue;
      }
      Property prop = stmt.getPredicate();
     
      // ...
     
      String propName = prop.getLocalName();
      String propUri = prop.getURI();
      String valueName = null;
      String valueUri = null;
     
      if ( rdfNode.isResource() ) {
        Resource r = (Resource) rdfNode;
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
      // one of the SKOS xxxMatch properties. Try the two SKOS namespaces:
      else if ( prd.getNameSpace().equals(Skos.NS||  prd.getNameSpace().equals(Skos2.NS)) {
        if ( prd.getLocalName().endsWith("Match") ) {
          //
          // Yes, it's a simple statement with a xxxxMatch predicate:
          //
          StmtKey stmtKey = _getStmtKey(stmt);
          if ( stmtKey != null ) {
View Full Code Here

   * Gets the key (s,p,o) for a simple (non-reified) statement.
   * Returns null if not all components are defined.
   */
  private static StmtKey _getStmtKey(Statement stmt) {
    Resource sjt = stmt.getSubject();
    Property prd = stmt.getPredicate();
   
    String left = sjt.isAnon() ? null : sjt.getURI();
    String rel = prd.isAnon() ? null : prd.getURI();
    String right = _getValueAsString(stmt.getObject());
   
    if ( left != null && rel != null && right != null ) {
      return new StmtKey(left, rel, right);
    }
View Full Code Here

    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) ) {
View Full Code Here

   
    // 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

                    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

        dataset.begin(ReadWrite.WRITE);
        Model m = dataset.getDefaultModel();

        m.removeAll();
        Resource subject = m.createResource(INDEX_INFO_SUBJECT);
        Property predicate = m.createProperty(TIMESTAMP_PREDICATE);
        m.addLiteral(subject, predicate, System.currentTimeMillis());
        predicate = m.createProperty(URI_PREDICATE);
        for (String uri : lastProcessedUris) {
          m.add(subject, predicate, m.createResource(uri));
        }
View Full Code Here

    {
        // Test from Benson Margulies : JENA-82
        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();
View Full Code Here

        {
          s = this.jenaModel.createResource(((Node)((AbstractBlankNodeImpl)subject)
                  .getUnderlyingBlankNode()).getBlankNodeId());
        }
       
        Property p = this.jenaModel.createProperty(predicate.toString());
       
        String datatypeValue = ((DatatypeLiteral)object).getValue();
        String datatypeURI = ((DatatypeLiteral)object).getDatatype().toString();
        Literal o = this.jenaModel.createTypedLiteral(datatypeValue, datatypeURI);
       
View Full Code Here

TOP

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

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.