MARMOTTA-449: added missing triples

Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/529f4e6d
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/529f4e6d
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/529f4e6d

Branch: refs/heads/develop
Commit: 529f4e6dbe534ad99de992b62bc3163b84dc4e9d
Parents: 3c1962b
Author: Sergio Fernández <[email protected]>
Authored: Mon Mar 3 16:19:49 2014 +0100
Committer: Sergio Fernández <[email protected]>
Committed: Mon Mar 3 16:19:49 2014 +0100

----------------------------------------------------------------------
 .../apache/marmotta/commons/vocabulary/LDP.java | 156 ++++++++++---------
 .../platform/ldp/services/LdpServiceImpl.java   |   7 +-
 2 files changed, 89 insertions(+), 74 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/529f4e6d/commons/marmotta-sesame-tools/marmotta-model-vocabs/src/main/java/org/apache/marmotta/commons/vocabulary/LDP.java
----------------------------------------------------------------------
diff --git 
a/commons/marmotta-sesame-tools/marmotta-model-vocabs/src/main/java/org/apache/marmotta/commons/vocabulary/LDP.java
 
b/commons/marmotta-sesame-tools/marmotta-model-vocabs/src/main/java/org/apache/marmotta/commons/vocabulary/LDP.java
index 1599c02..967d1c9 100644
--- 
a/commons/marmotta-sesame-tools/marmotta-model-vocabs/src/main/java/org/apache/marmotta/commons/vocabulary/LDP.java
+++ 
b/commons/marmotta-sesame-tools/marmotta-model-vocabs/src/main/java/org/apache/marmotta/commons/vocabulary/LDP.java
@@ -20,27 +20,27 @@ import org.openrdf.model.URI;
 import org.openrdf.model.ValueFactory;
 import org.openrdf.model.impl.ValueFactoryImpl;
 
