Examples of RdfList


Examples of edu.stanford.smi.protegex.owl.model.RDFList

          (resource instanceof OWLUnionClass)?ILogicExpression.OR:ILogicExpression.AND);
      for(Object c: (Collection) ((OWLNAryLogicalClass) resource).getOperands() ){
        if(c instanceof RDFSClass){
          exp.add(convertParameter((RDFSClass)c));
        }else if(c instanceof RDFList){
          RDFList l = (RDFList) c;
          System.err.println("WARNING: unexpected list "+l.getBrowserText()+" in logic expression for "+getName());
        }
      }
      return exp;
    // we might have a complement
    }else if(resource instanceof OWLComplementClass){
View Full Code Here

Examples of org.apache.clerezza.rdf.utils.RdfList

  protected void bindSystemGraph(LockableMGraph systemGraph) {
    Lock l = systemGraph.getLock().readLock();
    l.lock();
    try {
      List<Resource> rdfTypePriorityList = new RdfList(
         typePriorityListUri, systemGraph);
      typePriorityList  = new ArrayList<UriRef>(rdfTypePriorityList.size());
      for (Resource resource : rdfTypePriorityList) {
        if (resource instanceof UriRef) {
          typePriorityList.add((UriRef) resource);
        } else {
          log.warn("Type priority list contains a resource "
View Full Code Here

Examples of org.apache.clerezza.rdf.utils.RdfList

    if (nextTo > userList.size()) {
      nextTo = userList.size();
    }

    NonLiteral userOverviewPage = new BNode();
    List<Resource> resultList = new RdfList(userOverviewPage, resultGraph);
    for (int i = from; i < to; i++) {
      resultList.add(userList.get(i).getNode());
    }
   
    UnionMGraph unionGraph = new UnionMGraph(resultGraph, systemGraph);
   
    GraphNode result = new GraphNode(userOverviewPage, unionGraph);
View Full Code Here

Examples of org.apache.clerezza.rdf.utils.RdfList

   
    MGraph additionGraph = new SimpleMGraph();

    UnionMGraph resultGraph = new UnionMGraph(additionGraph, contentGraph);

    RdfList list = RdfList.createEmptyList(resultResource, additionGraph);
    resultGraph.add(new TripleImpl(resource,
        SCRIPTMANAGER.scriptList, resultResource));
    resultGraph.add(new TripleImpl(resultResource, RDF.type,
        SCRIPTMANAGER.ScriptList));
   
    Iterator<Triple> it =
        contentGraph.filter(null, RDF.type, SCRIPT.Script);
    while (it.hasNext()) {
      list.add(it.next().getSubject());
    }
    return new GraphNode(resultResource,
        new UnionMGraph(resultGraph, contentGraph));
  }
View Full Code Here

Examples of org.apache.clerezza.rdf.utils.RdfList

  private GraphNode addLanguages(GraphNode node, NonLiteral platformInstance, List<LanguageDescription> languages,
      boolean copyToNode) {
    TripleCollection graph = node.getGraph();
    BNode listNode = new BNode();   
    RdfList list = new RdfList(listNode, graph);
    LockableMGraph configGraph = getConfigGraph();
    Lock readLock = configGraph.getLock().readLock();
    for (LanguageDescription languageDescription : languages) {
      NonLiteral languageUri = (NonLiteral) languageDescription.getResource().getNode();
      list.add(languageUri);
      if (copyToNode) {
        readLock.lock();
        try {
          graph.addAll(new GraphNode(languageUri, configGraph).getNodeContext());
        } finally {
View Full Code Here

Examples of org.apache.clerezza.rdf.utils.RdfList

    Lock writeLock = systemGraph.getLock().writeLock();
    writeLock.lock();
    try {
      // the constructor of RdfList might write to the graph! => requires a write lock
      final RdfList rdfList = new RdfList(listNode, systemGraph);
      languageList = Collections.synchronizedList(rdfList);
      //access to languages should not require access to system graph,
      //so copying the resources to an ArrayList
      languageListCache = Collections.synchronizedList(
          new ArrayList<Resource>(rdfList));
View Full Code Here

Examples of org.apache.clerezza.rdf.utils.RdfList

  public GraphNode list(@Context UriInfo uriInfo) {
    TrailingSlash.enforcePresent(uriInfo);
    TripleCollection resultGraph = new SimpleMGraph();
    LockableMGraph contentGraph = cgProvider.getContentGraph();
    GraphNode result = new GraphNode(new BNode(), new UnionMGraph(resultGraph, contentGraph));
    RdfList list = new RdfList(result);   
    Lock l = contentGraph.getLock().readLock();
    l.lock();
    try {
      Iterator<Triple> greetings = contentGraph.filter(null, RDF.type, CURIE.CuriePrefixBinding);
      while (greetings.hasNext()) {
        list.add(greetings.next().getSubject());
      }
    } finally {
      l.unlock();
    }
    result.addProperty(RDF.type, CURIE.CuriePrefixBindingList);
View Full Code Here

Examples of org.apache.clerezza.rdf.utils.RdfList

    return menus;
  }
 
  private NonLiteral asRdfList(SortedSet<Menu> menus, TripleCollection mGraph) {
    NonLiteral result = new BNode();
    RdfList list = new RdfList(result, mGraph);
    for (Menu menu : menus) {
      BNode node = new BNode();
      final String label = menu.root.getLabel();
      Literal labelLiteral = new PlainLiteralImpl(label);
      mGraph.add(new TripleImpl(node, RDFS.label,labelLiteral));
      final String description = menu.root.getDescription();
      if (description != null) {
        Literal descLiteral = new PlainLiteralImpl(description);
        mGraph.add(new TripleImpl(node, DCTERMS.description, descLiteral));
      }
      final String path = menu.root.getPath();
      if (path != null) {
        Literal pathLiteral = LiteralFactory.getInstance().
            createTypedLiteral(path);
        mGraph.add(new TripleImpl(node, GLOBALMENU.path, pathLiteral));
      }
      if (menu.children.size() > 0) {
        mGraph.add(new TripleImpl(node, GLOBALMENU.children,
            itemsAsRdfList(menu.children, mGraph)));
        mGraph.add(new TripleImpl(node, RDF.type, GLOBALMENU.Menu));
      } else {
        mGraph.add(new TripleImpl(node, RDF.type, GLOBALMENU.MenuItem));
      }
      list.add(node);
     
    }
    return result;
  }
View Full Code Here

Examples of org.apache.clerezza.rdf.utils.RdfList

    return result;
  }

  private NonLiteral itemsAsRdfList(SortedSet<GlobalMenuItem> menus, TripleCollection mGraph) {
    NonLiteral result = new BNode();
    RdfList list = new RdfList(result, mGraph);
    for (GlobalMenuItem item : menus) {
      BNode node = new BNode();
      final String label = item.getLabel();
      Literal labelLiteral = new PlainLiteralImpl(label);
      mGraph.add(new TripleImpl(node, RDFS.label,labelLiteral));
      final String description = item.getDescription();
      if (description != null) {
        Literal descLiteral = new PlainLiteralImpl(description);
        mGraph.add(new TripleImpl(node, DCTERMS.description, descLiteral));
      }
      final String path = item.getPath();
      if (path != null) {
        Literal pathLiteral = LiteralFactory.getInstance().
            createTypedLiteral(path);
        mGraph.add(new TripleImpl(node, GLOBALMENU.path, pathLiteral));
      }
      mGraph.add(new TripleImpl(node, RDF.type, GLOBALMENU.MenuItem));
      list.add(node);
    }
    return result;
  }
View Full Code Here

Examples of org.apache.clerezza.rdf.utils.RdfList

    GraphNode node = new GraphNode(new BNode(), new SimpleMGraph());
    contextProvider.addUserContext(node);
    Iterator<Resource> iter = node.getObjects(GLOBALMENU.globalMenu);
    Assert.assertTrue(iter.hasNext());
    TripleCollection graph = node.getGraph();
    RdfList list = new RdfList((NonLiteral)iter.next(), graph);
    Assert.assertEquals(3, list.size());
    Assert.assertEquals(GlobalMenuItemsProviderA.groupALabel,
        getLabel(graph, list.get(0)));
    Assert.assertEquals(GlobalMenuItemsProviderA.groupCLabel,
        getLabel(graph, list.get(1)));
    Assert.assertEquals(GlobalMenuItemsProviderA.implicitGroupBLabel,
        getLabel(graph, list.get(2)));   
    Assert.assertEquals(GLOBALMENU.Menu, getRdfType(graph, list.get(0)));
    Assert.assertEquals(GLOBALMENU.MenuItem, getRdfType(graph, list.get(1)));   
    Assert.assertEquals(GlobalMenuItemsProviderA.groupAPath,
        getPath(graph, list.get(0)));
    RdfList children = getChildren(graph, list.get(0));
    Assert.assertEquals(2, children.size());
    Assert.assertEquals(GlobalMenuItemsProviderA.itemA2Label,
        getLabel(graph, children.get(0)));
    Assert.assertEquals(GlobalMenuItemsProviderA.itemA1Label,
        getLabel(graph, children.get(1)));
    Assert.assertEquals(GlobalMenuItemsProviderA.itemA2Path,
        getPath(graph, children.get(0)));
  }
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.