{"action":"created","comment":{"url":"https://api.github.com/repos/diging/conceptpower/pulls/comments/77080388","id":77080388,"diff_hunk":"@@ -0,0 +1,147 @@\n+package edu.asu.conceptpower.servlet.rdf;\n+\n+import java.io.StringWriter;\n+import java.util.HashMap;\n+import java.util.Map;\n+\n+import org.apache.jena.rdf.model.Model;\n+import org.apache.jena.rdf.model.ModelFactory;\n+import org.apache.jena.rdf.model.Property;\n+import org.apache.jena.rdf.model.Resource;\n+import org.apache.jena.shared.BadURIException;\n+import org.apache.jena.vocabulary.RDF;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+import org.springframework.beans.factory.annotation.Autowired;\n+import org.springframework.stereotype.Component;\n+\n+import edu.asu.conceptpower.core.ConceptEntry;\n+import edu.asu.conceptpower.root.TypeDatabaseClient;\n+import edu.asu.conceptpower.root.URIHelper;\n+\n+@Component\n+public class RDFMessageFactory {\n+\n+    private static final Logger logger = LoggerFactory.getLogger(RDFMessageFactory.class);\n+\n+    @Autowired\n+    private TypeDatabaseClient typeManager;\n+\n+    @Autowired\n+    private URIHelper creator;\n+\n+    private final String madsrdf = \"http://www.loc.gov/mads/rdf/v1#\";\n+    private final String rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\";\n+    private final String cidocCrm = \"http://www.cidoc-crm.org/cidoc-crm/\";\n+    private final String dCTerms = \"http://purl.org/dc/terms/\";\n+    private final String schema = \"http://schema.org/\";\n+    private final String changeset = \"http://purl.org/vocab/changeset/schema#\";\n+    private final String owl = \"http://www.w3.org/2002/07/owl#\";\n+    private final String skos = \"http://www.w3.org/2008/05/skos#\";\n+    private final String skosType = \"http://www.w3.org/2008/05/skos#Concept\";\n+    private final String authorityType = \"http://www.loc.gov/mads/rdf/v1#Authority\";\n+\n+    public String generateRDF(ConceptEntry[] entries) {\n+        Model model = ModelFactory.createDefaultModel();\n+        String syntax = \"RDF/XML\";\n+        StringWriter out = new StringWriter();\n+        try {\n+            for (ConceptEntry entry : entries) {\n+                model.setNsPrefixes(setPrefixMap());\n+                Property identifiers = model.createProperty(dCTerms + \"identifiers\");\n+                Property madsrdfProperty = model.createProperty(madsrdf + \"authoritativeLabel\");\n+                Property skosProperty = model.createProperty(skos + \"prefLabel\");\n+                Property schemaName = model.createProperty(schema + \"name\");\n+                Property schemaDescription = model.createProperty(schema + \"description\");\n+                Property madsrdfCL = model.createProperty(madsrdf + \"isMemberOfMADSCollection\");\n+                Property csCreator = model.createProperty(changeset + \"creatorName\");\n+                Property owlEqualTo = model.createProperty(owl + \"sameAs\");\n+                Property rdfsSeeAlso = model.createProperty(rdf + \"seeAlso\");\n+                Property skosRelated = model.createProperty(skos + \"related\");\n+\n+                Resource resource = model.createResource(creator.getURI(entry));\n+\n+                resource.addProperty(identifiers, entry.getId());\n+                resource.addProperty(madsrdfProperty, entry.getWord());\n+                resource.addProperty(skosProperty, entry.getWord());\n+                resource.addProperty(schemaName, entry.getWord());\n+                resource.addProperty(schemaDescription, entry.getDescription());\n+\n+                if (entry.getConceptList() != null) {\n+                    resource.addProperty(madsrdfCL, creator.getConceptListURI(entry));\n+                }\n+\n+                if (entry.getCreatorId() != null) {\n+                    resource.addProperty(csCreator, entry.getCreatorId());\n+                }\n+\n+                if (entry.getModified() != null) {\n+                    resource.addProperty(csCreator, entry.getCreatorId());\n+                }\n+\n+                if (entry.getEqualTo() != null) {\n+                    String[] equals = entry.getEqualTo().split(\",\");\n+                    for (String equal : equals) {\n+                        resource.addProperty(owlEqualTo, equal);\n+                    }\n+                }\n+\n+                if (entry.getSimilarTo() != null) {\n+                    String[] similarTo = entry.getSimilarTo().split(\",\");\n+                    for (String similar : similarTo) {\n+                        resource.addProperty(rdfsSeeAlso, similar);\n+                    }\n+                }\n+\n+                if (entry.getWordnetId() != null) {\n+                    resource.addProperty(owlEqualTo, creator.getWordnetURI(entry));\n+                }\n+\n+                if (entry.getSynonymIds() != null) {\n+                    String[] synonymIds = entry.getSynonymIds()\n+                            .split(edu.asu.conceptpower.servlet.core.Constants.SYNONYM_SEPARATOR);\n+                    for (String synonymId : synonymIds) {\n+                        resource.addProperty(skosRelated, synonymId);\n+                    }\n+                }\n+\n+                Resource typeResource = model.createResource(skosType);\n+                resource.addProperty(RDF.type, typeResource);\n+\n+                Resource typeRes = model.createResource(authorityType);\n+                resource.addProperty(RDF.type, typeRes);\n+\n+                if (entry.getTypeId() != null) {\n+                    Resource typesRes = model.createResource(creator.getTypeURI(entry));\n+                    resource.addProperty(RDF.type, typesRes);\n+                }\n+\n+                String matchesURI = entry.getTypeId();\n+                if (matchesURI != null) {\n+                    String matches = typeManager.getType(matchesURI).getMatches();\n+                    Resource cdocResource = model.createResource(matches);\n+                    resource.addProperty(RDF.type, cdocResource);\n+                }\n+                model.write(out, syntax);\n+            }\n+        } catch (BadURIException e) {","path":"Conceptpower+Spring/src/main/java/edu/asu/conceptpower/servlet/rdf/RDFMessageFactory.java","position":127,"original_position":127,"commit_id":"8e13f1251b1e9099a2a093d5bb4a6c3e94daac97","original_commit_id":"8e13f1251b1e9099a2a093d5bb4a6c3e94daac97","user":{"login":"mkarthik90","id":9751475,"avatar_url":"https://avatars.githubusercontent.com/u/9751475?v=3","gravatar_id":"","url":"https://api.github.com/users/mkarthik90","html_url":"https://github.com/mkarthik90","followers_url":"https://api.github.com/users/mkarthik90/followers","following_url":"https://api.github.com/users/mkarthik90/following{/other_user}","gists_url":"https://api.github.com/users/mkarthik90/gists{/gist_id}","starred_url":"https://api.github.com/users/mkarthik90/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkarthik90/subscriptions","organizations_url":"https://api.github.com/users/mkarthik90/orgs","repos_url":"https://api.github.com/users/mkarthik90/repos","events_url":"https://api.github.com/users/mkarthik90/events{/privacy}","received_events_url":"https://api.github.com/users/mkarthik90/received_events","type":"User","site_admin":false},"body":"@jdamerow  This is an unchecked exception in Jena. Added this exception because rdf generation was failing due to uri issues. For uris of the form : **http://www.digitalhps.org/concepts/CON03480566-fc65-4f1e-b81c-83f0d0ababb5**, rdf generation is failing. For other uris such as : **http://www.digitalhps.org/concepts/WID-02382437-N-01-pony**, it works fine. Can i make code changes such that we dont include the failing uris (or) I can include these by changing the type to N-TRIPLE instead of RDF/X. But when I change the type to N-TRIPLE, rdf format looks different. ","created_at":"2016-08-31T21:50:26Z","updated_at":"2016-08-31T21:50:26Z","html_url":"https://github.com/diging/conceptpower/pull/120#discussion_r77080388","pull_request_url":"https://api.github.com/repos/diging/conceptpower/pulls/120","_links":{"self":{"href":"https://api.github.com/repos/diging/conceptpower/pulls/comments/77080388"},"html":{"href":"https://github.com/diging/conceptpower/pull/120#discussion_r77080388"},"pull_request":{"href":"https://api.github.com/repos/diging/conceptpower/pulls/120"}}},"pull_request":{"url":"https://api.github.com/repos/diging/conceptpower/pulls/120","id":83532706,"html_url":"https://github.com/diging/conceptpower/pull/120","diff_url":"https://github.com/diging/conceptpower/pull/120.diff","patch_url":"https://github.com/diging/conceptpower/pull/120.patch","issue_url":"https://api.github.com/repos/diging/conceptpower/issues/120","number":120,"state":"open","locked":false,"title":"CCP-135 RDF format for API","user":{"login":"mkarthik90","id":9751475,"avatar_url":"https://avatars.githubusercontent.com/u/9751475?v=3","gravatar_id":"","url":"https://api.github.com/users/mkarthik90","html_url":"https://github.com/mkarthik90","followers_url":"https://api.github.com/users/mkarthik90/followers","following_url":"https://api.github.com/users/mkarthik90/following{/other_user}","gists_url":"https://api.github.com/users/mkarthik90/gists{/gist_id}","starred_url":"https://api.github.com/users/mkarthik90/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkarthik90/subscriptions","organizations_url":"https://api.github.com/users/mkarthik90/orgs","repos_url":"https://api.github.com/users/mkarthik90/repos","events_url":"https://api.github.com/users/mkarthik90/events{/privacy}","received_events_url":"https://api.github.com/users/mkarthik90/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-08-31T21:27:30Z","updated_at":"2016-08-31T21:50:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"597c9c637599999eb9274acacf947e13a310e5d3","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/diging/conceptpower/pulls/120/commits","review_comments_url":"https://api.github.com/repos/diging/conceptpower/pulls/120/comments","review_comment_url":"https://api.github.com/repos/diging/conceptpower/pulls/comments{/number}","comments_url":"https://api.github.com/repos/diging/conceptpower/issues/120/comments","statuses_url":"https://api.github.com/repos/diging/conceptpower/statuses/8e13f1251b1e9099a2a093d5bb4a6c3e94daac97","head":{"label":"diging:CCP-135","ref":"CCP-135","sha":"8e13f1251b1e9099a2a093d5bb4a6c3e94daac97","user":{"login":"diging","id":5402168,"avatar_url":"https://avatars.githubusercontent.com/u/5402168?v=3","gravatar_id":"","url":"https://api.github.com/users/diging","html_url":"https://github.com/diging","followers_url":"https://api.github.com/users/diging/followers","following_url":"https://api.github.com/users/diging/following{/other_user}","gists_url":"https://api.github.com/users/diging/gists{/gist_id}","starred_url":"https://api.github.com/users/diging/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diging/subscriptions","organizations_url":"https://api.github.com/users/diging/orgs","repos_url":"https://api.github.com/users/diging/repos","events_url":"https://api.github.com/users/diging/events{/privacy}","received_events_url":"https://api.github.com/users/diging/received_events","type":"Organization","site_admin":false},"repo":{"id":32412644,"name":"conceptpower","full_name":"diging/conceptpower","owner":{"login":"diging","id":5402168,"avatar_url":"https://avatars.githubusercontent.com/u/5402168?v=3","gravatar_id":"","url":"https://api.github.com/users/diging","html_url":"https://github.com/diging","followers_url":"https://api.github.com/users/diging/followers","following_url":"https://api.github.com/users/diging/following{/other_user}","gists_url":"https://api.github.com/users/diging/gists{/gist_id}","starred_url":"https://api.github.com/users/diging/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diging/subscriptions","organizations_url":"https://api.github.com/users/diging/orgs","repos_url":"https://api.github.com/users/diging/repos","events_url":"https://api.github.com/users/diging/events{/privacy}","received_events_url":"https://api.github.com/users/diging/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/diging/conceptpower","description":"","fork":false,"url":"https://api.github.com/repos/diging/conceptpower","forks_url":"https://api.github.com/repos/diging/conceptpower/forks","keys_url":"https://api.github.com/repos/diging/conceptpower/keys{/key_id}","collaborators_url":"https://api.github.com/repos/diging/conceptpower/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/diging/conceptpower/teams","hooks_url":"https://api.github.com/repos/diging/conceptpower/hooks","issue_events_url":"https://api.github.com/repos/diging/conceptpower/issues/events{/number}","events_url":"https://api.github.com/repos/diging/conceptpower/events","assignees_url":"https://api.github.com/repos/diging/conceptpower/assignees{/user}","branches_url":"https://api.github.com/repos/diging/conceptpower/branches{/branch}","tags_url":"https://api.github.com/repos/diging/conceptpower/tags","blobs_url":"https://api.github.com/repos/diging/conceptpower/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/diging/conceptpower/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/diging/conceptpower/git/refs{/sha}","trees_url":"https://api.github.com/repos/diging/conceptpower/git/trees{/sha}","statuses_url":"https://api.github.com/repos/diging/conceptpower/statuses/{sha}","languages_url":"https://api.github.com/repos/diging/conceptpower/languages","stargazers_url":"https://api.github.com/repos/diging/conceptpower/stargazers","contributors_url":"https://api.github.com/repos/diging/conceptpower/contributors","subscribers_url":"https://api.github.com/repos/diging/conceptpower/subscribers","subscription_url":"https://api.github.com/repos/diging/conceptpower/subscription","commits_url":"https://api.github.com/repos/diging/conceptpower/commits{/sha}","git_commits_url":"https://api.github.com/repos/diging/conceptpower/git/commits{/sha}","comments_url":"https://api.github.com/repos/diging/conceptpower/comments{/number}","issue_comment_url":"https://api.github.com/repos/diging/conceptpower/issues/comments{/number}","contents_url":"https://api.github.com/repos/diging/conceptpower/contents/{+path}","compare_url":"https://api.github.com/repos/diging/conceptpower/compare/{base}...{head}","merges_url":"https://api.github.com/repos/diging/conceptpower/merges","archive_url":"https://api.github.com/repos/diging/conceptpower/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/diging/conceptpower/downloads","issues_url":"https://api.github.com/repos/diging/conceptpower/issues{/number}","pulls_url":"https://api.github.com/repos/diging/conceptpower/pulls{/number}","milestones_url":"https://api.github.com/repos/diging/conceptpower/milestones{/number}","notifications_url":"https://api.github.com/repos/diging/conceptpower/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/diging/conceptpower/labels{/name}","releases_url":"https://api.github.com/repos/diging/conceptpower/releases{/id}","deployments_url":"https://api.github.com/repos/diging/conceptpower/deployments","created_at":"2015-03-17T18:35:40Z","updated_at":"2016-01-13T21:16:57Z","pushed_at":"2016-08-31T21:27:30Z","git_url":"git://github.com/diging/conceptpower.git","ssh_url":"git@github.com:diging/conceptpower.git","clone_url":"https://github.com/diging/conceptpower.git","svn_url":"https://github.com/diging/conceptpower","homepage":"http://diging.github.io/conceptpower/","size":20307,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":2,"default_branch":"develop"}},"base":{"label":"diging:develop","ref":"develop","sha":"38a47c365d22641bdd37c92a18b8fe46634934f9","user":{"login":"diging","id":5402168,"avatar_url":"https://avatars.githubusercontent.com/u/5402168?v=3","gravatar_id":"","url":"https://api.github.com/users/diging","html_url":"https://github.com/diging","followers_url":"https://api.github.com/users/diging/followers","following_url":"https://api.github.com/users/diging/following{/other_user}","gists_url":"https://api.github.com/users/diging/gists{/gist_id}","starred_url":"https://api.github.com/users/diging/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diging/subscriptions","organizations_url":"https://api.github.com/users/diging/orgs","repos_url":"https://api.github.com/users/diging/repos","events_url":"https://api.github.com/users/diging/events{/privacy}","received_events_url":"https://api.github.com/users/diging/received_events","type":"Organization","site_admin":false},"repo":{"id":32412644,"name":"conceptpower","full_name":"diging/conceptpower","owner":{"login":"diging","id":5402168,"avatar_url":"https://avatars.githubusercontent.com/u/5402168?v=3","gravatar_id":"","url":"https://api.github.com/users/diging","html_url":"https://github.com/diging","followers_url":"https://api.github.com/users/diging/followers","following_url":"https://api.github.com/users/diging/following{/other_user}","gists_url":"https://api.github.com/users/diging/gists{/gist_id}","starred_url":"https://api.github.com/users/diging/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diging/subscriptions","organizations_url":"https://api.github.com/users/diging/orgs","repos_url":"https://api.github.com/users/diging/repos","events_url":"https://api.github.com/users/diging/events{/privacy}","received_events_url":"https://api.github.com/users/diging/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/diging/conceptpower","description":"","fork":false,"url":"https://api.github.com/repos/diging/conceptpower","forks_url":"https://api.github.com/repos/diging/conceptpower/forks","keys_url":"https://api.github.com/repos/diging/conceptpower/keys{/key_id}","collaborators_url":"https://api.github.com/repos/diging/conceptpower/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/diging/conceptpower/teams","hooks_url":"https://api.github.com/repos/diging/conceptpower/hooks","issue_events_url":"https://api.github.com/repos/diging/conceptpower/issues/events{/number}","events_url":"https://api.github.com/repos/diging/conceptpower/events","assignees_url":"https://api.github.com/repos/diging/conceptpower/assignees{/user}","branches_url":"https://api.github.com/repos/diging/conceptpower/branches{/branch}","tags_url":"https://api.github.com/repos/diging/conceptpower/tags","blobs_url":"https://api.github.com/repos/diging/conceptpower/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/diging/conceptpower/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/diging/conceptpower/git/refs{/sha}","trees_url":"https://api.github.com/repos/diging/conceptpower/git/trees{/sha}","statuses_url":"https://api.github.com/repos/diging/conceptpower/statuses/{sha}","languages_url":"https://api.github.com/repos/diging/conceptpower/languages","stargazers_url":"https://api.github.com/repos/diging/conceptpower/stargazers","contributors_url":"https://api.github.com/repos/diging/conceptpower/contributors","subscribers_url":"https://api.github.com/repos/diging/conceptpower/subscribers","subscription_url":"https://api.github.com/repos/diging/conceptpower/subscription","commits_url":"https://api.github.com/repos/diging/conceptpower/commits{/sha}","git_commits_url":"https://api.github.com/repos/diging/conceptpower/git/commits{/sha}","comments_url":"https://api.github.com/repos/diging/conceptpower/comments{/number}","issue_comment_url":"https://api.github.com/repos/diging/conceptpower/issues/comments{/number}","contents_url":"https://api.github.com/repos/diging/conceptpower/contents/{+path}","compare_url":"https://api.github.com/repos/diging/conceptpower/compare/{base}...{head}","merges_url":"https://api.github.com/repos/diging/conceptpower/merges","archive_url":"https://api.github.com/repos/diging/conceptpower/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/diging/conceptpower/downloads","issues_url":"https://api.github.com/repos/diging/conceptpower/issues{/number}","pulls_url":"https://api.github.com/repos/diging/conceptpower/pulls{/number}","milestones_url":"https://api.github.com/repos/diging/conceptpower/milestones{/number}","notifications_url":"https://api.github.com/repos/diging/conceptpower/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/diging/conceptpower/labels{/name}","releases_url":"https://api.github.com/repos/diging/conceptpower/releases{/id}","deployments_url":"https://api.github.com/repos/diging/conceptpower/deployments","created_at":"2015-03-17T18:35:40Z","updated_at":"2016-01-13T21:16:57Z","pushed_at":"2016-08-31T21:27:30Z","git_url":"git://github.com/diging/conceptpower.git","ssh_url":"git@github.com:diging/conceptpower.git","clone_url":"https://github.com/diging/conceptpower.git","svn_url":"https://github.com/diging/conceptpower","homepage":"http://diging.github.io/conceptpower/","size":20307,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":2,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/diging/conceptpower/pulls/120"},"html":{"href":"https://github.com/diging/conceptpower/pull/120"},"issue":{"href":"https://api.github.com/repos/diging/conceptpower/issues/120"},"comments":{"href":"https://api.github.com/repos/diging/conceptpower/issues/120/comments"},"review_comments":{"href":"https://api.github.com/repos/diging/conceptpower/pulls/120/comments"},"review_comment":{"href":"https://api.github.com/repos/diging/conceptpower/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/diging/conceptpower/pulls/120/commits"},"statuses":{"href":"https://api.github.com/repos/diging/conceptpower/statuses/8e13f1251b1e9099a2a093d5bb4a6c3e94daac97"}}}}
{"actor":{"display_login":"mkarthik90"}}