Package org.apache.clerezza.rdf.core

Examples of org.apache.clerezza.rdf.core.TripleCollection.filter()


  private GraphNode getResourceAsGraphNode(UriInfo uriInfo) {
    final UriRef uri = new UriRef(uriInfo.getAbsolutePath().toString());
    GraphNode result = graphNodeProvider.getLocal(uri);
    //could chck if nodeContext > 0, but this would be less efficient
    TripleCollection tc = result.getGraph();
    if (tc.filter(uri, null, null).hasNext()) {
      return result;
    }
    if (tc.filter(null, null, uri).hasNext()) {
      return result;
    }
View Full Code Here


    //could chck if nodeContext > 0, but this would be less efficient
    TripleCollection tc = result.getGraph();
    if (tc.filter(uri, null, null).hasNext()) {
      return result;
    }
    if (tc.filter(null, null, uri).hasNext()) {
      return result;
    }
    return null;
  }
View Full Code Here

    base.add(new TripleImpl(me, SiblingEnricher.parentProperty, mother));
    base.add(new TripleImpl(sister, SiblingEnricher.parentProperty, mother));
    base.add(new TripleImpl(mother, SiblingEnricher.parentProperty, grandMother));
    base.add(new TripleImpl(uncle, SiblingEnricher.parentProperty, grandMother));
    base.add(new TripleImpl(cousin, SiblingEnricher.parentProperty, uncle));
    Assert.assertTrue(enrichmentTriples.filter(sister, SiblingEnricher.siblingProperty, me).hasNext());
    Assert.assertTrue(enrichmentTriples.filter(uncle, SiblingEnricher.siblingProperty, mother).hasNext());
    Assert.assertFalse(enrichmentTriples.filter(uncle, SiblingEnricher.siblingProperty, sister).hasNext());
  }

  @Test
View Full Code Here

    base.add(new TripleImpl(sister, SiblingEnricher.parentProperty, mother));
    base.add(new TripleImpl(mother, SiblingEnricher.parentProperty, grandMother));
    base.add(new TripleImpl(uncle, SiblingEnricher.parentProperty, grandMother));
    base.add(new TripleImpl(cousin, SiblingEnricher.parentProperty, uncle));
    Assert.assertTrue(enrichmentTriples.filter(sister, SiblingEnricher.siblingProperty, me).hasNext());
    Assert.assertTrue(enrichmentTriples.filter(uncle, SiblingEnricher.siblingProperty, mother).hasNext());
    Assert.assertFalse(enrichmentTriples.filter(uncle, SiblingEnricher.siblingProperty, sister).hasNext());
  }

  @Test
  public void cityWeather() {
View Full Code Here

    base.add(new TripleImpl(mother, SiblingEnricher.parentProperty, grandMother));
    base.add(new TripleImpl(uncle, SiblingEnricher.parentProperty, grandMother));
    base.add(new TripleImpl(cousin, SiblingEnricher.parentProperty, uncle));
    Assert.assertTrue(enrichmentTriples.filter(sister, SiblingEnricher.siblingProperty, me).hasNext());
    Assert.assertTrue(enrichmentTriples.filter(uncle, SiblingEnricher.siblingProperty, mother).hasNext());
    Assert.assertFalse(enrichmentTriples.filter(uncle, SiblingEnricher.siblingProperty, sister).hasNext());
  }

  @Test
  public void cityWeather() {
    MGraph base = new SimpleMGraph();
View Full Code Here

        Collections.singleton(cityEnricher));
    NonLiteral london = new UriRef("http://example.org/london");
    NonLiteral me = new UriRef("http://example.org/me");
    base.add(new TripleImpl(me, RDF.type, FOAF.Agent));
    base.add(new TripleImpl(london, RDF.type, CityWeatherEnricher.classCity));
    Assert.assertTrue(enrichmentTriples.filter(london, CityWeatherEnricher.weatherProperty, null).hasNext());
    GraphNode node = new GraphNode(london, enrichmentTriples);
    Assert.assertEquals("0.51",
        node.getObjectNodes(CityWeatherEnricher.weatherProperty).next()
        .getLiterals(CityWeatherEnricher.humidityProperty).next().getLexicalForm());
    Assert.assertEquals(Double.toString(london.toString().length()),
View Full Code Here

    metaData.add(new IptcDataSet(IptcDataSet.KEYWORDS, "keyword3"));
    metaData.add(new IptcDataSet(IptcDataSet.CITY, "City"));
   
    TripleCollection tc = MetaDataUtils.convertIptcToXmp(metaData);

    Iterator<Triple> it = tc.filter(null, new UriRef(DC.subject.getURI()), null);
    it = tc.filter((NonLiteral) it.next().getObject(), null, null);
    while(it.hasNext()) {
      Triple triple = it.next();
      Assert.assertTrue(
          triple.getObject().toString().contains("keyword1") ||
View Full Code Here

    metaData.add(new IptcDataSet(IptcDataSet.CITY, "City"));
   
    TripleCollection tc = MetaDataUtils.convertIptcToXmp(metaData);

    Iterator<Triple> it = tc.filter(null, new UriRef(DC.subject.getURI()), null);
    it = tc.filter((NonLiteral) it.next().getObject(), null, null);
    while(it.hasNext()) {
      Triple triple = it.next();
      Assert.assertTrue(
          triple.getObject().toString().contains("keyword1") ||
          triple.getObject().toString().contains("keyword2") ||
View Full Code Here

          triple.getObject().toString().contains("keyword2") ||
          triple.getObject().toString().contains("keyword3") ||
          triple.getObject().toString().contains(RDF.Bag.getURI()));
    }

    Assert.assertTrue(tc.filter(null,
        new UriRef("http://ns.adobe.com/photoshop/1.0/City"),
        new PlainLiteralImpl("City")).hasNext());
  }
 
  @Test
View Full Code Here

    metaData2.add(new ExifTagDataSet(ExifTagDataSet.UserComment, "Bla Bla Bla"));
    metaData2.add(new ExifTagDataSet(ExifTagDataSet.Artist, "Hans Wurst"));
   
    TripleCollection tc = MetaDataUtils.convertExifToXmp(metaData2);
   
    Iterator<Triple> it = tc.filter(null, new UriRef("http://ns.adobe.com/exif/1.0/UserComment"), null);
    it = tc.filter((NonLiteral) it.next().getObject(), null, null);
    while(it.hasNext()) {
      Triple triple = it.next();
      Assert.assertTrue(
          triple.getObject().toString().contains("Bla Bla Bla") ||
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.