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

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


   * @param metaModel
   */
  public void loadFromModel(Model metaModel) {
//    ResIterator  resIterator = metaModel.listSubjectsWithProperty(RDF.type,
//        METAMODEL.Assertion);
    ResIterator  resIterator = metaModel.listSubjectsWithProperty(METAMODEL.asserter);
    while (resIterator.hasNext()) {
      Resource assertion = resIterator.nextResource();
     
      Resource assertedComponent = assertion.getProperty(
          METAMODEL.assertedComponent).getResource();
      Resource type = null;
      StmtIterator typeIter = assertedComponent.listProperties(RDF.type);
View Full Code Here


  public Set<NamedNode> getAsserted(Set<Source> sources, Date moment,
      Resource type) {
    Set<NamedNode> result = new HashSet<NamedNode>();
    for (Source source : sources) {
      Resource sourceRes = metaModel.createResource(source.getURIRef());
      ResIterator assertions = metaModel.listSubjectsWithProperty(
          METAMODEL.asserter, sourceRes);
      while (assertions.hasNext()) {
        Resource assertion = assertions.nextResource();
        Literal assertionTimeLit = assertion.getProperty(
            METAMODEL.assertionTime).getLiteral();
        Resource assertedComponent = assertion.getProperty(
            METAMODEL.assertedComponent).getResource();
        if (!assertedComponent.hasProperty(RDF.type, type)) {
View Full Code Here

  private Resource getAssertionOf(Source source, NamedNode componentName,
      Date moment) {
    Resource sourceRes = metaModel.createResource(source.getURIRef());
    Resource component = metaModel
        .createResource(componentName.getURIRef());
    ResIterator assertionsOfComponent = metaModel.listSubjectsWithProperty(
        METAMODEL.assertedComponent, component);
    while (assertionsOfComponent.hasNext()) {
      Resource assertion = assertionsOfComponent.nextResource();
      if (!assertion.hasProperty(METAMODEL.asserter, sourceRes)) {
        continue;
      }
      Literal assertionTimeLit = assertion.getProperty(
          METAMODEL.assertionTime).getLiteral();
View Full Code Here

      final boolean forward) {

    Set<Date> resultDateSet = new HashSet<Date>();
    for (Source source : sources) {
      Resource sourceRes = metaModel.createResource(source.getURIRef());
      ResIterator assertions = metaModel.listSubjectsWithProperty(
          METAMODEL.asserter, sourceRes);
      while (assertions.hasNext()) {
        Resource assertion = assertions.nextResource();
        Literal assertionTimeLit = assertion.getProperty(
            METAMODEL.assertionTime).getLiteral();
        Date assertionTime;
        try {
          assertionTime = ((XSDDateTime) assertionTimeLit.getValue())
View Full Code Here

   *      java.util.Date, com.hp.hpl.jena.rdf.model.Resource)
   */
  public Set<NamedNode> getAssertions(Source source, Date moment,
      Resource type) {
    Resource sourceRes = metaModel.createResource(source.getURIRef());
    ResIterator assertions = metaModel.listSubjectsWithProperty(
        METAMODEL.asserter, sourceRes);
    Set<NamedNode> result = new HashSet<NamedNode>();
    while (assertions.hasNext()) {
      Resource assertion = assertions.nextResource();
      Literal assertionTimeLit = assertion.getProperty(
          METAMODEL.assertionTime).getLiteral();
      Resource assertedComponent = assertion.getProperty(
          METAMODEL.assertedComponent).getResource();
      if (!assertedComponent.hasProperty(RDF.type, type)) {
View Full Code Here

   *      java.util.Date, com.hp.hpl.jena.rdf.model.Resource)
   */
  public Set<NamedNode> getRevocations(Source source, Date moment,
      Resource type) {
    Resource sourceRes = metaModel.createResource(source.getURIRef());
    ResIterator assertions = metaModel.listSubjectsWithProperty(
        METAMODEL.asserter, sourceRes);
    Set<NamedNode> result = new HashSet<NamedNode>();
    while (assertions.hasNext()) {
      Resource assertion = assertions.nextResource();
      Resource assertedComponent = assertion.getProperty(
          METAMODEL.assertedComponent).getResource();
      if (!assertedComponent.hasProperty(RDF.type, type)) {
        continue;
      }
View Full Code Here

   * @return
   */
  private Resource getUserResource(String username) {
    Graph graph  = configGOT.getGraph(new Date());
    Model model = JenaUtil.getModelFromGraph(graph);
    ResIterator resIter = model.listSubjectsWithProperty(ACCOUNTMANAGER.userName, username);
    if (resIter.hasNext()) {
      return resIter.nextResource();
    } else {
      return model.createResource();
    }
  }
View Full Code Here

   * @return
   */
  private Resource getUserResource(String username) {
    Graph graph  = configGOT.getGraph(new Date());
    Model model = JenaUtil.getModelFromGraph(graph);
    ResIterator resIter = model.listSubjectsWithProperty(ACCOUNTMANAGER.userName, username);
    if (resIter.hasNext()) {
      return resIter.nextResource();
    } else {
      return null;
    }
   
  }
View Full Code Here

   * @param i
   * @return
   */
  private Iterator<ComponentDirectory> getComponentsByHash(int hashCode) {
    Literal hashLit = indexModel.createTypedLiteral(hashCode);
    final ResIterator resIterator = indexModel.listSubjectsWithProperty(
        METAMODEL.hashCode, hashLit);
    return new Iterator<ComponentDirectory>() {

      public boolean hasNext() {
        return resIterator.hasNext();
      }

      public ComponentDirectory next() {
        return new ComponentDirectory(resIterator.nextResource()
            .getURI());
      }

      public void remove() {
        throw new UnsupportedOperationException();
View Full Code Here

    };
  }

  private Iterator<ComponentDirectory> getComponentsByType(Resource type) {
    final ResIterator resIterator = indexModel.listSubjectsWithProperty(
        RDF.type, type);
    return new Iterator<ComponentDirectory>() {

      public boolean hasNext() {
        return resIterator.hasNext();
      }

      public ComponentDirectory next() {
        return new ComponentDirectory(resIterator.nextResource()
            .getURI());
      }

      public void remove() {
        throw new UnsupportedOperationException();
View Full Code Here

TOP

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

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.