-/** 
+/**
  * Namespace LDP
  */
 public class LDP {
 
-       public static final String NAMESPACE = "http://www.w3.org/ns/ldp#";;
+    public static final String NAMESPACE = "http://www.w3.org/ns/ldp#";;
 
-       public static final String PREFIX = "ldp";
+    public static final String PREFIX = "ldp";
 
-       /**
-        * A Linked Data Platform Container (LDPC) that also conforms to
-        * additional patterns and conventions for managing members.  It is 
distinguished from
-        * CompositeContainer by the following behaviors:
+    /**
+     * A Linked Data Platform Container (LDPC) that also conforms to
+     * additional patterns and conventions for managing members.  It is 
distinguished from
+     * CompositeContainer by the following behaviors:
      * <ol>
-        *   <li>Clients cannot assume that an AggregateContainer, when 
deleted, deletes its members.
+     * <li>Clients cannot assume that an AggregateContainer, when deleted, 
deletes its members.
      * </ol>
-     *
-        * While every attempt is made to be complete in this list, readers 
should also refer
-        * to the specification defining this ontology.
-        */
-       public static final URI AggregateContainer;
+     * <p/>
+     * While every attempt is made to be complete in this list, readers should 
also refer
+     * to the specification defining this ontology.
+     */
+    public static final URI AggregateContainer;
 
     /**
      * FIXME: Not yet part of the official vocab, but used in the Spec. 
(2014-02-18)
@@ -48,35 +48,45 @@ public class LDP {
     public static final URI BasicContainer;
 
     /**
-        * A Linked Data Platform Container (LDPC) that also conforms to
-        * additional patterns and conventions for managing members.  It is 
distinguished from
-        * AggregateContainer by the following behaviors:
+     * A Linked Data Platform Container (LDPC) that also conforms to
+     * additional patterns and conventions for managing members.  It is 
distinguished from
+     * AggregateContainer by the following behaviors:
      * <ol>
-     *   <li>An CompositeContainer, when deleted, must delete all its members.
+     * <li>An CompositeContainer, when deleted, must delete all its members.
      * </ol>
-     *
-        * While every attempt is made to be complete in this list, readers 
should also
-        * refer to the specification defining this ontology.
-        */
-       public static final URI CompositeContainer;
-
-       /**
-        * A Linked Data Platform Resource (LDPR) that also conforms to
-        * additional patterns and conventions for managing membership.
-        * Readers should refer to the specification defining this ontology for 
the list of
-        * behaviors associated with it.
-        */
-       public static final URI Container;
-
-       /**
-        * A resource that represents a limited set of members of a LDP 
Container. 
-        */
-       public static final URI Page;
-
-       /**
-        * A HTTP-addressable resource with a linked data representation. 
-        */
-       public static final URI Resource;
+     * <p/>
+     * While every attempt is made to be complete in this list, readers should 
also
+     * refer to the specification defining this ontology.
+     */
+    public static final URI CompositeContainer;
+
+    /**
+     * A Linked Data Platform Resource (LDPR) that also conforms to
+     * additional patterns and conventions for managing membership.
+     * Readers should refer to the specification defining this ontology for 
the list of
+     * behaviors associated with it.
+     */
+    public static final URI Container;
+
+    /**
+     * A resource that represents a limited set of members of a LDP Container.
+     */
+    public static final URI Page;
+
+    /**
+     * A HTTP-addressable resource with a linked data representation.
+     */
+    public static final URI Resource;
+
+    /**
+     * A HTTP-addressable resource with a RDF Source representation.
+     */
+    public static final URI RdfResource;
+
+    /**
+     * A HTTP-addressable resource with a Non-RDF Source representation.
+     */
+    public static final URI NonRdfResource;
 
     /**
      * FIXME: Not yet part of the vocab, but used in the spec. (2014-02-24)
@@ -84,9 +94,9 @@ public class LDP {
     public static final URI contains;
 
     /**
-        * List of predicates that indicate the ascending order of the members 
in a page. 
-        */
-       public static final URI containerSortPredicates;
+     * List of predicates that indicate the ascending order of the members in 
a page.
+     */
+    public static final URI containerSortPredicates;
 
     /**
      * FIXME: Not yet part of the vocab, but used in the spec. (2014-02-18)
@@ -94,41 +104,43 @@ public class LDP {
     public static final URI member;
 
     /**
-        * Indicates which predicate of the container should be used to 
determine the membership. 
-        */
-       public static final URI membershipPredicate;
+     * Indicates which predicate of the container should be used to determine 
the membership.
+     */
+    public static final URI membershipPredicate;
 
-       /**
-        * Indicates which resource is the subject for the members of the 
container. 
-        */
-       public static final URI membershipSubject;
+    /**
+     * Indicates which resource is the subject for the members of the 
container.
+     */
+    public static final URI membershipSubject;
 
-       /**
-        * From a known page, how to indicate the next or last page as rdf:nil. 
-        */
-       public static final URI nextPage;
+    /**
+     * From a known page, how to indicate the next or last page as rdf:nil.
+     */
+    public static final URI nextPage;
 
-       /**
-        * Associated a page with its container. 
-        */
-       public static final URI pageOf;
+    /**
+     * Associated a page with its container.
+     */
+    public static final URI pageOf;
 
 
-       static{
-               ValueFactory factory = ValueFactoryImpl.getInstance();
-               AggregateContainer = factory.createURI(LDP.NAMESPACE, 
"AggregateContainer");
+    static {
+        ValueFactory factory = ValueFactoryImpl.getInstance();
+        AggregateContainer = factory.createURI(LDP.NAMESPACE, 
"AggregateContainer");
         BasicContainer = factory.createURI(LDP.NAMESPACE, "BasicContainer");
-               CompositeContainer = factory.createURI(LDP.NAMESPACE, 
"CompositeContainer");
-               Container = factory.createURI(LDP.NAMESPACE, "Container");
-               Page = factory.createURI(LDP.NAMESPACE, "Page");
-               Resource = factory.createURI(LDP.NAMESPACE, "Resource");
+        CompositeContainer = factory.createURI(LDP.NAMESPACE, 
"CompositeContainer");
+        Container = factory.createURI(LDP.NAMESPACE, "Container");
+        Page = factory.createURI(LDP.NAMESPACE, "Page");
+        Resource = factory.createURI(LDP.NAMESPACE, "Resource");
+        RdfResource = factory.createURI(LDP.NAMESPACE, "RdfResource"); //TODO: 
missing term in the vocab
+        NonRdfResource = factory.createURI(LDP.NAMESPACE, "NonRdfResource"); 
//TODO: missing term in the vocab
         contains = factory.createURI(LDP.NAMESPACE, "contains");
-               containerSortPredicates = factory.createURI(LDP.NAMESPACE, 
"containerSortPredicates");
-               member = factory.createURI(LDP.NAMESPACE, "member");
-               membershipPredicate = factory.createURI(LDP.NAMESPACE, 
"membershipPredicate");
-               membershipSubject = factory.createURI(LDP.NAMESPACE, 
"membershipSubject");
-               nextPage = factory.createURI(LDP.NAMESPACE, "nextPage");
-               pageOf = factory.createURI(LDP.NAMESPACE, "pageOf");
-       }
+        containerSortPredicates = factory.createURI(LDP.NAMESPACE, 
"containerSortPredicates");
+        member = factory.createURI(LDP.NAMESPACE, "member");
+        membershipPredicate = factory.createURI(LDP.NAMESPACE, 
"membershipPredicate");
+        membershipSubject = factory.createURI(LDP.NAMESPACE, 
"membershipSubject");
+        nextPage = factory.createURI(LDP.NAMESPACE, "nextPage");
+        pageOf = factory.createURI(LDP.NAMESPACE, "pageOf");
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/529f4e6d/platform/marmotta-ldp/src/main/java/org/apache/marmotta/platform/ldp/services/LdpServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/platform/marmotta-ldp/src/main/java/org/apache/marmotta/platform/ldp/services/LdpServiceImpl.java
 
b/platform/marmotta-ldp/src/main/java/org/apache/marmotta/platform/ldp/services/LdpServiceImpl.java
index e5eea4e..fffa16a 100644
--- 
a/platform/marmotta-ldp/src/main/java/org/apache/marmotta/platform/ldp/services/LdpServiceImpl.java
+++ 
b/platform/marmotta-ldp/src/main/java/org/apache/marmotta/platform/ldp/services/LdpServiceImpl.java
@@ -173,14 +173,15 @@ public class LdpServiceImpl implements LdpService {
         connection.add(container, DCTERMS.modified, now, ldpContext);
 
         // Add the bodyContent
-        log.trace("Content ({}) for new resource <{}>", type, resource);
+        connection.add(resource, RDF.TYPE, LDP.Resource, ldpContext);
         final RDFFormat rdfFormat = 
Rio.getParserFormatForMIMEType(type.toString());
         if (rdfFormat == null) {
             log.debug("POST creates new LDP-BR, because no RDF parser found 
for type {}", type);
             Literal format = valueFactory.createLiteral(type.toString());
             URI binaryResource = valueFactory.createURI(resource.stringValue() 
+ LdpUtils.getExtension(type.toString()));
 
-            //connection.add(resource, RDF.TYPE, LDP.NonRdfResource, 
ldpContext); //TODO:
+            connection.add(resource, RDF.TYPE, LDP.Resource, ldpContext);
+            connection.add(resource, RDF.TYPE, LDP.NonRdfResource, ldpContext);
             connection.add(binaryResource, DCTERMS.created, now, ldpContext);
             connection.add(binaryResource, DCTERMS.modified, now, ldpContext);
 
@@ -188,6 +189,7 @@ public class LdpServiceImpl implements LdpService {
             //TODO: check conformance with 6.2.3.12
             connection.add(binaryResource, DCTERMS.format, format, 
ldpContext); //nie:mimeType ?
             connection.add(binaryResource, DCTERMS.isFormatOf, resource, 
ldpContext);
+            connection.add(resource, DCTERMS.hasFormat, binaryResource, 
ldpContext);
 
             //TODO: something else?
 
@@ -198,6 +200,7 @@ public class LdpServiceImpl implements LdpService {
             log.debug("POST creates new LDP-RR, data provided as {}", 
rdfFormat.getName());
 
             connection.add(resource, RDF.TYPE, LDP.Resource, ldpContext);
+            connection.add(resource, RDF.TYPE, LDP.RdfResource, ldpContext);
             connection.add(resource, DCTERMS.created, now, ldpContext);
             connection.add(resource, DCTERMS.modified, now, ldpContext);
 

Reply via email to