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

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


                        //read the RDF/XML file
                        model.read(new InputStreamReader(
                                new FileInputStream(modelPath)), "");

                        //predicate for filtering the category location
                        Selector selector = new SelectorImpl(null,
                                RP.categoryLocation, (RDFNode) null);

                        // Filtering
                        StmtIterator iter = model.listStatements(selector);
View Full Code Here


                //read the RDF/XML file
                model.read(new InputStreamReader(new FileInputStream(modelPath)),
                    "");

                //predicate for filtering the category location
                Selector selector = new SelectorImpl(null, RP.directScore,
                        (RDFNode) null);

                // Filtering
                StmtIterator iter = model.listStatements(selector);
View Full Code Here

                //read the RDF/XML file
                model.read(new InputStreamReader(new FileInputStream(modelPath)),
                    "");

                //predicate for filtering the category location
                Selector selector = new SelectorImpl(null, RP.directScore,
                        (RDFNode) null);

                // Filtering
                StmtIterator iter = model.listStatements(selector);
View Full Code Here

                    //read the RDF/XML file
                    model.read(new InputStreamReader(
                            new FileInputStream(modelpath)), "");

                    //Predicate for filtering the linkToId
                    Selector selector = new SelectorImpl(null, RP.linkToId,
                            (RDFNode) null);

                    // Filtering
                    StmtIterator iter = model.listStatements(selector);

                    //sum for implied score
                    double sumImpliedScore = 0.00;

                    while (iter.hasNext()) {
                        //get the statement
                        Statement stmt = iter.nextStatement();

                        //get the resource 
                        Resource node = stmt.getSubject();

                        //get the resource properties (linktoid and linktocategory)
                        String linktoid = node.getProperty(RP.linkToId)
                                              .getObject().toString();
                        String linktocategory = node.getProperty(RP.linkToCategory)
                                                    .getObject().toString();

                        //construct the unique element (categname/documid)
                        String compare = linktocategory + SEPARATOR + linktoid;

                        //validate if the element was not already add it
                        if (listElemUnique.contains(compare)) {
                            listElemUnique.remove(compare);

                            //get the implied score
                            try {
                                sumImpliedScore = sumImpliedScore +
                                    getImpliedScore(linktocategory, linktoid);
                            } catch (RpException e) {
                                logger.info("Exception in calculate the implied weight",
                                    e);
                            }
                        }
                    }

                    //if there are still links-elements in the list and must to be add it to the model
                    if (!listElemUnique.isEmpty()) {
                        Iterator it = listElemUnique.iterator();

                        while (it.hasNext()) {
                            String elem = (String) it.next();
                            int index = elem.lastIndexOf(SEPARATOR);
                            String linktocategory = elem.substring(0, index);
                            String linktoid = elem.substring(index + 1);

                            //add the resource
                            Resource link = model.createResource()
                                                 .addProperty(RP.linkToCategory,
                                    linktocategory).addProperty(RP.linkToId,
                                    linktoid);
                        }
                    }

                    //update the calc_score of the node according to the average of the set
                    //Predicate for filtering the calc_score
                    Selector selScore = new SelectorImpl(null, RP.calcScore,
                            (RDFNode) null);

                    // Filtering
                    StmtIterator iterScore = model.listStatements(selScore);
View Full Code Here

                //read the RDF/XML file
                model.read(new InputStreamReader(new FileInputStream(modelpath)),
                    "");

                //Predicate for filtering direct score
                Selector selector = new SelectorImpl(null, RP.directScore,
                        (RDFNode) null);

                // Filtering
                StmtIterator iter = model.listStatements(selector);
View Full Code Here

                //read the RDF/XML file
                model.read(new InputStreamReader(new FileInputStream(modelpath)),
                    "");

                //Predicate for filtering the category score
                Selector selector = new SelectorImpl(null, RP.categoryScore,
                        (RDFNode) null);

                // Filtering
                StmtIterator iter = model.listStatements(selector);
View Full Code Here

                //read the RDF/XML file
                model.read(new InputStreamReader(new FileInputStream(modelpath)),
                    "");

                //Predicate for filtering the feedback type
                Selector selector = new SelectorImpl(null, RP.type,
                        (RDFNode) null);

                // Filtering
                StmtIterator iter = model.listStatements(selector);
View Full Code Here

    super(modelFactory, name);
  }

  public void check( final Resource S, final Property P, final RDFNode O )
  {
    final Selector s = new SimpleSelector(S, P, O);
    Assert.assertTrue(s.isSimple());
    Assert.assertEquals(S, s.getSubject());
    Assert.assertEquals(P, s.getPredicate());
    Assert.assertEquals(O, s.getObject());
  }
View Full Code Here

  public void testListStatementsClever()
  {

    ModelHelper.modelAdd(model, "S P O; S P O2; S P2 O; S2 P O");
    final Selector sel = new SimpleSelector(null, null, (RDFNode) null) {
      @Override
      public boolean isSimple()
      {
        return false;
      }
View Full Code Here

  }

  @Test
  public void testQuery() throws Exception
  {
    final Selector s = new SimpleSelector();
    try
    {
      securedModel.query(s);
      if (!securityEvaluator.evaluate(Action.Read))
      {
View Full Code Here

TOP

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

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.