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

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


        The strings are "equality groups": the nodes should test equal iff their
        associated strings test equal.
    */
    private Object [][] eqTestCases()
    {
        AnonId id = AnonId.create();
        LiteralLabel L2 = LiteralLabelFactory.create( id.toString(), "", false );

        LiteralLabel LLang1 = LiteralLabelFactory.create( "xyz", "en", null) ;
        LiteralLabel LLang2 = LiteralLabelFactory.create( "xyz", "EN", null) ;

        String U2 = id.toString();
        String N2 = id.toString();
        return new Object [][]
            {
            { Node.ANY, "0" },
            { NodeFactory.createAnon( id ), "1" },
            { NodeFactory.createAnon(), "2" },
View Full Code Here


        test that the label of a Node can be retrieved from that Node in
        a way appropriate to that Node.
    */
    public void testLabels()
        {
        AnonId id = AnonId.create();
        assertEquals( "get URI value", U, NodeFactory.createURI( U ).getURI() );
        assertEquals( "get blank value", id, NodeFactory.createAnon( id ).getBlankNodeId() );
        assertEquals( "get literal value", L, NodeFactory.createLiteral( L ).getLiteral() );
        assertEquals( "get variable name", N, NodeFactory.createVariable( N ).getName() );
        }
View Full Code Here

    public void testCreateAnon()
        {
        String idA = "_xxx", idB = "_yyy";
        Node a = NodeCreateUtils.create( idA ), b = NodeCreateUtils.create( idB );
        assertTrue( "both must be bnodes", a.isBlank() && b.isBlank() );
        assertEquals( new AnonId( idA ), a.getBlankNodeId() );
        assertEquals( new AnonId( idB ), b.getBlankNodeId() );
        }
View Full Code Here

        if (first == '\'' || first == '\"')
            return NodeFactory.createLiteral( newString( pm, first, x ) );
        if (Character.isDigit( first ))
            return NodeFactory.createLiteral( x, "", XSDDatatype.XSDinteger );
        if (first == '_')
            return NodeFactory.createAnon( new AnonId( x ) );
        if (x.equals( "??" ))
            return Node.ANY;
        if (first == '?')
            return NodeFactory.createVariable( x.substring( 1 ) );
        if (first == '&')
View Full Code Here

    private static final String N = "Alice";
    private static final LiteralLabel L = LiteralLabelFactory.create( "ashes are burning", "en", false );
       
    public void testTripleEquals() {
        // create some nodes to test
        AnonId id = AnonId.create();
        LiteralLabel L2 = LiteralLabelFactory.create(id.toString(), "", false);
        String U2 = id.toString();
        String N2 = id.toString();

        Node[] nodes = new Node[] {
            Node.ANY,
            NodeFactory.createAnon(id),    NodeFactory.createAnon(),
            NodeFactory.createLiteral(L),  NodeFactory.createLiteral(L2),
View Full Code Here

    /** Recover a Node from a stored Lucene/Solr string */
    public static Node stringToNode(String v) {
        if ( v.startsWith("_:") ) {
            v = v.substring("_:".length()) ;
            return NodeFactory.createAnon(new AnonId(v)) ;
        }
        else
            return NodeFactory.createURI(v) ;
    }
View Full Code Here

  /**
   * @param string
   * @return
   */
  private Resource getLocation(String anonIdString) {
    AnonId anonId = new AnonId(anonIdString);
    return model.createResource(anonId);
  }
View Full Code Here

    Property predicate;
    RDFNode object;
    if (subjectString.charAt(0)== '[') {
      subject =
        model.createResource(
          new AnonId(
            subjectString.substring(
              1,
              subjectString.length() - 1)));
    } else {
      subject =
      model.createResource(subjectString);
    }
    predicate = model.createProperty(predicateString);
    if (objectString.charAt(0)== '\"') {
      object = model.createLiteral(objectString.substring(
              1,
          objectString.length() - 1));
    } else {
      if (objectString.charAt(0)== '[') {
        object =
        model.createResource(
            new AnonId(
                objectString.substring(
                    1,
                    objectString.length() - 1)));
      } else {
        object =
View Full Code Here

  private Resource getRegion(String anonIdString) {
    if (anonIdString.equals("any")) {
      return null;
    }
    AnonId anonId = new AnonId(anonIdString);
    return model.createResource(anonId);
  }
View Full Code Here

  /**
   * @param codeOrig
   * @return
   */
  private Resource getSpatialThingByID(String id) {
    Resource result = model.createResource(new AnonId(id));
    return result;
  }
View Full Code Here

TOP

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

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.